User:Wetitpig0/全屏.js

注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google ChromeFirefoxMicrosoft EdgeSafari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。
//取自[[User:Alexander Misel/sidebar.js]]

function wgUXS (wg, hans, hant, cn, tw, hk, sg, zh, mo, my) {
	var ret = {
        'zh': zh || hans || hant || cn || tw || hk || sg || mo || my,
        'zh-hans': hans || cn || sg || my,
	    'zh-hant': hant || tw || hk || mo,
        'zh-cn': cn || hans || sg || my,
        'zh-sg': sg || hans || cn || my,
        'zh-tw': tw || hant || hk || mo,
        'zh-hk': hk || hant || mo || tw,
        'zh-mo': mo || hant || hk || tw
    };
    return ret[wg] || zh || hans || hant || cn || tw || hk || sg || mo || my; //保證每一語言有值
}

function wgULS (hans, hant, cn, tw, hk, sg, zh, mo, my) {
   	return wgUXS(mw.config.get('wgUserVariant'), hans, hant, cn, tw, hk, sg, zh, mo, my);
}

$(function () {
    var state = true;
	var portletLinkOnline = mw.util.addPortletLink(
        'p-namespaces',
        '#',
        '全屏',
        'ca-fullscreen',
        wgULS('隐藏左栏和注脚', '隱藏左欄和註腳'),
        'f'
    );
    $(portletLinkOnline).click(function(){
        if (state) {
        	document.getElementById('ca-fullscreen').getElementsByTagName('span')[0].getElementsByTagName('a')[0].innerHTML = '半屏';        	
        	//屏蔽
            $("#mw-panel").css("display", "none");
            $("#left-navigation").css("margin-left", "0em").css("margin-top", "0em").css("margin-top", "0em").css("margin-bottom", "0em");
            $("#right-navigation").css("margin-top", "0em").css("margin-bottom", "0em");
            $("#footer").css("margin-left", "0em").css("display", "none");
            $(".mw-body").css("margin-left", "0em").css("margin-top", "-7.55em");
            $("#p-personal").css("display", "none");
            $("#mw-head-base").css("margin-top", "0em"); 
        } else {
        	document.getElementById('ca-fullscreen').getElementsByTagName('span')[0].getElementsByTagName('a')[0].innerHTML = '全屏';
        	//顯示
            $("#mw-panel").css("display", "block");
            $("#left-navigation").css("margin-left", "11em").css("margin-top", "2.5em").css("margin-bottom", "2.5em");
            $("#right-navigation").css("margin-top", "2.5em").css("margin-bottom", "2.5em");
            $("#footer").css("margin-left", "11em").css("display", "block");
            $(".mw-body").css("margin-left", "11em").css("margin-top", "-0.05em");
            $("#p-personal").css("display", "block");
            $("#mw-head-base").css("margin-top", "-5em"); 
        }
        //更改狀態
        state = !state; 
    });
});