From c57494ae405ffbdd8ec45f74ef04ea85895f1bf7 Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Fri, 15 Mar 2019 18:45:47 +0100 Subject: Port application to flask --- static/edit.js | 83 -------------------------------------------------------- static/paste.css | 23 ---------------- static/view.js | 5 ---- 3 files changed, 111 deletions(-) delete mode 100644 static/edit.js delete mode 100644 static/paste.css delete mode 100644 static/view.js (limited to 'static') diff --git a/static/edit.js b/static/edit.js deleted file mode 100644 index 8e754d8..0000000 --- a/static/edit.js +++ /dev/null @@ -1,83 +0,0 @@ -function tab_add(t, ti, ss, se) { - t.value = t.value.substr(0, ti) + "\t" + t.value.substr(ti); - t.selectionStart = ss + 1; - t.selectionEnd = se + 1; -} - -function tab_remove(t, ti, ss, se) { - t.value = t.value.substr(0, ti-1) + t.value.substr(ti); - t.selectionStart = ss - 1; - t.selectionEnd = se - 1; -} - -function textarea_handle_tab(t, e) { - if(navigator.userAgent.match("Gecko")) { - keyCode = e.which; - } else { - keyCode = e.keyCode; - } - if(keyCode != 9) - return; - e.preventDefault(); - var ss = t.selectionStart; - var se = t.selectionEnd; - if(ss == se) { - if(e.shiftKey) { - if(t.value[ss-1] == "\t") { - tab_remove(t, ss, ss, se); - } - } else { - tab_add(t, ss, ss, se); - } - } else { - var s; - if(ss < se) - s = t.value.substr(ss, se - ss); - else - s = t.value.substr(se, ss - se); - if(s.indexOf("\n") > -1) { - var nl = s.lastIndexOf("\n"); - if(e.shiftKey) { - while(nl > -1) { - if(s[nl+1] == "\t") { - tab_remove(t, ss + nl + 2, ss, se); - se--; - } - nl = s.lastIndexOf("\n", nl - 2); - } - if(t.value[(ss < se ? ss : se)-1] == "\n" && e.shiftKey) - tab_remove(t, ss+1, ss, se); - if((ss == 0 || se == 0) && t.value[0] == "\t") - tab_remove(t, 1, ss, se); - } else { - while(nl > -1) { - tab_add(t, ss + nl + 1, ss, se); - se++; - if(nl == 0) - break; - nl = s.lastIndexOf("\n", nl - 2); - } - if(ss == 0 || se == 0 || t.value[(ss < se ? ss : se)-1] == "\n") - tab_add(t, ss, ss-1, se); - } - - } else { - var nl = t.value.lastIndexOf("\n", (ss < se ? se : ss) - 1) + 1; - if(e.shiftKey) { - if(t.value[nl] == "\t") { - tab_remove(t, nl + 1, ss, se); - } - } else { - tab_add(t, nl, ss, se); - } - } - } - setTimeout("document.getElementById('" + t.id + "').focus();", 0); -} - -window.onload = function() { - text = document.getElementById("text"); - text.onkeydown = function(event) { - return textarea_handle_tab(text, event); - } -} diff --git a/static/paste.css b/static/paste.css deleted file mode 100644 index 5e59d4d..0000000 --- a/static/paste.css +++ /dev/null @@ -1,23 +0,0 @@ -html, body { margin: 0; padding: 0; font-family: sans-serif; background-color: #fff; color: #000; } -div#page { background: #eee; margin: 1em; } -div#page-header, div#page-content { padding: 1em; } -div#page-header h1 a { color: inherit; } -div#page-header h1 a:hover { text-decoration: none; } -a { color: #00f; text-decoration: none; } -a:hover { text-decoration: underline; } -form#pasteform ul { list-style-type: none; } -textarea { font-family: monospace; } -div#info { font-size: small; color: #bbb; } -span#nick, span#date, span#syntax-type { color: #888; } -div#alt-links { font-size: small; } -div#alt-links a { color: #44f; } -div.paste-rendered { padding: 1em; } -div#paste div.paste-rendered { background-color: #fff; margin-top: 1em; } -.highlighttable { width: 100%; padding-top: 1em; } -.highlighttable td.code { width: 100%; background-color: #fff; } -.highlighttable td { vertical-align: top; } -.highlighttable pre { margin: 0; padding: 0; } -.highlighttable .linenos { text-align: right; padding-left: .5em; padding-right: .5em; } -.highlighttable .linenos a { color: #888; } -.highlighttable .selected { display: block; background-color: #cfc; } -.highlighttable .code { tab-size: 4; } diff --git a/static/view.js b/static/view.js deleted file mode 100644 index c855609..0000000 --- a/static/view.js +++ /dev/null @@ -1,5 +0,0 @@ -window.onload = function() { - var line = 'code' + document.location.hash.substr(1); - var codeline = document.getElementById(line); - codeline.className = 'selected'; -} -- cgit v1.2.3