monobook.js: Unterschied zwischen den Versionen

Aus RMG-Wiki
Wechseln zu: Navigation, Suche
Zeile 1: Zeile 1:
document.write('<SCRIPT SRC="http://wikis.zum.de/rmg/index.php/Benutzer:Zehe_Albin/Buttons.js><\/SCRIPT>');
+
// document.write('<SCRIPT SRC="http://wikis.zum.de/rmg/index.php/Benutzer:Zehe_Albin/Buttons.js><\/SCRIPT>');
 +
// </nowiki> <- nicht löschen !!!
 
//------------------------------
 
//------------------------------
  

Version vom 5. August 2008, 11:38 Uhr

// document.write('<SCRIPT SRC="http://wikis.zum.de/rmg/index.php/Benutzer:Zehe_Albin/Buttons.js><\/SCRIPT>');
// </nowiki> <- nicht löschen !!!
//------------------------------
 
// ursprünglich: [[:en:User:Pile0nades]]
// Erweitert von: Maciej Jaros [[:pl:User:Nux]]
// siehe http://pl.wikipedia.org/wiki/MediaWiki:Monobook.js
// Korrigiert von: [[Benutzer:TMg]]
 
if (wgIsArticle) addOnloadHook(function() {
	// somehow it gets run twice on some pages - stop that
	if (window.addEditTopLinkDone)
		return;
	window.addEditTopLinkDone = true;
 
	// if there are no edit-section links then stop
	var spans = document.getElementsByTagName("span");
	var i;
	for (i = 0; i < spans.length; i++) {
		if (spans[i].className == 'editsection')
			break;
	}
	if (i >= spans.length)
		return;
 
	// additional checkup to stop
	var test = document.getElementsByTagName("h2").length +
		document.getElementsByTagName("h3").length +
		document.getElementsByTagName("h4").length - ((typeof document.getElementById('siteSub') == 'undefined' || document.getElementById('siteSub').tagName != 'H3') ? 0 : 1) ;
	// note that there is always siteSub (h3)
	var addEditTopLinkNumHeaders = window.addEditTopLinkNumHeaders || 2;
	if (test <= addEditTopLinkNumHeaders)
		return;
 
	// get first header element
	var fst_h1 = document.getElementsByTagName("h1")[0];
 
	// Creating elements
	// create span
	var span = document.createElement("SPAN");
	span.className = 'editsection';
	// create link
	var link = document.createElement("A");
	link.href = document.getElementById("ca-edit").getElementsByTagName("a")[0].href + '&section=0';
	link.title = "Abschnitt bearbeiten: Einleitung";
	link.appendChild(document.createTextNode('Bearbeiten'));
	// append link and stuff to span
	span.appendChild(document.createTextNode('['));
	span.appendChild(link);
	span.appendChild(document.createTextNode(']'));
 
	// Insert span container into the DOM before the h1
	fst_h1.insertBefore(document.createTextNode(" "), fst_h1.firstChild);
	fst_h1.insertBefore(span, fst_h1.firstChild);
});
 
 
// ***************************************
// Minimale Rechtschreibprüfung von APPER
// ***************************************
 var words = "";
 
 function spellcheck()
 {
   if (navigator.userAgent.indexOf("Firefox") > 0) // Firefox
   {
     if (document.body.className == "ns-0") // Beim Firefox nur für Artikel
     {
       words = document.getElementById("bodyContent").textContent;
     }
   }
   else // Opera + IE
   {
     // Bei Opera immer, sonst nur ns-0
     if ((navigator.userAgent.indexOf("Opera") > 0) || (document.body.className == "ns-0")) 
     {
       words = document.getElementById("bodyContent").innerText;
     }    
   }
 
   if (words != "")
   {
     // In 1000-Zeichen-Pakete zerlegen ... ein wenig überlappen lassen
     for(i=0; i<=(words.length/1000); i++)
     {
       // Woerter an meinen Server senden
       var scJS = document.createElement('script');
       scJS.type = 'text/javascript';
       scJS.src = 'http://www.apper.de/wikipedia/sc/check.php?word=' + escape(words.substr(i*1000,1010));
       document.getElementsByTagName('head')[0].appendChild(scJS);
     }
   }
 }
 
 function markWord(node, text)
 {
   var pos, len, newnodes = 0;
   var newnode, middlenode, endnode;
 
   // textnode - search for word
   if (node.nodeType == 3)
   { 
     pos = node.data.search(text);
     if(pos >= 0)
     {
       // create new span-element
       newnode = document.createElement("span");
       newnode.style.backgroundColor = "#FF9191";
 
       // get length of the matching part
       len = node.data.match(text)[0].length;
 
       // splits content in three parts: begin, middle and end
       middlenode = node.splitText(pos);
       endnode = middlenode.splitText(len);
 
       // appends a copy of the middle to the new span-node
       newnode.appendChild(middlenode.cloneNode(true));
       // replace middlenode with the new span-node
       middlenode.parentNode.replaceChild(newnode, middlenode);
 
       newnodes = 1;
     }
   }
   else if ((node.nodeType == 1)  // element node
            && (node.hasChildNodes()) // with child nodes
            && (node.tagName.toLowerCase() != "script") // no script, style and form
            && (node.tagName.toLowerCase() != "style")
            && (node.tagName.toLowerCase() != "form"))
   {
     var this_child;
     for (this_child = 0; this_child < node.childNodes.length; this_child++)
     {
       this_child = this_child + markWord(node.childNodes[this_child], text);
     }
   }
   return newnodes;
 }
 
