MediaWiki:Navigation.js
Zur Navigation springen
Zur Suche springen
Hinweis: Leeren Sie nach dem Speichern den Browser-Cache, um die Änderungen sehen zu können.
- Firefox/Safari: Umschalttaste drücken und gleichzeitig Aktualisieren anklicken oder entweder Strg+F5 oder Strg+R (⌘+R auf dem Mac) drücken
- Google Chrome: Umschalttaste+Strg+R (⌘+Umschalttaste+R auf dem Mac) drücken
- Internet Explorer: Strg+F5 drücken oder Strg drücken und gleichzeitig Aktualisieren anklicken
- Opera: Gehen Sie zu Menü → Einstellungen (Opera → Einstellungen auf dem Mac) und dann auf Datenschutz & Sicherheit → Browserdaten löschen → Gespeicherte Bilder und Dateien.
/***********************************
Anpassen an Browserfenster, u.a.
************************************/
function sizeX() {
var em = document.getElementById("content").appendChild(document.createElement("DIV"));
em.style.width = '1em';
var normW = em.offsetWidth*80+200; // 80em+2x100px = content
var thisW = window.innerWidth || document.documentElement.offsetWidth || 0;
var rand_abstand = (thisW > normW)? Math.round((thisW - normW)/2) : 0;
newRules[0].style.left = // #nv.fixed
newRules[3].style.left = // #p-search.fixed
rand_abstand+10+'px';
var content= document.getElementById('content').style;
var footer= document.getElementById('footer').style;
var search = document.getElementById('mw-head').style;
content.marginLeft =
content.marginRight =
search.marginLeft =
search.marginRight =
footer.marginLeft =
footer.marginRight =
rand_abstand+'px';
/*
var normW = 1024,
thisW = window.innerWidth || document.documentElement.offsetWidth || 0,
rand_abstand = (thisW > normW)? Math.round((thisW - normW)/20*2.5) : 0;
document.body.style.paddingRight =
document.body.style.paddingLeft =
document.getElementById("p-personal").style.marginLeft =
rand_abstand+'px';
newRules[0].style.left = // #siteNotice.fixed
rand_abstand+10+'px';
document.getElementById("footer").style.marginLeft =
document.getElementById("footer").style.marginRight =
-rand_abstand+'px';
document.getElementById("bodyContent").style.marginRight =
document.getElementById("bodyContent").style.marginLeft =
rand_abstand/2+'px';
*/
}
function sizeY() {
//Maße und Elemente
var body_height = document.getElementById("footer").offsetTop + 70,
screen_height = window.innerHeight ||
document.documentElement.offsetHeight
diff = screen_height - body_height;
// Höhe anpassen
var spacer = document.getElementById("catlinks")?
document.getElementById("catlinks").parentNode.insertBefore(document.createElement("DIV"), document.getElementById("catlinks")) :
document.getElementById("bodyContent").appendChild( document.createElement("DIV") );
spacer.style.paddingTop = diff > 0 ? diff +"px" : 0;
}
sizeX();
sizeY();
window.onresize = function() { sizeX(); };
// window.onresize = function() { sizeY(); };
/*****************
Navigation
*****************/
var nav = document.getElementById('nv');
var search = document.getElementById('p-search');
function findPos(b) { //Position von b ( = nav) ermitteln
var a = 0;
if(b.offsetParent)
for(a = b.offsetTop;b = b.offsetParent;)
a += b.offsetTop;
return[a];
}
var nvY = findPos(nav);
function fixNv() {
//Scrollposition ermitteln
var scrY = document.documentElement.scrollTop || // Explorer 6 Strict
document.body.scrollTop || //all other Explorers
self.pageYOffset ||
0;
if(self.pageYOffset)
scrY = self.pageYOffset;
else if(document.documentElement && document.documentElement.scrollTop)
scrY = document.documentElement.scrollTop;
else if(document.body)
scrY = document.body.scrollTop;
if(fixOK && typeof document.body.style.maxHeight != "undefined" && nav!='') // nur neuere Browser
nav.className = search.className = scrY > nvY - 16 ? "fixed" : "absolute";
else nav.className = search.className = "absolute";
}
//Menü stabilisieren
var fixOK = 1;
var toggleFix =document.getElementById('chapters').appendChild(document.createElement("DIV"));
toggleFix.id = 'tF';
var tF_a= toggleFix.appendChild(document.createElement("a"));
tF_a.href='javascript:menuTop()';
tF_a.innerHTML='↑';
tF_a.title = 'Menü oben stabilisieren';
function menuTop() {
fixOK = 0;
fixNv();
}
function styleNv() {
var selflink = document.getElementById('chapters').getElementsByTagName('STRONG')[0]||0;
if (selflink && selflink.parentNode.parentNode.parentNode.tagName == 'LI') {
selflink.parentNode.parentNode.parentNode.className='self_parent';
}
}
styleNv();
window.onscroll = fixNv;
/*****************
Top Arrows
*****************/
function PageHomeArrows()
{
//if (!wgNamespaceNumber || wgNamespaceNumber <100) return;
var c = document.getElementById("bodyContent") || document.getElementById("mw_content") || document.getElementById("article");
if (!c) return;
for (var level = 2; level <= 3; ++level) {
var h = c.getElementsByTagName("h" + level);
for (var i = 0; i < h.length; ++i) {
if (h[i].offsetTop>screen.availHeight) {
var arrow = $("<a>top↑</a>").attr({
href: function(){ },
title: "zum Seitenanfang",
"class": "toparrow noprint"
})
var top= function( ) {window.scrollTo(0,0);}
$(arrow).on( "click", top);
arrow.appendTo( h[i] );
}
}
}
}
$(PageHomeArrows);
Religion-in-Japan❯MediaWiki❯Navigation.js