2022-02-21 09:59:33 +08:00
|
|
|
function plugin(o,e){let t;o.mounted((function(){const o=document.getElementsByClassName("content")[0];t=parseFloat(window.getComputedStyle(o).paddingTop.replace("px",""));let e=`\n <div style="position: fixed; width: 100%; z-index: 999; height: ${window.$docsify.progress.height};\n ${"top"===window.$docsify.progress.position?"top: 0;":"bottom: 0;"}">\n <div id="progress-display" style="background-color: ${window.$docsify.progress.color}; width: 0; border-radius: 2px; height: ${window.$docsify.progress.height}; transition: width 0.3s;"></div>\n </div>\n `;const n=document.getElementsByTagName("body")[0];n.innerHTML=n.innerHTML+e;document.querySelector("div.sidebar-toggle-button").addEventListener("click",(function(o){o.stopPropagation(),function(){const o=document.getElementsByTagName("body")[0];o.classList.contains("close")?o.classList.remove("close"):o.classList.add("close")}()}))})),o.ready((function(){window.addEventListener("scroll",(function(o){let e=t+parseFloat(window.getComputedStyle(document.getElementById("main")).height.replace("px","")),n=document.body.scrollTop+document.documentElement.scrollTop,i=e-document.body.offsetHeight;document.getElementById("progress-display").style.width=Math.ceil(n/i*100)+"%"}))}))}window.$docsify.progress=Object.assign({position:"top",color:"var(--themeColor,#42b983)",height:"3px"},window.$docsify.progress),window.$docsify.plugins=[].concat(plugin,window.$docsify.plugins);
|