Zum Inhalt springen

Benutzer:CyRoXX/monobook.js

aus Wikipedia, der freien Enzyklopädie
Dies ist eine alte Version dieser Seite, zuletzt bearbeitet am 12. Februar 2006 um 21:01 Uhr durch CyRoXX (Diskussion | Beiträge) (externISBN an neue BookButler-Website angepasst). Sie kann sich erheblich von der aktuellen Version unterscheiden.

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
  • Edge: Strg+F5 drücken oder Strg drücken und gleichzeitig Aktualisieren anklicken
// Nuetzliche Skripte gibts auch unter:
// http://en.wikipedia.org/wiki/Wikipedia:WikiProject_User_scripts/Scripts

//***********************************************************************
/*
 * moveEditsection (von de:Benutzer:Dbenzhuser)
 * Dieses Script verschiebt die Editsection-Buttons von oberhalb der
 * Überschriften in die Überschriften.
 * Dies vermeidet zum einen die Fehldarstellungen, die bisher durch die
 * float-Werte hervorgerufen wurden, und ergibt zum anderen eine logischere
 * Dokumentenstruktur (Editsection gehört nicht zum vorherigen Abschnitt)
 * Positiv getestet unter: Firefox 1.0, Opera 8.0, Internet Explorer 6.0
 * Anmerkungen, Verbesserungen, Hinweise, Nörgeleien jederzeit gerne gesehen!
 * dbenzhuser (de:Benutzer:Dbenzhuser)
 */
//***********************************************************************
function moveEditsection() {
	// Sammelt alle div-Elemente der Klasse "editsection".
	var editsections = new Array();
	var divs = document.getElementById("bodyContent").getElementsByTagName("div");
	for(var i = 0; i < divs.length; i++) {
		if(divs[i].className == "editsection") {
			editsections.push(divs[i]);
		}
	}
	// Wenn die Seite Editsection-Buttons enthält.
	if (editsections.length != 0) {
		// Sucht zu jedem Editsection-Button die dazugehörige Überschrfift.
		var i = 0;
		var element, heading;
		while (editsections[i] != null) {
			element = editsections[i];
			heading = element.nextSibling;
			while(!/^H[2-6]$/.test(heading.nodeName)) {
				heading = heading.nextSibling;
			}
			// Erstellt innerhalb der Überschrift ein per CSS formatiertes span-Element.
			// Dort hinein wird dann der Editsection-Link verschoben.
			// Anschließend werden die Reste des alten Editsection-Buttons entfernt.
			var spanElement = document.createElement("span");
			var spaceNode = document.createTextNode(" ");
			heading.appendChild(spaceNode);
			heading.appendChild(spanElement);
		
			spanElement.style.fontSize = "x-small";
			spanElement.style.fontWeight = "normal";
                        spanElement.style.textDecoration = "none";
		
			while (element.childNodes.length != 0) {
				spanElement.appendChild(element.childNodes[0]);
			}
			element.parentNode.removeChild(element);
			i++;
		}
	}
}
// onload
aOnloadFunctions[aOnloadFunctions.length] = moveEditsection;

