From fa867c3a34056374bfb2acb1b625cf1276df3dfb Mon Sep 17 00:00:00 2001 From: Richard Knoll Date: Tue, 12 Dec 2017 15:24:36 -0800 Subject: [PATCH] Cleanup --- package.json | 1 + sim/instructions.ts | 91 --------------- sim/public/siminstructions.html | 201 -------------------------------- 3 files changed, 1 insertion(+), 292 deletions(-) delete mode 100644 sim/instructions.ts delete mode 100644 sim/public/siminstructions.html diff --git a/package.json b/package.json index 3fec37d6..0087de27 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "semantic-ui-less": "^2.2.4", "@types/bluebird": "2.0.33", "@types/jquery": "3.2.16", + "@types/marked": "0.3.0", "@types/node": "8.0.53" }, "dependencies": { diff --git a/sim/instructions.ts b/sim/instructions.ts deleted file mode 100644 index b0f872a0..00000000 --- a/sim/instructions.ts +++ /dev/null @@ -1,91 +0,0 @@ -/// -/// - -//HACK: allows instructions.html to access pxtblocks without requiring simulator.html to import blocks as well -if (!(window).pxt) (window).pxt = {}; -import pxtrunner = pxt.runner; -import pxtdocs = pxt.docs; - -namespace pxsim.instructions { - export function drawInstructions() { - pxsim.visuals.mkBoardView = (opts: pxsim.visuals.BoardViewOptions): pxsim.visuals.BoardView => { - return new visuals.EV3BoardSvg({ - runtime: runtime, - theme: visuals.randomTheme(), - disableTilt: false, - wireframe: opts.wireframe, - }); - } - - let getQsVal = parseQueryString(); - - //project name - let name = getQsVal("name") || "Untitled"; - - // board def - const boardDef = JSON.parse(getQsVal("board")) as pxsim.BoardDefinition; - - //parts list - let parts = (getQsVal("parts") || "").split(" "); - parts.sort(); - - // parts definitions - let partDefinitions = JSON.parse(getQsVal("partdefs") || "{}") as pxsim.Map - - //fn args - let fnArgs = JSON.parse((getQsVal("fnArgs") || "{}")); - - //project code - let tsCode = getQsVal("code"); - let tsPackage = getQsVal("package") || ""; - let codeSpinnerDiv = document.getElementById("proj-code-spinner"); - let codeContainerDiv = document.getElementById("proj-code-container"); - if (tsCode) { - //we use the docs renderer to decompile the code to blocks and render it - //TODO: render the blocks code directly - let md = - `\`\`\`blocks -${tsCode} -\`\`\` -\`\`\`package -${tsPackage} -\`\`\` -` - - pxtdocs.requireMarked = function () { return (window).marked; } - pxtrunner.renderMarkdownAsync(codeContainerDiv, md) - .done(function () { - let codeSvg = $("#proj-code-container svg"); - if (codeSvg.length > 0) { - //code rendered successfully as blocks - codeSvg.css("width", "inherit"); - codeSvg.css("height", "inherit"); - //takes the svg out of the wrapper markdown - codeContainerDiv.innerHTML = ""; - codeContainerDiv.appendChild(codeSvg[0]); - } else { - //code failed to convert to blocks, display as typescript instead - codeContainerDiv.innerText = tsCode; - } - $(codeContainerDiv).show(); - $(codeSpinnerDiv).hide(); - }); - } - - - if (name) - $("#proj-title").text(name); - - //init runtime - if (!pxsim.initCurrentRuntime) - pxsim.initCurrentRuntime = initRuntimeWithDalBoard; - - renderParts({ - name, - boardDef, - parts, - partDefinitions, - fnArgs - }) - } -} \ No newline at end of file diff --git a/sim/public/siminstructions.html b/sim/public/siminstructions.html deleted file mode 100644 index e5fbdd60..00000000 --- a/sim/public/siminstructions.html +++ /dev/null @@ -1,201 +0,0 @@ - - - - - - Assembly Instructions - - - - - -
-
-
- - - - - - - - - - - - - - - - - - -
-

- - -
- -
-
-
-
- - \ No newline at end of file