diff --git a/client/commonFramework.js b/client/commonFramework.js index acbe741d4b..613f644c65 100644 --- a/client/commonFramework.js +++ b/client/commonFramework.js @@ -7,23 +7,25 @@ var common = (function() { init: [] }; - common.challengeName = common.challengeName || window.challenge_Name ? - window.challenge_Name : - ''; + common.challengeName = common.challengeName || window.challenge_Name || ''; - common.challengeType = common.challengeType || window.challengeType ? - window.challengeType : - 0; + common.challengeType = common.challengeType || window.challengeType || 0; common.challengeId = common.challengeId || window.challenge_Id; - common.challengeSeed = common.challengeSeed || window.challengeSeed ? - window.challengeSeed : - []; + common.challengeSeed = common.challengeSeed || window.challengeSeed || []; - common.seed = common.challengeSeed.reduce(function(seed, line) { - return seed + line + '\n'; - }, ''); + common.head = common.head || ''; + common.tail = common.tail || ''; + + common.convertSeed = function(seedData) { + seedData = seedData || []; + return seedData.reduce(function(seed, line) { + return seed + line + '\n'; + }, ''); + }; + + common.seed = common.convertSeed(common.challengeSeed); common.replaceScriptTags = function replaceScriptTags(value) { return value @@ -482,7 +484,7 @@ var editor = (function(CodeMirror, emmetCodeMirror, common) { }(window.CodeMirror, window.emmetCodeMirror, common)); -var tests = tests || []; +var tests = common.tests || []; var libraryIncludes = "