Jump to content

User:Virgolette/vector.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Virgolette (talk | contribs) at 14:33, 5 June 2010 (relocate search bar at the top of the page when the sidebar disappear). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
// I need this to avoid the collapse of tabs, 
// since I've moved the right tabs to the left
// See User:Virgolette/vector.css
// Thanks to User:Amalthea

wgVectorEnabledModules.collapsibletabs = false;


// BEGIN modified User:PleaseStand/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, addPortletLink, hookEvent, skin*/
 
var sidebarSwitch;
 
function sidebarHide() {
	document.getElementById("panel").style.display = "none";
	document.getElementById("head-base").style.marginLeft = "0";
	document.getElementById("content").style.marginLeft = "0";
	document.getElementById("left-navigation").style.left = "0";
	document.getElementById("footer").style.marginLeft = "0";
          /* optional: this part is working with my css */
	  document.getElementById("left-navigation").style.marginLeft = "0em";
	  document.getElementById("right-navigation").style.marginLeft = "11em";
	  document.getElementById("simpleSearch").style.top = "-5px";
          /* optional */
	if(typeof sidebarSwitch == "object") {
		sidebarSwitch.parentNode.removeChild(sidebarSwitch);
	}
	sidebarSwitch = addPortletLink("p-cactions", "javascript:sidebarShow()", "Show sidebar", "ca-sidebar", "Show the navigation links", "a");
}
 
function sidebarShow() {
	document.getElementById("panel").style.display = "";
	document.getElementById("head-base").style.marginLeft = "";
	document.getElementById("content").style.marginLeft = "";
	document.getElementById("left-navigation").style.left = "";
	document.getElementById("footer").style.marginLeft = "";
          /* optional: this part is working with my css */
	  document.getElementById("left-navigation").style.marginLeft = "";
	  document.getElementById("right-navigation").style.marginLeft = "";
	  document.getElementById("simpleSearch").style.top = "";
          /* optional */
	if(typeof sidebarSwitch == "object") {
		sidebarSwitch.parentNode.removeChild(sidebarSwitch);
	}
	sidebarSwitch = addPortletLink("p-cactions", "javascript:sidebarHide()", "Hide sidebar", "ca-sidebar", "Hide the navigation links", "a");
}
 
// Only activate on Vector skin
if(skin == "vector") {
	hookEvent("load", function() {
		// Change this if you want to hide the sidebar by default
		sidebarShow();
	});
}

// END modified User:PleaseStand/hide-vector-sidebar.js


// This function reduce the length of personal links 
// at the top of the page. I need this because I've 
// moved up the tabs reducing the waste of space

function shortlinks() 
{
 document.getElementById('pt-mytalk').firstChild.innerHTML = 'Talk';
 document.getElementById('pt-preferences').firstChild.innerHTML = 'Preferences';
 document.getElementById('pt-watchlist').firstChild.innerHTML = 'Watchlist';
 document.getElementById('pt-mycontris').firstChild.innerHTML = 'Edits';
}
addOnloadHook(shortlinks);