User:Cccmeat/vector.js

注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google ChromeFirefoxMicrosoft EdgeSafari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。
/* hide-vector-sidebar.js: Adds a button to toggle visibility of the Vector sidebar.
   Written by PleaseStand. Public domain; all copyright claims waived as described
   in http://en.wikipedia.org/wiki/Template:PD-self */
 
/*global document, window, addOnloadHook, addPortletLink, skin*/
 
var sidebarSwitch;
 
function sidebarHide() {
	document.getElementById("mw-panel").style.visibility = "hidden";
	document.getElementById("mw-head-base").style.marginLeft = "0";
	document.getElementById("content").style.marginLeft = "0";
	document.getElementById("left-navigation").style.left = "0";
	document.getElementById("footer").style.marginLeft = "0";
	if(typeof sidebarSwitch == "object") {
		sidebarSwitch.parentNode.removeChild(sidebarSwitch);
	}
	sidebarSwitch = mw.util.addPortletLink("p-cactions", "javascript:sidebarShow()", "Show sidebar", "ca-sidebar", "Show the navigation links", "a");
}
 
function sidebarShow() {
	document.getElementById("mw-panel").style.visibility = "";
	document.getElementById("mw-head-base").style.marginLeft = "";
	document.getElementById("content").style.marginLeft = "";
	document.getElementById("left-navigation").style.left = "";
	document.getElementById("footer").style.marginLeft = "";
	if(typeof sidebarSwitch == "object") {
		sidebarSwitch.parentNode.removeChild(sidebarSwitch);
	}
	sidebarSwitch = mw.util.addPortletLink("p-cactions", "javascript:sidebarHide()", "Hide sidebar", "ca-sidebar", "Hide the navigation links", "a");
}
 
// Only activate on Vector skin
if(skin == "vector") {
	addOnloadHook(function() {
		// Change this if you want to show the sidebar by default
		sidebarHide();
	});
}

languagereplace ()
function languagereplace () {
	if (document.getElementById('p-lang')) {
		var LangNodes=document.getElementById('p-lang').getElementsByTagName('ul')[0].getElementsByTagName('li');
		for( var x = 0; x < LangNodes.length; x++ ) {
			if (LangNodes[x].getElementsByTagName('a')[0].innerHTML == "English") 
			{
			 document.write(LangNodes[x].getElementsByTagName('a')[0].href);
			 mw.util.addPortletLink("p-cactions", LangNodes[x].getElementsByTagName('a')[0].href, "English", "Langgg", "安安");
			}
		}
	}
}

/*  _____________________________________________________________________________
 * |                                                                             |
 * |                    === WARNING: GLOBAL GADGET FILE ===                      |
 * |                  Changes to this page affect many users.                    |
 * | Please discuss changes on the talk page or on [[WT:Gadget]] before editing. |
 * |_____________________________________________________________________________|
 *
 * Imported as of 14 June 2011 from [[User:Edokter/MenuToTabs.js]]
 * Change the page action drop-down menus to tabs in Vector
 */
 
$( function() {
  if ( mw.config.get( 'skin' ) == 'vector' ) {
    $( '#p-cactions' )
      .removeClass( 'vectorMenu' )
      .addClass( 'vectorTabs' )
      .css( 'margin-left', '0.5em' )
      .find( 'div.menu > ul' )
        .unwrap()
      .find( 'li > a' )
        .wrap( '<span></span>' );
  }
});