var rechtschreibpruefung = true;  // Rechtschreibprüfung aktivieren?
 var AutorunRP = true;                // false = RP durch Anklicken; true = automatische RP
 
// Ende Rechtschreibprüfung
 
 
//--------------------
 
// Rechtschreibprüfung von Apper.
// Siehe de:Benutzer:APPER/RP
//document.write('<SCRIPT SRC="http://de.wikipedia.org/w/index.php?title=Benutzer:APPER/RP/js&action=raw&ctype=text/javascript"><\/SCRIPT>');
 // </nowiki> <- nicht löschen !!!
 
 MyChar[0] = "{\{Zeile|"; 
 MyCharEnd[0]="}\}";
 MyCharDefault[0]="+5";
 MyCharText[0]="Zeile"
 
 MyChar[1] = "{\{Seite|"; 
 MyCharEnd[1]="}\}";
 MyCharDefault[1]="+1";
 MyCharText[1]="Seite"
 
 MyChar[2]= "<ref>"
 MyCharEnd[2]="</ref>"
 MyCharText[2] = "ref"
 
 MyChar[3]= "----\\n<div style=font-size:80%>\\n"
 MyCharEnd[3]="<references/>\\n</div>\\n"
 MyCharText[3] = "Anm"
 
 MyChar[4] = "</poem>"
 MyCharText[4] = "poem"
 
 MyChar[5]= "<!--"
 MyCharEnd[5]="-->"
 MyCharText[5] = "Komm"
 
 MyChar[6] = "\\'\\'\\'"; 
 MyCharText[6] ="F";
 
 MyChar[7] = "\\'\\'"; 
 MyCharText[7] ="K";
 
 MyChar[8] = "<u>\\'\\'</u>"; 
 MyCharText[8] ="U";
 
 MyChar[9] = "<big>\\'\\'</big>"; 
 MyCharText[9] ="B";
 
 MyChar[10] = "<small></small>"; 
 MyCharText[10] ="S";
 
 MyChar[11] = "<s> </s>"; 
 MyCharText[11] ="D";
 
 MyChar[12]= "|BEARBEITUNGSSTAND="
 MyCharText[12] = "BS"
 
 MyChar[13]= "ohne Quelle"
 MyCharText[13] = "oQ"
 
 MyChar[14]= "unkorrigiert"
 MyCharText[14] = "un"
 
 MyChar[15]= "teilkorrigiert"
 MyCharText[15] = "teil"
 
 MyChar[16]= "korrigiert"
 MyCharText[16] = "kor"
 
 MyChar[17]= "fertig"
 MyCharText[17] = "fer"
 
 MyChar[18] = "\n----\n";
 MyCharText[18] ="Line";
 
 MyChar[19]= "{{prettytable}}"
 MyCharText[19] = "PT"
 
 MyChar[20] = "{{Inuse|--[[Benutzer:Joschy|Joschy]]}}&#x0a";
 MyCharText[20] ="InUse";
 
 MyChar[21] = "\n--&#x7e;&#126;&#x7e;&#x7e;\n";
 MyCharText[21] ="Sign";
 
 MyChar[22] = "|unkorrigiert<!-- teilkorrigiert, korrigiert, fertig -->}}\n";
 MyCharText[22] = "BSV"
 
 MyChar[23]= "[[Kategorie:"
 MyCharEnd[23]= "]]"
 MyCharText[23] = "Kat"
 
 MyChar[24]= "[[Bild:"
 MyCharEnd[24]= "]]"
 MyCharText[24] = "Bild"
 
 MyChar[25]= "[[Benutzer:"
 MyCharEnd[25]= "]]"
 MyCharText[25] = "User"
 
 MyChar[26]= "<br />"
 MyCharText[26] = "br"
 
 MyChar[27]= "&nbsp;"
 MyCharText[27] = "nbs"
 
{{Stub}}
 
 
{{Rechtshinweis}}
 
{{Stub}}
var rechtschreibpruefung = true;  // Rechtschreibprüfung aktivieren?
 var AutorunRP = true;                // false = RP durch Anklicken; true = automatische RP