diff options
author | amzrk2 | 2020-07-07 21:40:03 +0800 |
---|---|---|
committer | amzrk2 | 2020-07-07 21:40:03 +0800 |
commit | 7da818e69b76ff6764157da75137de69feadb7ce (patch) | |
tree | 6a7c17804675f52cf6d68261f59da448020af8c6 /static/assets/js/fuji.min.js | |
parent | 39b230d730c44e9463c6c83ea7f81851a2048a5b (diff) | |
download | hugo-theme-fuji-7da818e69b76ff6764157da75137de69feadb7ce.tar.gz hugo-theme-fuji-7da818e69b76ff6764157da75137de69feadb7ce.tar.bz2 hugo-theme-fuji-7da818e69b76ff6764157da75137de69feadb7ce.zip |
Fix medium-zoom
Diffstat (limited to 'static/assets/js/fuji.min.js')
-rw-r--r-- | static/assets/js/fuji.min.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/static/assets/js/fuji.min.js b/static/assets/js/fuji.min.js index d7e8d68..90d79bd 100644 --- a/static/assets/js/fuji.min.js +++ b/static/assets/js/fuji.min.js @@ -1 +1 @@ -"use strict";function getNowTheme(){var e=document.body.getAttribute("data-theme");return"auto"===e?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":"dark"===e?"dark":"light"}function updateUtterancesTheme(e){var t=getNowTheme();e&&("dark"===t?e.contentWindow.postMessage({type:"set-theme",theme:"photon-dark"},"https://utteranc.es"):e.contentWindow.postMessage({type:"set-theme",theme:"github-light"},"https://utteranc.es"))}function searchAll(e,t,n){var o=new Fuse(t,{shouldSort:!0,distance:1e4,keys:[{name:"title",weight:2},{name:"tags",weight:1.5},{name:"content",weight:1}]}).search(e);return 0<o.length?(document.getElementById("search-result").innerHTML=template("search-result-template",o),[(new Date).getTime()-n,o.length]):"notFound"}document.querySelector("span.post-comment-notloaded")&&document.querySelector("span.post-comment-notloaded").addEventListener("click",loadComment),document.querySelector(".btn .btn-scroll-top").addEventListener("click",function(){document.documentElement.scrollTop=0}),document.querySelector(".btn .btn-toggle-mode").addEventListener("click",function(){var e=getNowTheme(),t=document.body.getAttribute("data-theme"),n=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";"auto"===t?(document.body.setAttribute("data-theme","light"===e?"dark":"light"),localStorage.setItem("fuji_data-theme","light"===e?"dark":"light")):"light"===t?(document.body.setAttribute("data-theme","dark"),localStorage.setItem("fuji_data-theme","dark"==n?"auto":"dark")):(document.body.setAttribute("data-theme","light"),localStorage.setItem("fuji_data-theme","light"==n?"auto":"light"));var o=document.querySelector(".post-comment");o&&document.querySelector("span.post-comment-notloaded").getAttribute("style")&&("utterances"===o.getAttribute("data-comment")&&updateUtterancesTheme(document.querySelector(".post-comment iframe")),"disqus"===o.getAttribute("data-comment")&&DISQUS.reset({reload:!0}))});var counter,infoElements,key,xhr,urlParams=new URLSearchParams(window.location.search);urlParams.has("s")&&(counter=(new Date).getTime(),infoElements=document.querySelectorAll(".search-result-info"),key=urlParams.get("s"),document.querySelector(".search-input input").setAttribute("value",key),(xhr=new XMLHttpRequest).open("GET","/index.json",!0),xhr.responseType="json",xhr.onerror=function(){infoElements[2].removeAttribute("style")},xhr.ontimeout=function(){infoElements[2].removeAttribute("style")},xhr.onreadystatechange=function(){4===xhr.readyState&&(200===xhr.status?"notFound"===(counter=searchAll(key,xhr.response,counter))?infoElements[1].removeAttribute("style"):(infoElements[0].innerHTML=infoElements[0].innerHTML.replace("[TIME]",counter[0]),infoElements[0].innerHTML=infoElements[0].innerHTML.replace("[NUM]",counter[1]),infoElements[0].removeAttribute("style")):infoElements[2].removeAttribute("style"))},xhr.send(null));
\ No newline at end of file +"use strict";function getNowTheme(){var e=document.body.getAttribute("data-theme");return"auto"===e?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":"dark"===e?"dark":"light"}function updateUtterancesTheme(e){var t=getNowTheme();e&&("dark"===t?e.contentWindow.postMessage({type:"set-theme",theme:"photon-dark"},"https://utteranc.es"):e.contentWindow.postMessage({type:"set-theme",theme:"github-light"},"https://utteranc.es"))}function searchAll(e,t,n){var o=new Fuse(t,{shouldSort:!0,distance:1e4,keys:[{name:"title",weight:2},{name:"tags",weight:1.5},{name:"content",weight:1}]}).search(e);return 0<o.length?(document.getElementById("search-result").innerHTML=template("search-result-template",o),[(new Date).getTime()-n,o.length]):"notFound"}document.querySelector("span.post-comment-notloaded")&&document.querySelector("span.post-comment-notloaded").addEventListener("click",loadComment),document.querySelector(".btn .btn-scroll-top").addEventListener("click",function(){document.documentElement.scrollTop=0}),document.addEventListener("DOMContentLoaded",function(){mediumZoom(".img-zoomable",{margin:32,background:"#00000054",scrollOffset:128})}),document.querySelector(".btn .btn-toggle-mode").addEventListener("click",function(){var e=getNowTheme(),t=document.body.getAttribute("data-theme"),n=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";"auto"===t?(document.body.setAttribute("data-theme","light"===e?"dark":"light"),localStorage.setItem("fuji_data-theme","light"===e?"dark":"light")):"light"===t?(document.body.setAttribute("data-theme","dark"),localStorage.setItem("fuji_data-theme","dark"==n?"auto":"dark")):(document.body.setAttribute("data-theme","light"),localStorage.setItem("fuji_data-theme","light"==n?"auto":"light"));var o=document.querySelector(".post-comment");o&&document.querySelector("span.post-comment-notloaded").getAttribute("style")&&("utterances"===o.getAttribute("data-comment")&&updateUtterancesTheme(document.querySelector(".post-comment iframe")),"disqus"===o.getAttribute("data-comment")&&DISQUS.reset({reload:!0}))});var counter,infoElements,key,xhr,urlParams=new URLSearchParams(window.location.search);urlParams.has("s")&&(counter=(new Date).getTime(),infoElements=document.querySelectorAll(".search-result-info"),key=urlParams.get("s"),document.querySelector(".search-input input").setAttribute("value",key),(xhr=new XMLHttpRequest).open("GET","/index.json",!0),xhr.responseType="json",xhr.onerror=function(){infoElements[2].removeAttribute("style")},xhr.ontimeout=function(){infoElements[2].removeAttribute("style")},xhr.onreadystatechange=function(){4===xhr.readyState&&(200===xhr.status?"notFound"===(counter=searchAll(key,xhr.response,counter))?infoElements[1].removeAttribute("style"):(infoElements[0].innerHTML=infoElements[0].innerHTML.replace("[TIME]",counter[0]),infoElements[0].innerHTML=infoElements[0].innerHTML.replace("[NUM]",counter[1]),infoElements[0].removeAttribute("style")):infoElements[2].removeAttribute("style"))},xhr.send(null));
\ No newline at end of file |