◆少前百科是非盈利性、非官方的少女前线维基百科。
◆如果您发现某些内容错误/空缺,请勇于修正/添加!参与进来其实很容易!点这里 加入少前百科
◆有任何意见、建议、纠错,欢迎在 GFwiki:反馈与建议 提出和讨论。编辑事务讨论QQ群:597764980,微博@GFwiki少前百科
◆To foreigners,You can use twitter to contact us.
Icon Nyto Silver.png

“MediaWiki:Vector.js”的版本间的差异

来自少前百科GFwiki
跳转至: 导航搜索
第4行: 第4行:
 
RLQ.push(function(){
 
RLQ.push(function(){
 
$(function(){
 
$(function(){
     $("#mw-head").append("<div id=\"GFHideSidebar\">Hide<\/div>");
+
     $("#mw-head").append("<div id=\"GFHideSidebar\"><div id=\"GFHideSidebar\" data-status=\"show\">点击隐藏侧边栏<\/div><\/div>");
    console.log("GFHideSidebar");
 
  
 
     if(getCookie("GFwikiHideSidebar") == "True"){
 
     if(getCookie("GFwikiHideSidebar") == "True"){
        $("#GFHideSidebar").html("Show");
+
    let text = $(this).children("#GFHideSidebarText");
 +
        text.attr("data-status", "hide");
 +
        text.html("点击显示侧边栏");
 
         $("#MenuSidebar").hide();$("#siteNotice").hide();
 
         $("#MenuSidebar").hide();$("#siteNotice").hide();
 
         $("div#content").css("cssText","margin-left:0em !important; border:none;");
 
         $("div#content").css("cssText","margin-left:0em !important; border:none;");
第15行: 第16行:
 
      
 
      
 
     $("#GFHideSidebar").click(function(){
 
     $("#GFHideSidebar").click(function(){
        if($(this).html() == "Show"){
+
    let text = $(this).children("#GFHideSidebarText");
             $(this).html("Hide");
+
        if(text.attr("data-status") == "show"){
 +
             text.attr("data-status", "hide");
 +
            text.html("点击显示侧边栏");
 
             setCookie("GFwikiHideSidebar", "False", 1);
 
             setCookie("GFwikiHideSidebar", "False", 1);
 
             $("#MenuSidebar").show();$("#siteNotice").show();
 
             $("#MenuSidebar").show();$("#siteNotice").show();
 
             $("div#content").css("cssText","margin-left:11em; border:1px solid #333333;");
 
             $("div#content").css("cssText","margin-left:11em; border:1px solid #333333;");
 
             $("#footer").css("cssText","margin-left:11em;");
 
             $("#footer").css("cssText","margin-left:11em;");
         } else if($(this).html() == "Hide"){
+
         } else if(text.attr("data-status") == "hide"){
             $(this).html("Show");
+
             text.attr("data-status", "show");
 +
            text.html("点击隐藏侧边栏");
 
             setCookie("GFwikiHideSidebar", "True", 1);
 
             setCookie("GFwikiHideSidebar", "True", 1);
 
             $("#MenuSidebar").hide();$("#siteNotice").hide();
 
             $("#MenuSidebar").hide();$("#siteNotice").hide();

2021年10月27日 (三) 00:52的版本

/* 这里的任何JavaScript将为使用Vector皮肤的用户加载 */

/** GFHideSidebar **/
RLQ.push(function(){
$(function(){
    $("#mw-head").append("<div id=\"GFHideSidebar\"><div id=\"GFHideSidebar\" data-status=\"show\">点击隐藏侧边栏<\/div><\/div>");

    if(getCookie("GFwikiHideSidebar") == "True"){
    	let text = $(this).children("#GFHideSidebarText");
        text.attr("data-status", "hide");
        text.html("点击显示侧边栏");
        $("#MenuSidebar").hide();$("#siteNotice").hide();
        $("div#content").css("cssText","margin-left:0em !important; border:none;");
        $("#footer").css("cssText","margin-left:0em !important;");
    }
    
    $("#GFHideSidebar").click(function(){
    	let text = $(this).children("#GFHideSidebarText");
        if(text.attr("data-status") == "show"){
            text.attr("data-status", "hide");
            text.html("点击显示侧边栏");
            setCookie("GFwikiHideSidebar", "False", 1);
            $("#MenuSidebar").show();$("#siteNotice").show();
            $("div#content").css("cssText","margin-left:11em; border:1px solid #333333;");
            $("#footer").css("cssText","margin-left:11em;");
        } else if(text.attr("data-status") == "hide"){
            text.attr("data-status", "show");
            text.html("点击隐藏侧边栏");
            setCookie("GFwikiHideSidebar", "True", 1);
            $("#MenuSidebar").hide();$("#siteNotice").hide();
            $("div#content").css("cssText","margin-left:0em !important; border:none;");
            $("#footer").css("cssText","margin-left:0em !important;");
        }
    });
});

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 "";
}
})