/*
 * Ende moveEditsection
 */

 //***********************************************************************
 // Marks admins with something
 // by [[:de:User:Spongo]]
 // 28. Dez. 2005
 //***********************************************************************
 
 var markadmin = true;
 var UrlParameters = new Array ();
 readparams();

 function MarkAdmins(){
  if (markadmin){
		// last update 5.1.2006
		var admins=new Array('1001', 'AHZ', 'APPER', 'Achim Raschka', 'Aglarech', 'Aineias', 'Aka', 'Akl', 'AlexR', 'Alkuin', 'AndreasPraefcke', 'Anneke Wolf', 'Aristeides', 'Arnomane', 'ArtMechanic', 'Asb', 'Avatar', 'BLueFiSH.as', 'Baba66', 'Baldhur', 'Bdk', 'Ben-Zin', 'Berlin-Jurist', 'Bernhard55', 'Beyer', 'Birger Fricke', 'Blaite', 'Bradypus', 'Bubo bubo', 'CdaMVvWgS', 'Chb', 'Chef', 'Christian Günther', 'ChristophLanger', 'Chrkl', 'Crux', 'D', 'DaB.', 'DaTroll', 'Darkone', 'Dickbauch', 'Dishayloo', 'Duesentrieb', 'Dundak', 'EBB', 'Echoray', 'Eike sauer', 'ElRaki', 'Elian', 'Eloquence', 'Elya', 'Factumquintus', 'Fantasy', 'Filzstift', 'Finanzer', 'Fire', 'Flominator', 'Flups', 'Frank Schulenburg', 'Fristu', 'Fusslkopp', 'GS', 'Geisslr', 'Georg Slickers', 'Gunther', 'Hadhuey', 'Hafenbar', 'He3nry', 'Head', 'Henriette Fiebig', 'Herr Klugbeisser', 'Hoch auf einem Baum', 'Hoheit', 'Idler', 'Igelball', 'Ilja Lorek', 'Irmgard', 'Ixitixel', 'J budissin', 'JD', 'JakobVoss', 'Jcornelius', 'Jergen', 'Jesusfreund', 'Jofi', 'Juesch', 'KMJ', 'Kam Solusar', 'Karl Gruber', 'Karl-Henner', 'Kh80', 'Kiker99', 'Kku', 'Kubrick', 'Kurt Jansson', 'Langec', 'Leipnizkeks', 'LeonWeber', 'Liesel', 'Limasign', 'LosHawlos', 'Lou.gruber', 'Lung', 'Lyzzy', 'Maclemo', 'Magadan', 'Magnus Manske', 'Markus Mueller', 'Markus Schweiß', 'Mathias Schindler', 'Matthäus Wander', 'Mazbln', 'Media lib', 'Melkom', 'MichaelDiederich', 'Mikue', 'Mogelzahn', 'Napa', 'Nb', 'Nerd', 'NiTenIchiRyu', 'Nina', 'Nocturne', 'Okatjerute', 'Pelz', 'Perrak', 'Peterlustig', 'Philipendula', 'Pischdi', 'Pit', 'Pjacobi', "Poupou l'quourouce", 'RKraasch', 'Rainer Bielefeld', 'Rainer Zenz', 'Raven', 'Rax', 'Raymond', 'Rdb', 'Redf0x', 'Richardfabi', 'RobbyBer', 'Robert Kropf', 'Robodoc', 'Schewek', 'Schnargel', 'Schwalbe', 'Seidl', 'Sicherlich', 'Sigune', 'Skriptor', 'Slomox', 'Smurf', 'Southpark', 'Srbauer', 'Stahlkocher', 'Stechlin', 'Stefan Kühn', 'Stefan64', 'Steffen Löwe Gera', 'Stern', 'Steschke', 'Stw', 'Terabyte', 'Thomas Luft', 'Threedots', 'Tilman Berger', 'TomK32', 'Tsor', 'Tsui', 'Tullius', 'UW', 'Unscheinbar', 'Ureinwohner', 'Uwe Gille', 'Vic Fontaine', 'Vigala Veia', 'Voyager', 'Vulture', 'Waugsberg', 'Wolfgangbeyer', 'Wst', 'Xocolatl', 'Zenogantner', 'Zenon', 'Zinnmann', 'Zumbo');

  var langUser = "Benutzer:";	// in German 'Benutzer:'
  var aMark = document.createElement("b");
  var aMarkText = document.createTextNode(" (A)");  // dieser Text wird hinter dem Namen des Admins angefügt (Standard: "(A)")
  aMark.appendChild(aMarkText);

  var ishistory = (UrlParameters['action']=='history');
  var isdiskussion = (((document.URL.indexOf('Spezial:Recentchanges') > 0)) || (document.URL.indexOf('Diskussion') > 0) || (document.URL.indexOf('Wikipedia') > 0));
  var searchExp = /.wiki.Benutzer.(.+)/;
  		if (ishistory || isdiskussion || ((UrlParameters['diff']>'') && (UrlParameters['oldid']>''))) {
		   for (var i=0; aNode = document.getElementsByTagName("a")[i]; i++) {
		   	 // if it's a link to an user
		     if ( (href = aNode.getAttribute("href")) && (href.search("/wiki/" + langUser) != -1) ) {
				currUser = searchExp.exec(href)[1];
		    	// is this user an admin?
		    	for (var k=0; k < admins.length; ++k){
					if (currUser == admins[k]){
						aNode.appendChild(aMark.cloneNode(true));
						break;
					}
				}
		  	 }
		   }
  		}
  }
}
//******************************************  
 function readparams () {
  var asReadInUrlParameters;
  var asReadInUrlParameter;

  // Get URL parameters
  asReadInUrlParameters = location.search.substring(1, location.search.length).split("&");
  for (i = 0; i < asReadInUrlParameters.length; i++) {
    asReadInUrlParameter = asReadInUrlParameters[i].split("=");
    UrlParameters[decodeURIComponent(asReadInUrlParameter[0])] = decodeURIComponent(asReadInUrlParameter[1]);
  }
 } //function readparams
 //******************************************

addOnloadHook(MarkAdmins);

//***********************************************************************
// Google-Link
//***********************************************************************
function addLink(where, url, name, id, title, key, after){
    //* where is the id of the toolbar where the button should be added;
    //   i.e. one of "p-cactions", "p-personal", or "p-navigation".
    //* url is the URL which will be called when the button is clicked.
    //   javascript: urls can be used to do more complex things.
    //* name is what will appear as the name of the button.
    //* id is the id of the button; it's best to define one.  
    //   Use a prefix to make sure its unique. Optional.
    //* title is the tooltip title that gives a longer description 
    //   of the button; if you define a accesskey, mention it here. Optional.
    //* key is the char you want for the accesskey. Optional.
    //* after is the id of the button you want to follow this one. Optional.
    var na = document.createElement('a');
    na.href = url;
    na.appendChild(document.createTextNode(name));
    var li = document.createElement('li');
    if(id) li.id = id;
    li.appendChild(na);
    var tabs = document.getElementById(where).getElementsByTagName('ul')[0];
    if(after) {
        tabs.insertBefore(li,document.getElementById(after));
    } else {
        tabs.appendChild(li);
    }
    if(id) {
        if(key && title) { ta[id] = [key, title]; }
        else if(key) { ta[id] = [key, '']; }
        else if(title) { ta[id] = ['', title];} 
    }
    // re-render the title and accesskeys from existing code in wikibits.js
    akeytt();
    return li;
}

