User:Bequw/mobile.js

//////////From w:User:PleaseStand/hide-vector-sidebar.js /* 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;	}); }

/////////////////From w:User:Js/bottomSidebar.js if (skin == 'monobook' || skin=='simple') { var bottomSidebarPanel = window.bottomSidebarPanel || '1em' var isIE6 = (navigator.appName=="Microsoft Internet Explorer" && navigator.appVersion.substr(22, 1)=="6") var bottomSidebarSheet = bsAppendCSS('\ .portlet {float:left}\ if (bottomSidebarSheet.sheet) bottomSidebarSheet = bottomSidebarSheet.sheet //for Safari //call the script if (doneOnloadHook) popupSidebarInit else hookEvent('load', popupSidebarInit) // //else if (isIE6)  ... else addOnloadHook(popupSidebarInit) }
 * 1) column-content {float:none; margin-left:0}\
 * 2) column-content #content {margin-left:2px}\
 * 3) column-one {position:static; padding-top: 10px}\
 * 1) p-personal ul {text-align:left}\
 * 2) p-cactions {left:0}\
 * 3) p-lang {float:right}\
 * 4) footer {margin-left: 0}\
 * 5) p-logo {display:none}')

function popupSidebarInit{ var bottomSidebarMode = window.bottomSidebarMode || 0 document.getElementById('p-logo').style.display = 'none' // bsAppendCSS('#p-logo {display:none}') var colOne = document.getElementById('column-one') var link = document.createElement('span') link.appendChild(document.createTextNode('<>')) link.style.cssText = 'color:#797; font-weight:bold; font-size:15px; cursor:pointer;\ left:0px; top:0px; padding:2px; z-index:100; position:fixed' if (isIE6) link.style.position = 'absolute' addHandler(link, 'click', switchSidebar) document.body.appendChild(link) }

function showFixedSidebar{ bottomSidebarSheet.disabled = true colOne.style.paddingTop = windowScrolled + 1 + 'px' } function hideFixedSidebar{ bottomSidebarSheet.disabled = false colOne.style.paddingTop = '' } function switchSidebar{ if (bottomSidebarSheet.disabled) hideFixedSidebar; else showFixedSidebar }

function windowScrolled{ if (self.pageYOffset) return self.pageYOffset // all except IE else if (document.documentElement && document.documentElement.scrollTop)	// Explorer 6 Strict return document.documentElement.scrollTop else if (document.body) return document.body.scrollTop //all other IE }

function bsAppendCSS(text){ var s = document.createElement('style') s.setAttribute('type', 'text/css') if (s.styleSheet) s.styleSheet.cssText = text //IE else s.appendChild(document.createTextNode(text)) document.getElementsByTagName('head')[0].appendChild(s) return s }

mw.util.addCSS("pre{overflow: auto; border: 1px solid #aaa;}");