function configFromEmbedded(embeddedUrl) { // Old-style link? var params; try { params = url.unrisonify(embeddedUrl); } catch (e) { } if (params && params.source && params.compiler) { var filters = _.chain((params.filters || "").split(',')) .map(function (o) { return [o, true]; }) .object() .value(); return { content: [ { type: 'row', content: [ Components.getEditorWith(1, params.source, filters), Components.getCompilerWith(1, filters, params.options, params.compiler) ] } ] }; } else { return url.deserialiseState(embeddedUrl); } }
function convertOldState(state) { var sc = state.compilers[0]; if (!sc) throw new Error("Unable to determine compiler from old state"); var content = []; var source; if (sc.sourcez) { source = lzstring.decompressFromBase64(sc.sourcez); } else { source = sc.source; } var options = {compileOnChange: true, colouriseAsm: state.filterAsm.colouriseAsm}; var filters = _.clone(state.filterAsm); delete filters.colouriseAsm; content.push(Components.getEditorWith(1, source, options)); content.push(Components.getCompilerWith(1, filters, sc.options, sc.compiler)); return {version: 4, content: [{type: 'row', content: content}]}; }