diff options
author | Bryan Newbold <bnewbold@archive.org> | 2021-01-15 03:47:30 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@archive.org> | 2021-01-19 19:49:39 -0800 |
commit | 99322fa9d17621b9d60e5967d068ddccc01e21f9 (patch) | |
tree | c9082790935c31a88190e986d3f0023a501201b5 /fatcat_scholar/templates | |
parent | d0c6b6745f2206c3b4107fbe3d1905b4910c3ba8 (diff) | |
download | fatcat-scholar-99322fa9d17621b9d60e5967d068ddccc01e21f9.tar.gz fatcat-scholar-99322fa9d17621b9d60e5967d068ddccc01e21f9.zip |
html: add conditional polyfill for dialog element
This polyfill comes from Google
Diffstat (limited to 'fatcat_scholar/templates')
-rw-r--r-- | fatcat_scholar/templates/base.html | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/fatcat_scholar/templates/base.html b/fatcat_scholar/templates/base.html index 6af387d..a0af582 100644 --- a/fatcat_scholar/templates/base.html +++ b/fatcat_scholar/templates/base.html @@ -389,10 +389,22 @@ </footer> <script> -// when search is submitted, have submit button animate +/* when search is submitted, have submit button animate */ document.getElementById("search_form").onsubmit = function(){ document.getElementById("search_submit_button").classList.add("loading"); }; + +/* conditionally load polyfill for <dialog> */ +if (!(typeof HTMLDialogElement === 'function')) { + var js = document.createElement('script'); + js.src = "/static/dialog-polyfill.js"; + document.head.appendChild(js); + var link = document.createElement('link'); + link.rel = "stylesheet" + link.type = "text/css" + link.href= "/static/dialog-polyfill.css"; + document.head.appendChild(link); +}; </script> {% if settings.ENABLE_GOATCOUNTER -%} {# for local testing: <script>window.goatcounter = {allow_local: true};</script> #} |