From ad4abcf43cb6241ee033a5023cb5ef7db5f3e5de Mon Sep 17 00:00:00 2001 From: Jacob Strieb Date: Sun, 30 Jun 2019 01:09:18 -0700 Subject: [PATCH] Separate into index, script, and style file --- editor/editor.js | 67 ++++++++++++++++++++++++++ editor/index.html | 120 ++-------------------------------------------- editor/main.css | 43 +++++++++++++++++ 3 files changed, 114 insertions(+), 116 deletions(-) create mode 100644 editor/editor.js create mode 100644 editor/main.css diff --git a/editor/editor.js b/editor/editor.js new file mode 100644 index 0000000..74f4f02 --- /dev/null +++ b/editor/editor.js @@ -0,0 +1,67 @@ +/* Run once when the page is loaded */ +function initialize() { + // Get page data from the URL and load it into the boxes + if (window.location.hash) { + var b64 = window.location.hash.slice(1); + var json = window.atob(b64); + var data = JSON.parse(json); + + document.getElementById("css").value = data["css"]; + document.getElementById("javascript").value = data["js"]; + document.getElementById("html").value = data["html"]; + } + + update(); +} + + +/* Return the HTML string for the page */ +function getHTML(data) { + // Generate an HTML page from the contents of each diff --git a/editor/main.css b/editor/main.css new file mode 100644 index 0000000..459ad1d --- /dev/null +++ b/editor/main.css @@ -0,0 +1,43 @@ +* { + margin: 0px; + box-sizing: border-box; + vertical-align: top; +} + +html, body { + height: 100%; +} + +#textboxes { + height: 40%; + width: 100%; +} + +textarea { + resize: none; + width: 33.3333%; + height: 100%; +} + +iframe { + width: 100%; + height: 60%; +} + +textarea, iframe { + border: 0.5px solid; +} + +a, button { + background: black; + color: limegreen; + text-decoration: none; + padding: 2px 5px; + border: none; +} + +#buttons { + position: absolute; + bottom: 0; + right: 0; +}