Benutzer:Loki/monobook.js

Aus Shadowhelix
Zur Navigation springen Zur Suche springen

Hinweis: Leere nach dem Veröffentlichen 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/Edge: Strg+F5 drücken oder Strg drücken und gleichzeitig Aktualisieren anklicken
  • Opera: Strg+F5
/* Ergänzung der Editierzeile mit zusätzlichen Buttons */

if (mwCustomEditButtons) {

    mwCustomEditButtons[mwCustomEditButtons.length] = {
        "imageFile": "http://shadowhelix.de/images/b/b9/Button_E.png",
        "speedTip": "Artikelende",
        "tagOpen": "<!-- Ende des Artikelinhalts - Metainformationen -->",
        "tagClose": "",
        "sampleText": ""};

    mwCustomEditButtons[mwCustomEditButtons.length] = {
        "imageFile": "http://shadowhelix.de/images/b/b0/Button_trash.png",
        "speedTip": "Löschantrag",
        "tagOpen": "{{Löschantrag|}}",
        "tagClose": "",
        "sampleText": ""};

}

/* Buttons für Jahresartikel-Navigation */

function createNavButtons() {

    var Navigation = document.getElementsByTagName( "div" );
 
    for ( var i = 0; i < Navigation.length; i++ ) {
        if ( hasClass( Navigation[i], "jahresartikel" ) ) {
 
            var Button1     = document.createElement( "span" );
            var Button1Link = document.createElement( "a" );
            var Button1Text = document.createTextNode( "Alles" );
 
            Button1.style.styleFloat = "right";
            Button1.style.cssFloat = "right";
            Button1.style.fontWeight = "normal";
            Button1.style.textAlign = "right";
            Button1.style.width = "6em";
 
            Button1Link.style.color = Navigation[i].style.color;
            Button1Link.setAttribute( "id", "AllesButton" );
            Button1Link.setAttribute( "href", "javascript:obj_toggle()" );
            Button1Link.appendChild( Button1Text );
 
            Button1.appendChild( document.createTextNode( "[" ) );
            Button1.appendChild( Button1Link );
            Button1.appendChild( document.createTextNode( "]" ) );
 
            Navigation[i].insertBefore( Button1, Navigation[i].childNodes[0] );

            var Button2     = document.createElement( "span" );
            var Button2Link = document.createElement( "a" );
            var Button2Text = document.createTextNode( "Magie" );
 
            Button2.style.styleFloat = "left";
            Button2.style.cssFloat = "left";
            Button2.style.fontWeight = "normal";
            Button2.style.textAlign = "left";
            Button2.style.width = "6em";
 
            Button2Link.style.color = Navigation[i].style.color;
            Button2Link.setAttribute( "id", "MagieButton" );
            Button2Link.setAttribute( "href", "javascript:obj_toggle_magie()" );
            Button2Link.appendChild( Button2Text );
 
            Button2.appendChild( document.createTextNode( "[" ) );
            Button2.appendChild( Button2Link );
            Button2.appendChild( document.createTextNode( "]" ) );
 
            Navigation[i].insertBefore( Button2, Navigation[i].childNodes[0] );

        }
    }
 
}
 
addOnloadHook( createNavButtons );

/* Ausblendfunktionen */

function obj_toggle() {
	var objects = document.getElementsByTagName('td');
	for (var i=0; i < objects.length; i++) {
		objects[i].style.display = ''
	}
}

function obj_toggle_magie() {
	obj_toggle();
	var objects = document.getElementsByTagName('td');
	for (var i=0; i < objects.length; i++) {
		var keys = String(objects[i].getAttribute('id'));
		if (keys.search(/magie/) != -1) {}
		else {objects[i].style.display = 'none'}
	}
}

function obj_toggle_theme( theme ) {
	obj_toggle();
	var objects = document.getElementsByTagName('td');
	for (var i=0; i < objects.length; i++) {
		var keys = String(objects[i].getAttribute('id'));
		if (keys.search(theme) != -1) {}
		else {objects[i].style.display = 'none'}
	}
}

/* Test if an element has a certain class
 *
 * Copied from Wikipedia
 */
 
var hasClass = (function () {
    var reCache = {};
    return function (element, className) {
        return (reCache[className] ? reCache[className] : (reCache[className] = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className);
    };
})();