diff options
author | Marvin Borner | 2020-07-09 22:33:43 +0200 |
---|---|---|
committer | Marvin Borner | 2020-07-09 22:33:43 +0200 |
commit | 1edfdf5f3a316a36108a0a853b0a2553d116d6fc (patch) | |
tree | 4b825dc642cb6eb9a060e54bf8d69288fbee4904 /src/main/resources/js/fileview.js | |
parent | 18edde9bd3603f3f867cebce100e7b22be9012cd (diff) |
Rewriiiiiiiiiite!
Okay, okay. I know, rewriting projects all the time is dumb.
Buuut, we really don't want to work with our old and ugly code anymore.
Furthermore we'll be using Deno now!
Diffstat (limited to 'src/main/resources/js/fileview.js')
-rw-r--r-- | src/main/resources/js/fileview.js | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/src/main/resources/js/fileview.js b/src/main/resources/js/fileview.js deleted file mode 100644 index 12d7ba4..0000000 --- a/src/main/resources/js/fileview.js +++ /dev/null @@ -1,67 +0,0 @@ -const preview = document.getElementById("preview"); -const modify = document.getElementById("modify"); -const content = document.getElementById("content"); -const html = document.getElementsByTagName("html")[0]; -const body = document.body; - -// buttons -const raw = document.getElementById("raw"); -const code = document.getElementById("code"); -const settings = document.getElementById("settings"); - -const originalContent = content.innerText; - -if (extension === "html") { - preview.src = "data:text/html;charset=utf-8," + encodeURI(originalContent); - - raw.style.display = "block"; - content.style.display = "block"; - - raw.addEventListener("click", () => { - if (preview.style.display === "block") { - html.style.overflow = "visible"; - body.style.overflow = "visible"; - raw.innerText = "Show preview"; - preview.style.display = "none"; - content.style.display = "block"; - settings.style.display = "block"; - } else { - html.style.overflow = "hidden"; - body.style.overflow = "hidden"; - raw.innerText = "Show raw"; - preview.style.display = "block"; - content.style.display = "none"; - settings.style.display = "none"; - } - }); -} else if (extension === "md") { - const simplemde = new SimpleMDE({ - element: modify, - hideIcons: ["fullscreen", "preview", "guide"], - autoDownloadFontAwesome: false - }); - simplemde.value(originalContent); - content.style.display = "none"; - html.style.overflow = "visible"; - body.style.overflow = "visible"; -} else { - settings.style.display = "block"; - html.style.overflow = "visible"; - body.style.overflow = "visible"; -} - -code.addEventListener("change", () => { - if (code.checked) { - content.classList.remove("prettyprinted"); - content.innerHTML = ""; - content.classList.add("linenums"); - content.innerText = originalContent; - PR.prettyPrint(); - } else { - content.classList.remove("prettyprinted"); - content.innerHTML = ""; - content.classList.remove("linenums"); - content.innerText = originalContent; - PR.prettyPrint(); - } -}); |