更改

跳到导航 跳到搜索
添加2,260字节 、​ 2022年10月17日 (一) 11:26
无编辑摘要
第1行: 第1行:  
/* 这里的任何JavaScript将为使用Vector皮肤的用户加载 */
 
/* 这里的任何JavaScript将为使用Vector皮肤的用户加载 */
 +
/** ZBC Sidebar ver1.1 **/
 +
var buttonNode = document.createElement('div');buttonNode.id="SidebarButton";buttonNode.title="点击隐藏侧边栏";buttonNode.dataset.status="show";
 +
document.querySelector("#content").appendChild(buttonNode);
 +
if(getCookie("wikiHideSidebar")=="True"){document.querySelector("#SidebarButton").dataset.status="hide";document.body.classList.add("hide");document.querySelector("#SidebarButton").setAttribute('title', "点击显示侧边栏");window.timeout=setTimeout(function(){document.querySelector("#MenuSidebar,p-logo").style.display="none"},200)}
 +
window.timeout=setTimeout(function(){},0);
 +
function switchGroup(){
 +
    var button = document.querySelector("#SidebarButton");
 +
        if(button.dataset.status == "hide"){
 +
            button.dataset.status="show";document.querySelector("#MenuSidebar,#p-logo").style.display="";setTimeout(function(){document.body.classList.remove("hide")},1);button.setAttribute('title', "点击隐藏侧边栏");document.querySelector("#MenuSidebar,p-logo").style.display="";clearTimeout(window.timeout);
 +
            setCookie("GFwikiHideSidebar", "False", 1);
 +
        } else {
 +
            button.dataset.status="hide";document.body.classList.add("hide");button.setAttribute('title', "点击显示侧边栏");window.timeout=setTimeout(function(){document.querySelector("#MenuSidebar,#p-logo").style.display="none"},200);
 +
            setCookie("GFwikiHideSidebar", "True", 1);
 +
        }
 +
}
 +
document.querySelector("#SidebarButton").addEventListener("click",function(){switchGroup()})
 +
function setCookie(cname,cvalue,exdays){
 +
    var d = new Date();
 +
    d.setTime(d.getTime()+(exdays*24*60*60*1000));
 +
    var expires = "expires="+d.toGMTString();
 +
    document.cookie = cname+"="+cvalue+"; "+expires;
 +
}
 +
 +
function getCookie(cname){
 +
    var name = cname + "=";
 +
    var ca = document.cookie.split(';');
 +
    for(var i=0; i<ca.length; i++) {
 +
        var c = ca[i].trim();
 +
        if (c.indexOf(name)==0) { return c.substring(name.length,c.length); }
 +
    }
 +
    return "";
 +
}
 +
 +
RLQ.push(function() {
 +
$(function() {
 +
$(window).on("scroll", function() {
 +
$(document).scrollTop() > 0 ? $("#toc").addClass("toc-float") : $("#toc").removeClass("toc-float");
 +
}).scroll();
 +
});
 +
})
 +
 +
/** ZBC Sidebar ver1.1 end **/
15,684

个编辑

导航菜单