Commit 1512a7b0 authored by Thiemo's avatar Thiemo

bug fix frames

template loading in index.js
parent 93db966f
......@@ -2883,9 +2883,9 @@
}
},
"bluebird": {
"version": "3.7.1",
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.1.tgz",
"integrity": "sha512-DdmyoGCleJnkbp3nkbxTLJ18rjDsE4yCggEwKNXkeV123sPNfOCYeDoeuOY+F2FrSjO1YXcTU+dsy96KMy+gcg==",
"version": "3.7.2",
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz",
"integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==",
"dev": true
},
"bn.js": {
......@@ -11135,9 +11135,9 @@
}
},
"serialize-javascript": {
"version": "1.9.1",
"resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-1.9.1.tgz",
"integrity": "sha512-0Vb/54WJ6k5v8sSWN09S0ora+Hnr+cX40r9F170nT+mSkaxltoE/7R3OrIdBSUv1OoiobH1QoWQbCnAO+e8J1A==",
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-2.1.2.tgz",
"integrity": "sha512-rs9OggEUF0V4jUSecXazOYsLfu7OGK2qIn3c7IPBiffz32XniEp/TX9Xmc9LQfK2nQ2QKHvZ2oygKUGU0lG4jQ==",
"dev": true
},
"serve-index": {
......@@ -11756,9 +11756,9 @@
}
},
"stream-shift": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.0.tgz",
"integrity": "sha1-1cdSgl5TZ+eG944Y5EXqIjoVWVI=",
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.1.tgz",
"integrity": "sha512-AiisoFqQ0vbGcZgQPY1cdP2I76glaVA/RauYR4G4thNFgkTqr90yXTo4LYX60Jl+sIlPNHHdGSwo01AvbKUSVQ==",
"dev": true
},
"strict-uri-encode": {
......@@ -11992,9 +11992,9 @@
}
},
"terser": {
"version": "4.3.8",
"resolved": "https://registry.npmjs.org/terser/-/terser-4.3.8.tgz",
"integrity": "sha512-otmIRlRVmLChAWsnSFNO0Bfk6YySuBp6G9qrHiJwlLDd4mxe2ta4sjI7TzIR+W1nBMjilzrMcPOz9pSusgx3hQ==",
"version": "4.4.3",
"resolved": "https://registry.npmjs.org/terser/-/terser-4.4.3.tgz",
"integrity": "sha512-0ikKraVtRDKGzHrzkCv5rUNDzqlhmhowOBqC0XqUHFpW+vJ45+20/IFBcebwKfiS2Z9fJin6Eo+F1zLZsxi8RA==",
"dev": true,
"requires": {
"commander": "^2.20.0",
......@@ -12011,16 +12011,16 @@
}
},
"terser-webpack-plugin": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-1.4.1.tgz",
"integrity": "sha512-ZXmmfiwtCLfz8WKZyYUuuHf3dMYEjg8NrjHMb0JqHVHVOSkzp3cW2/XG1fP3tRhqEqSzMwzzRQGtAPbs4Cncxg==",
"version": "1.4.3",
"resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-1.4.3.tgz",
"integrity": "sha512-QMxecFz/gHQwteWwSo5nTc6UaICqN1bMedC5sMtUc7y3Ha3Q8y6ZO0iCR8pq4RJC8Hjf0FEPEHZqcMB/+DFCrA==",
"dev": true,
"requires": {
"cacache": "^12.0.2",
"find-cache-dir": "^2.1.0",
"is-wsl": "^1.1.0",
"schema-utils": "^1.0.0",
"serialize-javascript": "^1.7.0",
"serialize-javascript": "^2.1.2",
"source-map": "^0.6.1",
"terser": "^4.1.2",
"webpack-sources": "^1.4.0",
......
......@@ -14,7 +14,10 @@
},
"keywords": [],
"author": "Didaktik der Informatik TU Dresden",
"contributors": ["Klaus Ramm", "Thiemo Leonhardt"],
"contributors": [
"Klaus Ramm",
"Thiemo Leonhardt"
],
"license": "MIT",
"devDependencies": {
"@webpack-cli/serve": "^0",
......
......@@ -41,7 +41,7 @@
}
.codeIcon {
background: url("../svg/caseIcon.svg");
background: url("../svg/codeIcon.svg");
background-repeat: no-repeat;
background-position: center;
}
......@@ -76,6 +76,12 @@
background-position: center;
}
.frameLeft {
background: url("../svg/frameLeft.svg");
background-repeat: no-repeat;
background-position: center;
}
.frameLeftBottom {
background: url("../svg/frameLeftBottom.svg");
background-repeat: no-repeat;
......
......@@ -38,11 +38,6 @@ export function generateHtmltree () {
let section2 = document.createElement('section')
section2.setAttribute('class', 'nav-col')
let button = document.createElement('button')
button.setAttribute('class', 'column')
button.setAttribute('onclick', "document.getElementById('IEModal').style.display = 'block';")
button.innerHTML = 'Import / Export'
let divinner = document.createElement('div')
divinner.setAttribute('class', 'column container')
......@@ -50,7 +45,6 @@ export function generateHtmltree () {
divouter.setAttribute('class', 'options-container')
divouter.setAttribute('id', 'optionButtons')
divinner.appendChild(button)
divouter.appendChild(divinner)
section2.appendChild(divouter)
......
......@@ -4,11 +4,29 @@ import { Structogram } from './views/structogram'
import { CodeView } from './views/code'
import { ImportExport } from './views/importExport'
import { generateHtmltree } from './helpers/generator'
import { templates } from './templates.js';
import { templates } from './templates.js'
import './assets/scss/structog.scss'
window.onload = function () {
// manipulate the localStorage before loading the presenter
if (typeof (Storage) !== 'undefined') {
const url = new URL(window.location.href)
const template = url.searchParams.get('template')
if (template in templates) {
if ('model' in templates[template]) {
localStorage.tree = JSON.stringify(templates[template].model)
model.setTree(templates[template].model)
}
if ('lang' in templates[template]) {
localStorage.lang = templates[template].lang
}
if ('displaySourcecode' in templates[template]) {
localStorage.displaySourcecode = templates[template].displaySourcecode
}
}
}
generateHtmltree()
// create presenter object
const presenter = new Presenter(model)
......
export const templates = {
t1: {
model: {"id":"25680378-9147-9f4d-a12d-9d10f29f","type":"InsertNode","followElement":{"id":"781cb79f-2a10-7c81-aeba-740544e5","type":"TaskNode","text":"i = 5","followElement":{"id":"f8dc68f6-926f-061d-9d55-8d49706c","type":"InsertNode","followElement":{"id":"bbe1cba1-7448-b1ad-4348-0a254183","type":"HeadLoopNode","text":"i > 0","followElement":{"id":"26a02684-af45-7a72-ab0e-ca5bbfc5","type":"InsertNode","followElement":null},"child":{"id":"f8b9343c-6e88-aa1b-b249-a12067e4","type":"InsertNode","followElement":{"id":"f69965f8-fe5e-1eba-7345-351938e7","type":"TaskNode","text":"i = i - 1","followElement":{"id":"a6908468-365d-c1be-8705-96639514","type":"InsertNode","followElement":null}}}}}}},
displaySourcecode: "false",
lang: "Python"
},
t2: {
model: {"id":"e4c4b35a-1e09-e1cb-d55c-99ffbcbe","type":"InsertNode","followElement":{"id":"cb365db9-6e23-f0d1-153b-674b15a8","type":"InputNode","text":"i","followElement":{"id":"b738c9fa-d096-985f-f5a0-fa764d72","type":"InsertNode","followElement":{"id":"c3e59cd0-3573-8bcb-d50e-e6ddc749","type":"TaskNode","text":"i = i * 20","followElement":{"id":"a8d5103e-478e-4e20-1ea4-a492b2f2","type":"InsertNode","followElement":{"id":"fc1f6373-7334-703b-bcca-02283559","type":"BranchNode","text":"i > 50","followElement":{"id":"30fd4cda-ff39-d0eb-fe50-806ef7d5","type":"InsertNode","followElement":{"id":"f5621fa3-d34e-7776-55b9-2c2c7c9f","type":"CaseNode","text":"i","followElement":{"id":"a461498f-7491-f5b1-8a50-e2662da1","type":"InsertNode","followElement":{"id":"f1843ceb-b17a-a1a1-4f6c-3102515d","type":"OutputNode","text":"i","followElement":{"id":"d218754e-994d-0994-f4a8-972775e4","type":"InsertNode","followElement":null}}},"defaultOn":true,"defaultNode":{"id":"75694b3d-1efa-e8e5-1082-c262f79a","type":"InsertCase","text":"Sonst","followElement":{"id":"363638ce-6a4e-2124-fba0-1a794a20","type":"InsertNode","followElement":{"id":"eb1276f2-02d8-7af2-17eb-6f96681b","type":"TaskNode","text":"i = i % 20","followElement":{"id":"1eaf9510-f707-48d1-8cda-823406b1","type":"InsertNode","followElement":{"id":"a1d3dd7e-69c0-1445-655a-be690313","type":"TaskNode","text":"i = i - 1","followElement":{"id":"58b3c551-c074-200b-438f-d17dad58","type":"InsertNode","followElement":null}}}}}},"cases":[{"id":"a13c7fc4-a5ae-3fe2-3592-e5766f5f","type":"InsertCase","text":"40","followElement":{"id":"3dd9d516-6a17-7ea9-669c-89fd433e","type":"InsertNode","followElement":{"id":"3d32530b-2e3a-684d-4382-4fadfa69","type":"TaskNode","text":"i = i + 2","followElement":{"id":"983e9727-766e-da53-42f8-8b1faad8","type":"InsertNode","followElement":null}}}},{"id":"ed7e9ba7-9dd6-81dc-6c38-8b8046cb","type":"InsertCase","text":"42","followElement":{"id":"4deac4f6-7e14-e134-e9be-83019d22","type":"InsertNode","followElement":{"id":"050cab51-29c2-925f-69d7-8d58c35c","type":"OutputNode","text":"\"oh yeah\"","followElement":{"id":"14f1f3d0-8b91-a2cb-7234-90999482","type":"InsertNode","followElement":null}}}}]}},"trueChild":{"id":"92ca07c1-b2cf-5ef4-9496-9c3aa0b4","type":"InsertNode","followElement":{"id":"20269702-9266-7c0e-10e8-6a4c74ed","type":"HeadLoopNode","text":"i > 50","followElement":{"id":"ea93294b-a0a9-73a4-543d-28203269","type":"InsertNode","followElement":null},"child":{"id":"8f9760b5-d95e-3916-73d4-6ac2b792","type":"InsertNode","followElement":{"id":"beda831e-2090-f556-54ca-8f65d263","type":"TaskNode","text":"i = i - 2","followElement":{"id":"cf6a901e-d632-afc6-801e-2e31617b","type":"InsertNode","followElement":null}}}}},"falseChild":{"id":"581b4fdd-150e-3a53-a57c-63083fd3","type":"InsertNode","followElement":{"type":"Placeholder"}}}}}}}},
displaySourcecode: "true",
lang: "PHP"
}
t1: {
model: { 'id': '25680378-9147-9f4d-a12d-9d10f29f', 'type': 'InsertNode', 'followElement': { 'id': '781cb79f-2a10-7c81-aeba-740544e5', 'type': 'TaskNode', 'text': 'i = 5', 'followElement': { 'id': 'f8dc68f6-926f-061d-9d55-8d49706c', 'type': 'InsertNode', 'followElement': { 'id': 'bbe1cba1-7448-b1ad-4348-0a254183', 'type': 'HeadLoopNode', 'text': 'i > 0', 'followElement': { 'id': '26a02684-af45-7a72-ab0e-ca5bbfc5', 'type': 'InsertNode', 'followElement': null }, 'child': { 'id': 'f8b9343c-6e88-aa1b-b249-a12067e4', 'type': 'InsertNode', 'followElement': { 'id': 'f69965f8-fe5e-1eba-7345-351938e7', 'type': 'TaskNode', 'text': 'i = i - 1', 'followElement': { 'id': 'a6908468-365d-c1be-8705-96639514', 'type': 'InsertNode', 'followElement': null } } } } } } },
displaySourcecode: 'false',
lang: 'Python'
},
t2: {
model: { 'id': 'e4c4b35a-1e09-e1cb-d55c-99ffbcbe', 'type': 'InsertNode', 'followElement': { 'id': 'cb365db9-6e23-f0d1-153b-674b15a8', 'type': 'InputNode', 'text': 'i', 'followElement': { 'id': 'b738c9fa-d096-985f-f5a0-fa764d72', 'type': 'InsertNode', 'followElement': { 'id': 'c3e59cd0-3573-8bcb-d50e-e6ddc749', 'type': 'TaskNode', 'text': 'i = i * 20', 'followElement': { 'id': 'a8d5103e-478e-4e20-1ea4-a492b2f2', 'type': 'InsertNode', 'followElement': { 'id': 'fc1f6373-7334-703b-bcca-02283559', 'type': 'BranchNode', 'text': 'i > 50', 'followElement': { 'id': '30fd4cda-ff39-d0eb-fe50-806ef7d5', 'type': 'InsertNode', 'followElement': { 'id': 'f5621fa3-d34e-7776-55b9-2c2c7c9f', 'type': 'CaseNode', 'text': 'i', 'followElement': { 'id': 'a461498f-7491-f5b1-8a50-e2662da1', 'type': 'InsertNode', 'followElement': { 'id': 'f1843ceb-b17a-a1a1-4f6c-3102515d', 'type': 'OutputNode', 'text': 'i', 'followElement': { 'id': 'd218754e-994d-0994-f4a8-972775e4', 'type': 'InsertNode', 'followElement': null } } }, 'defaultOn': true, 'defaultNode': { 'id': '75694b3d-1efa-e8e5-1082-c262f79a', 'type': 'InsertCase', 'text': 'Sonst', 'followElement': { 'id': '363638ce-6a4e-2124-fba0-1a794a20', 'type': 'InsertNode', 'followElement': { 'id': 'eb1276f2-02d8-7af2-17eb-6f96681b', 'type': 'TaskNode', 'text': 'i = i % 20', 'followElement': { 'id': '1eaf9510-f707-48d1-8cda-823406b1', 'type': 'InsertNode', 'followElement': { 'id': 'a1d3dd7e-69c0-1445-655a-be690313', 'type': 'TaskNode', 'text': 'i = i - 1', 'followElement': { 'id': '58b3c551-c074-200b-438f-d17dad58', 'type': 'InsertNode', 'followElement': null } } } } } }, 'cases': [{ 'id': 'a13c7fc4-a5ae-3fe2-3592-e5766f5f', 'type': 'InsertCase', 'text': '40', 'followElement': { 'id': '3dd9d516-6a17-7ea9-669c-89fd433e', 'type': 'InsertNode', 'followElement': { 'id': '3d32530b-2e3a-684d-4382-4fadfa69', 'type': 'TaskNode', 'text': 'i = i + 2', 'followElement': { 'id': '983e9727-766e-da53-42f8-8b1faad8', 'type': 'InsertNode', 'followElement': null } } } }, { 'id': 'ed7e9ba7-9dd6-81dc-6c38-8b8046cb', 'type': 'InsertCase', 'text': '42', 'followElement': { 'id': '4deac4f6-7e14-e134-e9be-83019d22', 'type': 'InsertNode', 'followElement': { 'id': '050cab51-29c2-925f-69d7-8d58c35c', 'type': 'OutputNode', 'text': '"oh yeah"', 'followElement': { 'id': '14f1f3d0-8b91-a2cb-7234-90999482', 'type': 'InsertNode', 'followElement': null } } } }] } }, 'trueChild': { 'id': '92ca07c1-b2cf-5ef4-9496-9c3aa0b4', 'type': 'InsertNode', 'followElement': { 'id': '20269702-9266-7c0e-10e8-6a4c74ed', 'type': 'HeadLoopNode', 'text': 'i > 50', 'followElement': { 'id': 'ea93294b-a0a9-73a4-543d-28203269', 'type': 'InsertNode', 'followElement': null }, 'child': { 'id': '8f9760b5-d95e-3916-73d4-6ac2b792', 'type': 'InsertNode', 'followElement': { 'id': 'beda831e-2090-f556-54ca-8f65d263', 'type': 'TaskNode', 'text': 'i = i - 2', 'followElement': { 'id': 'cf6a901e-d632-afc6-801e-2e31617b', 'type': 'InsertNode', 'followElement': null } } } } }, 'falseChild': { 'id': '581b4fdd-150e-3a53-a57c-63083fd3', 'type': 'InsertNode', 'followElement': { 'type': 'Placeholder' } } } } } } } },
displaySourcecode: 'true',
lang: 'PHP'
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment