From 840d7654fb5c938c582732977fd843c6c6ab8f87 Mon Sep 17 00:00:00 2001
From: Doggoduck <34210285+kipkat@users.noreply.github.com>
Date: Thu, 6 Sep 2018 07:43:12 -0700
Subject: [PATCH 1/4] Create expander.js
---
dwitter/static/js/expander.js | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
create mode 100644 dwitter/static/js/expander.js
diff --git a/dwitter/static/js/expander.js b/dwitter/static/js/expander.js
new file mode 100644
index 00000000..a946c0a5
--- /dev/null
+++ b/dwitter/static/js/expander.js
@@ -0,0 +1,34 @@
+editor = document.getElementById("editor")
+function u_repl(str,old_,new_){return str.split(old_).join(new_)}
+function expand(c)
+{
+ var start = c.selectionStart,
+ end = c.selectionEnd;
+ c.value = u_repl(c.value,"hsl;","`hsl(${},99%,50%)`;")
+ c.value = u_repl(c.value,"hsla;","`hsla(${},99%,50%,.5)`;")
+ c.value = u_repl(c.value,"x.fs=","x.fillStyle=")
+ c.value = u_repl(c.value,"x.ss=","x.strokeStyle=")
+ c.value = u_repl(c.value,"x.fr","x.fillRect(")
+ c.value = u_repl(c.value,"x.bp;","x.beginPath();")
+ c.value = u_repl(c.value,"x.fl;","x.fill();")
+ c.value = u_repl(c.value,"x.sk;","x.stroke();")
+ c.value = u_repl(c.value,"x.sr","x.strokeRect(")
+ c.value = u_repl(c.value,"clear;","c.width^=0;")
+ c.value = u_repl(c.value,"middle;","x.translate(960,540);")
+ c.value = u_repl(c.value,"1time","t?0:event;")
+ c.value = u_repl(c.value,"x.gcop=","x.globalCompositeOperation=")
+ c.value = u_repl(c.value,"x.dri","x.drawImage(c,0,0)")
+ c.value = u_repl(c.value,"m.ab","Math.abs()")
+ c.value = u_repl(c.value,"m.rn","Math.random()")
+ c.value = u_repl(c.value,"..rb",Math.random()<.5?'1':'0')
+ c.value = u_repl(c.value,"..for","for(i=0;i++<10;)")
+ c.value = u_repl(c.value,"gr1","α")
+ c.value = u_repl(c.value,"gr2","β")
+ c.value = u_repl(c.value,"gr3","θ")
+ c.value = u_repl(c.value,"gr4","τ")
+ c.value = u_repl(c.value,"gr5","λ")
+ c.value = u_repl(c.value,";\n",";")
+ c.value = u_repl(c.value," ",",")
+ c.setSelectionRange(start, end);
+}
+setInterval(function(){expand(editor)},50)
From 01e30cad632bbb9634bc487b6bd4829a59e711fe Mon Sep 17 00:00:00 2001
From: Doggoduck <34210285+kipkat@users.noreply.github.com>
Date: Thu, 6 Sep 2018 07:48:41 -0700
Subject: [PATCH 2/4] Lint
---
dwitter/static/js/expander.js | 59 ++++++++++++++++++-----------------
1 file changed, 31 insertions(+), 28 deletions(-)
diff --git a/dwitter/static/js/expander.js b/dwitter/static/js/expander.js
index a946c0a5..ca38a09f 100644
--- a/dwitter/static/js/expander.js
+++ b/dwitter/static/js/expander.js
@@ -1,34 +1,37 @@
-editor = document.getElementById("editor")
-function u_repl(str,old_,new_){return str.split(old_).join(new_)}
+editor = document.getElementById("editor");
+function u_repl(str,old_,new_)
+{
+ return str.split(old_).join(new_);
+}
function expand(c)
{
var start = c.selectionStart,
end = c.selectionEnd;
- c.value = u_repl(c.value,"hsl;","`hsl(${},99%,50%)`;")
- c.value = u_repl(c.value,"hsla;","`hsla(${},99%,50%,.5)`;")
- c.value = u_repl(c.value,"x.fs=","x.fillStyle=")
- c.value = u_repl(c.value,"x.ss=","x.strokeStyle=")
- c.value = u_repl(c.value,"x.fr","x.fillRect(")
- c.value = u_repl(c.value,"x.bp;","x.beginPath();")
- c.value = u_repl(c.value,"x.fl;","x.fill();")
- c.value = u_repl(c.value,"x.sk;","x.stroke();")
- c.value = u_repl(c.value,"x.sr","x.strokeRect(")
- c.value = u_repl(c.value,"clear;","c.width^=0;")
- c.value = u_repl(c.value,"middle;","x.translate(960,540);")
- c.value = u_repl(c.value,"1time","t?0:event;")
- c.value = u_repl(c.value,"x.gcop=","x.globalCompositeOperation=")
- c.value = u_repl(c.value,"x.dri","x.drawImage(c,0,0)")
- c.value = u_repl(c.value,"m.ab","Math.abs()")
- c.value = u_repl(c.value,"m.rn","Math.random()")
- c.value = u_repl(c.value,"..rb",Math.random()<.5?'1':'0')
- c.value = u_repl(c.value,"..for","for(i=0;i++<10;)")
- c.value = u_repl(c.value,"gr1","α")
- c.value = u_repl(c.value,"gr2","β")
- c.value = u_repl(c.value,"gr3","θ")
- c.value = u_repl(c.value,"gr4","τ")
- c.value = u_repl(c.value,"gr5","λ")
- c.value = u_repl(c.value,";\n",";")
- c.value = u_repl(c.value," ",",")
+ c.value = u_repl(c.value,"hsl;","`hsl(${},99%,50%)`;");
+ c.value = u_repl(c.value,"hsla;","`hsla(${},99%,50%,.5)`;");
+ c.value = u_repl(c.value,"x.fs=","x.fillStyle=");
+ c.value = u_repl(c.value,"x.ss=","x.strokeStyle=");
+ c.value = u_repl(c.value,"x.fr","x.fillRect(");
+ c.value = u_repl(c.value,"x.bp;","x.beginPath();");
+ c.value = u_repl(c.value,"x.fl;","x.fill();");
+ c.value = u_repl(c.value,"x.sk;","x.stroke();");
+ c.value = u_repl(c.value,"x.sr","x.strokeRect(");
+ c.value = u_repl(c.value,"clear;","c.width^=0;");
+ c.value = u_repl(c.value,"middle;","x.translate(960,540);");
+ c.value = u_repl(c.value,"1time","t?0:event;");
+ c.value = u_repl(c.value,"x.gcop=","x.globalCompositeOperation=");
+ c.value = u_repl(c.value,"x.dri","x.drawImage(c,0,0)");
+ c.value = u_repl(c.value,"m.ab","Math.abs()");
+ c.value = u_repl(c.value,"m.rn","Math.random()");
+ c.value = u_repl(c.value,"..rb",Math.random()<0.5?'1':'0');
+ c.value = u_repl(c.value,"..for","for(i=0;i++<10;)");
+ c.value = u_repl(c.value,"gr1","α");
+ c.value = u_repl(c.value,"gr2","β");
+ c.value = u_repl(c.value,"gr3","θ");
+ c.value = u_repl(c.value,"gr4","τ");
+ c.value = u_repl(c.value,"gr5","λ");
+ c.value = u_repl(c.value,";\n",";");
+ c.value = u_repl(c.value," ",",");
c.setSelectionRange(start, end);
}
-setInterval(function(){expand(editor)},50)
+setInterval(function() { expand(editor); },50);
From 304c10435bf8e14cfc8cebc5485422dc058aeb0d Mon Sep 17 00:00:00 2001
From: Doggoduck <34210285+kipkat@users.noreply.github.com>
Date: Thu, 6 Sep 2018 07:50:10 -0700
Subject: [PATCH 3/4] Add expander.js script
---
dwitter/templates/feed.html | 1 +
1 file changed, 1 insertion(+)
diff --git a/dwitter/templates/feed.html b/dwitter/templates/feed.html
index 61d54306..935d4eca 100644
--- a/dwitter/templates/feed.html
+++ b/dwitter/templates/feed.html
@@ -65,6 +65,7 @@
+
{% endcompress %}
From f7fee5d3beef3a785a87589cd8303feb0da04caa Mon Sep 17 00:00:00 2001
From: Doggoduck <34210285+kipkat@users.noreply.github.com>
Date: Sat, 8 Sep 2018 03:22:16 -0700
Subject: [PATCH 4/4] Add custom expander key & improve templates
---
dwitter/static/js/expander.js | 63 +++++++++++++++++------------------
1 file changed, 30 insertions(+), 33 deletions(-)
diff --git a/dwitter/static/js/expander.js b/dwitter/static/js/expander.js
index ca38a09f..22558bd2 100644
--- a/dwitter/static/js/expander.js
+++ b/dwitter/static/js/expander.js
@@ -1,37 +1,34 @@
-editor = document.getElementById("editor");
-function u_repl(str,old_,new_)
-{
- return str.split(old_).join(new_);
-}
+if(localStorage.getItem("expandKey")==null) localStorage.setItem("expandKey"," ")
+expKey = localStorage.getItem("expandKey")
+editor = document.getElementById("editor")
+function u_repl(str,old_,new_){return str.split(old_).join(new_)}
function expand(c)
{
- var start = c.selectionStart,
- end = c.selectionEnd;
- c.value = u_repl(c.value,"hsl;","`hsl(${},99%,50%)`;");
- c.value = u_repl(c.value,"hsla;","`hsla(${},99%,50%,.5)`;");
- c.value = u_repl(c.value,"x.fs=","x.fillStyle=");
- c.value = u_repl(c.value,"x.ss=","x.strokeStyle=");
- c.value = u_repl(c.value,"x.fr","x.fillRect(");
- c.value = u_repl(c.value,"x.bp;","x.beginPath();");
- c.value = u_repl(c.value,"x.fl;","x.fill();");
- c.value = u_repl(c.value,"x.sk;","x.stroke();");
- c.value = u_repl(c.value,"x.sr","x.strokeRect(");
- c.value = u_repl(c.value,"clear;","c.width^=0;");
- c.value = u_repl(c.value,"middle;","x.translate(960,540);");
- c.value = u_repl(c.value,"1time","t?0:event;");
- c.value = u_repl(c.value,"x.gcop=","x.globalCompositeOperation=");
- c.value = u_repl(c.value,"x.dri","x.drawImage(c,0,0)");
- c.value = u_repl(c.value,"m.ab","Math.abs()");
- c.value = u_repl(c.value,"m.rn","Math.random()");
- c.value = u_repl(c.value,"..rb",Math.random()<0.5?'1':'0');
- c.value = u_repl(c.value,"..for","for(i=0;i++<10;)");
- c.value = u_repl(c.value,"gr1","α");
- c.value = u_repl(c.value,"gr2","β");
- c.value = u_repl(c.value,"gr3","θ");
- c.value = u_repl(c.value,"gr4","τ");
- c.value = u_repl(c.value,"gr5","λ");
- c.value = u_repl(c.value,";\n",";");
- c.value = u_repl(c.value," ",",");
+ var start = c.selectionStart, end = c.selectionEnd;
+ c.value = u_repl(c.value,"hsl;"+expKey,"`hsl(${},99%,50%)`;")
+ c.value = u_repl(c.value,"hsla;"+expKey,"`hsla(${},99%,50%,.5)`;")
+ c.value = u_repl(c.value,"x.fs="+expKey,"x.fillStyle=;")
+ c.value = u_repl(c.value,"x.ss="+expKey,"x.strokeStyle=;")
+ c.value = u_repl(c.value,"x.fr"+expKey,"x.fillRect(x,y,w,h);")
+ c.value = u_repl(c.value,"x.bp;"+expKey,"x.beginPath();")
+ c.value = u_repl(c.value,"x.fl;"+expKey,"x.fill();")
+ c.value = u_repl(c.value,"x.sk;"+expKey,"x.stroke();")
+ c.value = u_repl(c.value,"x.sr"+expKey,"x.strokeRect(x,y,w,h);")
+ c.value = u_repl(c.value,"clear;"+expKey,"c.width^=0;")
+ c.value = u_repl(c.value,"middle;"+expKey,"x.translate(960,540);")
+ c.value = u_repl(c.value,"1time"+expKey,"t?0:event;")
+ c.value = u_repl(c.value,"x.gcop="+expKey,"x.globalCompositeOperation=;")
+ c.value = u_repl(c.value,"x.dri"+expKey,"x.drawImage(c,0,0);")
+ c.value = u_repl(c.value,"m.ab"+expKey,"Math.abs(n);")
+ c.value = u_repl(c.value,"m.rn"+expKey,"Math.random(n);")
+ c.value = u_repl(c.value,"..rb"+expKey,Math.random()<.5?'1':'0')
+ c.value = u_repl(c.value,"..for"+expKey,"for(i=0;i++<10;)")
+ c.value = u_repl(c.value,"gr1"+expKey,"α")
+ c.value = u_repl(c.value,"gr2"+expKey,"β")
+ c.value = u_repl(c.value,"gr3"+expKey,"θ")
+ c.value = u_repl(c.value,"gr4"+expKey,"τ")
+ c.value = u_repl(c.value,"gr5"+expKey,"λ")
+ c.value = u_repl(c.value,";\n",";")
c.setSelectionRange(start, end);
}
-setInterval(function() { expand(editor); },50);
+setInterval(function(){expand(editor)},50)