User:Js/bottomSidebar.js
Appearance
< User:Js
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
This user script seems to have a documentation page at User:Js/bottomSidebar. |
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')
switch (bottomSidebarMode){
case 0:
case 1:
var panel = document.createElement('div')
panel.id = 'column-panel'
panel.style.cssText = 'left:0; top:0; position:fixed; height:100%; z-index:100; cursor:move;\
background:none; width:'+bottomSidebarPanel
if (isIE6){ panel.style.position = 'absolute'; panel.style.height = document.body.scrollHeight + 'px'}
document.body.appendChild(panel)
if (bottomSidebarMode==1){
addHandler(panel, 'mouseover', showFixedSidebar)
addHandler(document.getElementById('content'), 'mouseover', hideFixedSidebar)
}else
addHandler(document.body, 'click', bodyClick)
break
case 2:
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)
break
}
function bodyClick(e){
e = e || window.event
var targ = e.target || e.srcElement
if (targ.id == 'column-panel') switchSidebar()
else if (targ.id && targ.nodeName == 'DIV') hideFixedSidebar()
}
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
}