addOnloadHook(function () {  // add onload handler using code from wikibits.js
    var title;
    if (!(title = document.getElementById('t-whatlinkshere') )) return;
    if (!(title = title.getElementsByTagName('a')[0] )) return;
    if (!(title = title.href )) return;
    if (!(title = title.replace(/^.*\/wiki\/Spezial:Whatlinkshere\//, '') )) return;
    if (!(title = title.replace(/^(Talk|User|Wikipedia|Image|MediaWiki|Template|Help|Category|Portal)(_talk)?:/, '') )) return;
    if (!(title = title.replace(/("|%22)/g, '') )) return;
    if (!(title = title.replace(/_/g, '%20') )) return;
 
    addLink('p-tb', 'http://www.google.com/search?q=%22'+title+'%22%20-Wikipedia&ie=utf-8&oe=utf-8',
            'Google', 't-googlesearch', 'Suche bei Google nach "'+decodeURIComponent(title)+'"', 'G', null);
});

//***********************************************************************
// hideOwn
// hides own edits in the watchlist
// source: en:Wikipedia:WikiProject User scripts/Scripts
//***********************************************************************

function hideOwn() {
  for (var i=0; i<document.links.length; ++i) {
    if (document.links[i].href.indexOf('Spezial:Watchlist')>0) {  // edit by de:Benutzer:CyRoXX: "Spezial" instead of "Special" to make it work with the german Wikipedia
      document.links[i].href+='?hideOwn=1';
      break;
    }
  }
};
addOnloadHook(hideOwn);

//***********************************************************************
// Unwatch
// source: en:Wikipedia:WikiProject User scripts/Scripts
//
// This script adds an "unwatch" link to each entry in your watchlist. This version
// works regardless of whether you have the "Enhanced recent changes" option
// selected in your user preferences. By default the links take you back to your
// watchlist. If you'd prefer them to take you to a "Removed from watchlist" page
// like the unwatch links at the top of the watched pages, uncomment the second line
// in the function.
//***********************************************************************

function unwatch() {
    var query_prefix = "title=Special:Watchlist&action=submit&remove=1&id[]=";
    //var query_prefix = "action=unwatch&title=";

    if (window.location.href.indexOf("Spezial:Watchlist") == -1) return; // edit by de:Benutzer:CyRoXX: "Spezial" instead of "Special" to make it work with the german Wikipedia
    var links = document.getElementById('content').getElementsByTagName('a');
    for (var i = 0; i < links.length; i++) {
        if (links[i].href.substring(links[i].href.length-15) != '&action=history')
            continue;
        var unwatch = document.createElement('a');
        unwatch.href = "/w/index.php?" + query_prefix + encodeURIComponent(links[i].title);
        unwatch.title = "Unwatch "+links[i].title;
        unwatch.appendChild(document.createTextNode("unwatch"));
        links[i].parentNode.insertBefore(unwatch, links[i].nextSibling);
        // kluge to handle case where "diff" is unlinked:
        var delim = links[i].previousSibling;
        delim = (delim.nodeType == 3 ? delim.nodeValue : "");
        links[i].parentNode.insertBefore(document.createTextNode(delim.replace(/^.*diff/, "")), unwatch);
    }
};

addOnloadHook(unwatch);

//***********************************************************************
// externISBN
//
// Beim Klicken auf einen ISBN-Link landet man nicht auf der WP-Seite mit
// weiterführenden Links, sondern auf der Online-Preisvergleichsseite von
// Bookbutler.de.
//
// Vorlage für diese Funktion: Skript auf en:Wikipedia:WikiProject User scripts/Scripts
// (war ursprünglich Direktlink auf Amazon)
//***********************************************************************
function externISBN() {
  for (var i = 0; i < document.links.length; i++) 
    {       
         var ln = document.links[i].href.match(/isbn=(.*)/);
         if (ln) {
            document.links[i].href='http://www.bookbutler.de/vergleich/wps/'+RegExp.$1;
         }
    }

}

addOnloadHook(externISBN);

//***********************************************************************
// APPER's Rechtschreibprüfung (Benutzer:APPER bzw. Benutzer:APPER)
//***********************************************************************
document.write('<SCRIPT SRC="http://de.wikipedia.org/w/index.php?title=Benutzer:APPER/RP/js&action=raw&ctype=text/javascript"><\/SCRIPT>');