MediaWiki:Common.js

Aus Truth-Quark

Wechseln zu: Navigation, Suche

Hinweis - Leere nach dem Speichern den Browser-Cache, um die Änderungen sehen zu können: Mozilla/Firefox/Safari: Shift gedrückt halten und auf Aktualisieren klicken oder alternativ entweder Strg-F5 oder Strg-R (Befehlstaste-R bei Macintosh) drücken; Konqueror: Auf Aktualisieren klicken oder F5 drücken; Opera: Cache unter Extras → Einstellungen leeren; Internet Explorer: Strg-F5 drücken oder Strg gedrückt halten und dabei Aktualisieren anklicken.

/** Extra toolbar options ******************************************************
  *
  *  Description: UNDOCUMENTED
  *  Maintainers: [[User:MarkS]]?, [[User:Voice of All]], [[User:R. Koot]]
  */
 
 //This is a modified copy of a script by User:MarkS for extra features added by User:Voice of All.
 // This is based on the original code on Wikipedia:Tools/Editing tools
 // To disable this script, add <code>mwCustomEditButtons = [];<code> to [[Special:Mypage/monobook.js]]
 
 if (mwCustomEditButtons) {
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/commons/c/c8/Button_redirect.png",
     "speedTip": "Umleitung",
     "tagOpen": "#REDIRECT [[",
     "tagClose": "]]",
     "sampleText": "Dein Text"};
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/commons/c/c9/Button_strike.png",
     "speedTip": "Durchstreichen",
     "tagOpen": "<s>",
     "tagClose": "</s>",
     "sampleText": "Dein durchgestrichener Text"};
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/commons/1/13/Button_enter.png",
     "speedTip": "Umbruch",
     "tagOpen": "<br />",
     "tagClose": "",
     "sampleText": ""};
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/commons/9/99/Button_sup_2.png",
     "speedTip": "Hochgestellt",
     "tagOpen": "<sup>",
     "tagClose": "</sup>",
     "sampleText": "Dein Text"};
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/commons/e/e5/Button_sub_2.png",
     "speedTip": "Tiefgestellt",
     "tagOpen": "<sub>",
     "tagClose": "</sub>",
     "sampleText": "Dein Text"};
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/commons/5/58/Button_small.png",
     "speedTip": "Klein",
     "tagOpen": "<small>",
     "tagClose": "</small>",
     "sampleText": "Dein Text"};
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/commons/5/56/Button_big.png",
     "speedTip": "Groß",
     "tagOpen": "<big>",
     "tagClose": "</big>",
     "sampleText": "Dein Text"};
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/commons/5/5f/Button_center.png",
     "speedTip": "Zentriert",
     "tagOpen": "<center>",
     "tagClose": "</center>",
     "sampleText": "Dein Text"};
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/commons/f/f0/Btn_infotexto.png",
     "speedTip": "Versteckter Kommentar",
     "tagOpen": "{{g}}!--",
     "tagClose": "-->",
     "sampleText": "Dein Text"};
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/commons/1/12/Button_gallery.png",
     "speedTip": "Insert a picture gallery",
     "tagOpen": "\n<gallery>\n",
     "tagClose": "\n</gallery>",
     "sampleText": "Image:Example.jpg|Caption1\nImage:Example.jpg|Caption2"};
 
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/commons/f/fd/Button_blockquote.png",
     "speedTip": "Textblock",
     "tagOpen": "<blockquote>",
     "tagClose": "</blockquote>",
     "sampleText": "Text"};
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/commons/0/04/Button_array.png",
     "speedTip": "Tabelle",
     "tagOpen": '{| class="wikitable"\n|-\n',
     "tagClose": "\n|}",
     "sampleText": "! header 1\n! header 2\n! header 3\n|-\n| row 1, cell 1\n| row 1, cell 2\n| row 1, cell 3\n|-\n| row 2, cell 1\n| row 2, cell 2\n| row 2, cell 3"};
 
 
 mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://truth-quark.de/w/images/0/0f/Jsxgraph.png",
     "speedTip": "Funktion erstellen",
     "tagOpen": "{{g}}wikiplot height='150' width='150' caption='Funktion' xspan='-10;10' yspan='-10;10'>{{g}}graph label='Graph 1'>",
     "tagClose": "</graph></wikiplot>",
     "sampleText": "DeineFunktion"};
 
 mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://truth-quark.de/w/images/7/74/Flash.png",
     "speedTip": "Flash einbinden",
     "tagOpen": "{{g}}swf src='http://truth-quark.de/w/images/",
     "tagClose": "' width='150' height='150'>",
     "sampleText": "Pfad/DeinFlash.swf"};
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://truth-quark.de/w/images/d/dd/Geogebra.png",
     "speedTip": "Geogebra einbinden",
     "tagOpen": "{{g}}ggb_applet height='150' width='150' filename='",
     "tagClose": "' />",
     "sampleText": "DeineDatei.ggb"};
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://truth-quark.de/w/images/2/26/Java.png",
     "speedTip": "Java-Applet einbinden",
     "tagOpen": "<java_applet code='DeineDatei.class'  height='150' width='150' archive='",
     "tagClose": "' />",
     "sampleText": "DeineDatei.jar"};
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/commons/7/77/Button_Nuvola_apps_edu_phi.png",
     "speedTip": "Formel-Applet einbinden",
     "tagOpen": "<formelapplet width='150' height='150' term='",
     "tagClose": "' />",
     "sampleText": "Code oder DeineDatei.fas"};
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://truth-quark.de/w/images/a/af/Geshi.png",
     "speedTip": "Syntax färben",
     "tagOpen": "<source lang='codesprache'>",
     "tagClose": "</source>",
     "sampleText": "Code"};
 
 }
 
