diff options
| -rw-r--r-- | package.json | 2 | ||||
| -rw-r--r-- | static/abridge-bundle-nosearch.min.js | 1 | ||||
| -rw-r--r-- | static/abridge-bundle-noswitchernosearch.min.js | 1 | ||||
| -rw-r--r-- | templates/macros/head.html | 8 |
4 files changed, 12 insertions, 0 deletions
diff --git a/package.json b/package.json index 9133b4a..7aef962 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,8 @@ "scripts": { "searchonly": "uglifyjs static/elasticlunr.min.js static/search.js -c -m -o static/abridge-searchonly.min.js", "noswitcher": "uglifyjs static/prestyle.js static/email.js static/codecopy.js static/elasticlunr.min.js static/search.js -c -m -o static/abridge-bundle-noswitcher.min.js", + "nosearch": "uglifyjs static/prestyle.js static/theme_button.js static/email.js static/codecopy.js -c -m -o static/abridge-bundle-nosearch.min.js", + "noswitchernosearch": "uglifyjs static/prestyle.js static/email.js static/codecopy.js -c -m -o static/abridge-bundle-noswitchernosearch.min.js", "nofacade": "uglifyjs static/prestyle.js static/theme_button.js static/email.js static/codecopy.js static/elasticlunr.min.js static/search.js -c -m -o static/abridge-bundle-nofacade.min.js", "theme": "uglifyjs static/theme.js -c -m -o static/theme.min.js", "katex-bundle": "uglifyjs static/katex.min.js static/mathtex-script-type.min.js static/auto-render.min.js static/katexoptions.js -c -m -o static/katexbundle.min.js", diff --git a/static/abridge-bundle-nosearch.min.js b/static/abridge-bundle-nosearch.min.js new file mode 100644 index 0000000..4b8865c --- /dev/null +++ b/static/abridge-bundle-nosearch.min.js @@ -0,0 +1 @@ +const items=document.querySelectorAll(".preStyle");items.forEach(e=>{e.rel="stylesheet"}),document.getElementById("mode").addEventListener("click",()=>{document.documentElement.classList.toggle("light"),localStorage.setItem("theme",document.documentElement.classList.contains("light")?"light":"dark")}),function(){for(var e=document.getElementsByClassName("m-protected"),t=0;t<e.length;t++){var n=e[t].getAttribute("href"),n=atob(n.substring(1));e[t].href="mailto:"+n}}(),function(){function t(e){const t=document.createElement("button");t.className="cc ",t.type="button",t.innerHTML="Copy",t.addEventListener("click",()=>async function(e,t){var n=t.querySelectorAll("table")["length"];let a="";0<n?t.querySelectorAll(":last-child > tr > td:last-child").forEach(e=>{a+=e.innerText}):a=t.querySelector(":last-child > code").innerText;try{"granted"==(result=await navigator.permissions.query({name:"clipboard-write"})).state||"prompt"==result.state?await navigator.clipboard.writeText(a):l(a,t)}catch(e){l(a,t)}finally{e.innerHTML="Copied",setTimeout(function(){e.innerHTML="Copy"},2e3)}}(t,e));var n=document.createElement("div");n.className="ccw",n.appendChild(t),e.parentNode.insertBefore(n,e),n.appendChild(e)}function l(e,t){var n=document.createElement("textArea"),e=(n.contentEditable="true",n.readOnly="false",n.className="copyable-text-area",n.value=e,t.insertBefore(n,t.firstChild),document.createRange()),a=(e.selectNodeContents(n),window.getSelection());a.removeAllRanges(),a.addRange(e),n.setSelectionRange(0,999999),document.execCommand("copy"),t.removeChild(n)}document.querySelectorAll("pre").forEach(e=>t(e))}();
\ No newline at end of file diff --git a/static/abridge-bundle-noswitchernosearch.min.js b/static/abridge-bundle-noswitchernosearch.min.js new file mode 100644 index 0000000..57d4004 --- /dev/null +++ b/static/abridge-bundle-noswitchernosearch.min.js @@ -0,0 +1 @@ +const items=document.querySelectorAll(".preStyle");items.forEach(e=>{e.rel="stylesheet"}),function(){for(var e=document.getElementsByClassName("m-protected"),t=0;t<e.length;t++){var n=e[t].getAttribute("href"),n=atob(n.substring(1));e[t].href="mailto:"+n}}(),function(){function t(e){const t=document.createElement("button");t.className="cc ",t.type="button",t.innerHTML="Copy",t.addEventListener("click",()=>async function(e,t){var n=t.querySelectorAll("table")["length"];let r="";0<n?t.querySelectorAll(":last-child > tr > td:last-child").forEach(e=>{r+=e.innerText}):r=t.querySelector(":last-child > code").innerText;try{"granted"==(result=await navigator.permissions.query({name:"clipboard-write"})).state||"prompt"==result.state?await navigator.clipboard.writeText(r):a(r,t)}catch(e){a(r,t)}finally{e.innerHTML="Copied",setTimeout(function(){e.innerHTML="Copy"},2e3)}}(t,e));var n=document.createElement("div");n.className="ccw",n.appendChild(t),e.parentNode.insertBefore(n,e),n.appendChild(e)}function a(e,t){var n=document.createElement("textArea"),e=(n.contentEditable="true",n.readOnly="false",n.className="copyable-text-area",n.value=e,t.insertBefore(n,t.firstChild),document.createRange()),r=(e.selectNodeContents(n),window.getSelection());r.removeAllRanges(),r.addRange(e),n.setSelectionRange(0,999999),document.execCommand("copy"),t.removeChild(n)}document.querySelectorAll("pre").forEach(e=>t(e))}();
\ No newline at end of file diff --git a/templates/macros/head.html b/templates/macros/head.html index 92b2bb5..d778fce 100644 --- a/templates/macros/head.html +++ b/templates/macros/head.html @@ -159,6 +159,14 @@ {#- no search #} + {%- if config.extra.js_switcher %} + + <script defer src="{{ get_url(path='abridge-bundle-nosearch.min.js', trailing_slash=false, cachebust=true) | safe }}"{%- if config.extra.integrity %} integrity="sha384-{{ get_file_hash(path='abridge-bundle-nosearch.min.js', sha_type=384, base64=true) | safe }}"{%- endif %}></script> + {%- else %} + + <script defer src="{{ get_url(path='abridge-bundle-noswitchernosearch.min.js', trailing_slash=false, cachebust=true) | safe }}"{%- if config.extra.integrity %} integrity="sha384-{{ get_file_hash(path='abridge-bundle-noswitchernosearch.min.js', sha_type=384, base64=true) | safe }}"{%- endif %}></script> + {%- endif %} + {%- else %} {#- no bundle or search #} |
