aboutsummaryrefslogtreecommitdiff
path: root/static/js/abridge_nosearch_nopwa.min.js
diff options
context:
space:
mode:
authorJieiku2023-09-08 15:08:39 -0700
committerJieiku2023-09-08 15:08:39 -0700
commit5e55301cc2c91a5f0e99000bfe4d7ec262ee78c1 (patch)
treed034c24a0debdb22066c659fa67ab5564227acdd /static/js/abridge_nosearch_nopwa.min.js
parent288de9dac39869ac94d0265351f5884a78dce5a8 (diff)
downloadabridge-2.2.0.tar.gz
abridge-2.2.0.tar.bz2
abridge-2.2.0.zip
Refactor package.json2.2.0
Diffstat (limited to 'static/js/abridge_nosearch_nopwa.min.js')
-rw-r--r--static/js/abridge_nosearch_nopwa.min.js1
1 files changed, 1 insertions, 0 deletions
diff --git a/static/js/abridge_nosearch_nopwa.min.js b/static/js/abridge_nosearch_nopwa.min.js
new file mode 100644
index 0000000..7ae9810
--- /dev/null
+++ b/static/js/abridge_nosearch_nopwa.min.js
@@ -0,0 +1 @@
+const items=document.querySelectorAll(".preStyle"),changeIcon=(items.forEach(e=>{e.rel="stylesheet"}),document.getElementById("mode")&&document.getElementById("mode").addEventListener("click",()=>{document.documentElement.classList.toggle("switch"),localStorage.setItem("theme",document.documentElement.classList.contains("switch")?"switch":"default")}),!function(){for(var e=document.getElementsByClassName("m-protected"),t=0;t<e.length;t++){var c=e[t].getAttribute("href"),c=atob(c.substring(1));e[t].href="mailto:"+c}}(),(e,t)=>{e.classList.add(t),setTimeout(()=>e.classList.remove(t),2500)}),copyCodeAndChangeIcon=async(t,e)=>{e=(e.querySelector("table")?getTableCode:getNonTableCode)(e);try{await navigator.clipboard.writeText(e),changeIcon(t,"yes")}catch(e){changeIcon(t,"err")}},getNonTableCode=e=>[...e.querySelectorAll("code")].map(e=>e.textContent).join(""),getTableCode=e=>[...e.querySelectorAll("tr")].map(e=>e.querySelector("td:last-child")?.innerText??"").join("");document.querySelectorAll("pre").forEach(e=>{const t=document.createElement("div");t.className="cc svgs svgh copy",t.innerHTML=" ",e.prepend(t),t.addEventListener("click",()=>copyCodeAndChangeIcon(t,e))}); \ No newline at end of file