//================================================================================
//*** Dynamic Navigation Bars
 
// set up the words in your language
var NavigationBarHide = 'Einklappen';
var NavigationBarShow = 'Ausklappen';
 
// set up max count of Navigation Bars on page,
// if there are more, all will be hidden
// NavigationBarShowDefault = 0; // all bars will be hidden
// NavigationBarShowDefault = 1; // on pages with more than 1 bar all bars will be hidden
if (typeof NavigationBarShowDefault == 'undefined' ) {
    var NavigationBarShowDefault = 1;
}
 
// adds show/hide-button to navigation bars
addOnloadHook(function() {
	// shows and hides content and picture (if available) of navigation bars
	// Parameters:
	//     indexNavigationBar: the index of navigation bar to be toggled
	function toggleNavigationBar(indexNavigationBar)
	{
	   var NavToggle = document.getElementById("NavToggle" + indexNavigationBar);
	   var NavFrame = document.getElementById("NavFrame" + indexNavigationBar);
 
	   if (!NavFrame || !NavToggle) {
		   return false;
	   }
 
	   // if shown now
	   if (NavToggle.firstChild.data == NavigationBarHide) {
		   for (
				   var NavChild = NavFrame.firstChild;
				   NavChild != null;
				   NavChild = NavChild.nextSibling
			   ) {
			   if (NavChild.className == 'NavPic') {
				   NavChild.style.display = 'none';
			   }
			   if (NavChild.className == 'NavContent') {
				   NavChild.style.display = 'none';
			   }
			   if (NavChild.className == 'NavToggle') {
				   NavChild.firstChild.data = NavigationBarShow;
			   }
		   }
 
	   // if hidden now
	   } else if (NavToggle.firstChild.data == NavigationBarShow) {
		   for (
				   var NavChild = NavFrame.firstChild;
				   NavChild != null;
				   NavChild = NavChild.nextSibling
			   ) {
			   if (NavChild.className == 'NavPic') {
				   NavChild.style.display = 'block';
			   }
			   if (NavChild.className == 'NavContent') {
				   NavChild.style.display = 'block';
			   }
			   if (NavChild.className == 'NavToggle') {
				   NavChild.firstChild.data = NavigationBarHide;
			   }
		   }
	   }
	}
 
	function toggleNavigationBarFunction(indexNavigationBar) {
		return function() {
			toggleNavigationBar(indexNavigationBar);
			return false;
		};
	}
 
   var indexNavigationBar = 0;
   // iterate over all < div >-elements
   var divs = document.getElementsByTagName("div");
   for (var i=0;  i<divs.length; i++) {
       var NavFrame = divs[i];
       // if found a navigation bar
       if (NavFrame.className == "NavFrame") {
 
           indexNavigationBar++;
           var NavToggle = document.createElement("a");
           NavToggle.className = 'NavToggle';
           NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar);
           NavToggle.setAttribute('href', '#');
		   NavToggle.onclick = toggleNavigationBarFunction(indexNavigationBar);
 
           var NavToggleText = document.createTextNode(NavigationBarHide);
           NavToggle.appendChild(NavToggleText);
 
           // add NavToggle-Button as first div-element
           // in < div class="NavFrame" >
           NavFrame.insertBefore(
               NavToggle,
               NavFrame.firstChild
           );
           NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar);
       }
   }
   // if more Navigation Bars found than Default: hide all
   if (NavigationBarShowDefault < indexNavigationBar) {
       for(
               var i=1;
               i<=indexNavigationBar;
               i++
       ) {
           toggleNavigationBar(i);
       }
   }
});
 
//================================================================================