User:Bequw/mobile.js
Jump to navigation
Jump to search
Note: You may have to bypass your browser’s cache to see the changes. In addition, after saving a sitewide CSS file such as MediaWiki:Common.css, it will take 5-10 minutes before the changes take effect, even if you clear your cache.
- Mozilla / Firefox / Safari: hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (Command-R on a Macintosh);
- Konqueror and Chrome: click Reload or press F5;
- Opera: clear the cache in Tools → Preferences;
- Internet Explorer: hold Ctrl while clicking Refresh, or press Ctrl-F5.
- This script lacks a documentation subpage. Please create it.
- Useful links: root page • root page’s subpages • links • redirects • your own
//////////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('\
#column-content {float:none; margin-left:0}\
#column-content #content {margin-left:2px}\
#column-one {position:static; padding-top: 10px}\
.portlet {float:left}\
#p-personal ul {text-align:left}\
#p-cactions {left:0}\
#p-lang {float:right}\
#footer {margin-left: 0}\
#p-logo {display:none}')
if (bottomSidebarSheet.sheet) bottomSidebarSheet = bottomSidebarSheet.sheet //for Safari
//call the script
if (doneOnloadHook) popupSidebarInit()
else hookEvent('load', popupSidebarInit)
// //else if (isIE6) ... else addOnloadHook(popupSidebarInit)
}
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;}");