From 2d5aab37ccbb6a7ee05a1e7093d4aedbd73d675f Mon Sep 17 00:00:00 2001 From: James Feng Cao Date: Mon, 6 Sep 2021 13:54:12 +0800 Subject: [PATCH] rebuilding site Mon Sep 6 01:54:11 PM CST 2021 --- searchurl/ace.js | 35 +++++++++++++++++++++++++++++++++++ searchurl/ace.js~ | 24 ++++++++++++++++++++++++ searchurl/ace_t.html | 15 +++++++++++++++ searchurl/ace_t.html~ | 15 +++++++++++++++ searchurl/textarea.js | 28 ++++++---------------------- searchurl/textarea_t.html | 3 ++- 6 files changed, 97 insertions(+), 23 deletions(-) create mode 100644 searchurl/ace.js create mode 100644 searchurl/ace.js~ create mode 100644 searchurl/ace_t.html create mode 100644 searchurl/ace_t.html~ diff --git a/searchurl/ace.js b/searchurl/ace.js new file mode 100644 index 0000000..b2ac9ec --- /dev/null +++ b/searchurl/ace.js @@ -0,0 +1,35 @@ +var editor; +onload=function(){ + var e = document.getElementById("editor"); + var ext = location.href.split('.').pop(); + outer:{ + switch(ext){ + case "html": + { + var text = e.innerHTML; + editor = ace.edit(e); + editor.session.setValue(text); + } + break outer; + case "js": + ext = "javascript"; + } + editor = ace.edit(e); + } + editor.session.setMode("ace/mode/"+ext); + editor.setTheme("ace/theme/clouds"); + editor.setShowPrintMargin(false); + editor.setOptions({ + enableBasicAutocompletion: true, + enableSnippets: true, + enableLiveAutocompletion: true + }); +} + +function onSave(fn){ + let u8=new TextEncoder().encode(editor.session.getValue());let r='';for(let i=0;i + #editor { + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + } + + + + +
+

title

+
hi
diff --git a/searchurl/ace_t.html~ b/searchurl/ace_t.html~ new file mode 100644 index 0000000..db1a054 --- /dev/null +++ b/searchurl/ace_t.html~ @@ -0,0 +1,15 @@ + + + + +
+

title

+
hi
diff --git a/searchurl/textarea.js b/searchurl/textarea.js index bb8e011..5f7bd90 100644 --- a/searchurl/textarea.js +++ b/searchurl/textarea.js @@ -1,4 +1,8 @@ var textarea; +onload=function(){ + textarea=document.getElementsByTagName('textarea')[0]; +} + function getNewlinePos_back(text,pos){ while(pos>=0 && text.charAt(pos)!='\n') pos--; return pos; @@ -74,26 +78,6 @@ function moveDown(ta){ } -function onSave(){ - if(!textarea)textarea=document.getElementsByTagName('textarea')[0];let u8=new TextEncoder().encode(textarea.value);let r='';for(let i=0;idiv{position:fixed;}button{height:30px} +
+