MediaWiki:Monobook.js

Izvor: Wikicitati
Jump to navigation Jump to search

Pažnja: Nakon što sačuvate izmjene, morate "osvježiti" keš memoriju vašeg pretraživača da bi ste vidjeli nova podešenja: Mozilla / Safari / Konqueror: držite Shift tipku i kliknite na Reload dugme (ili Ctrl-Shift-R); IE / Opera: pritisnite Ctrl-F5 na tipkovnici.

/* </pre>
==LinkFA==
<pre> */
function LinkFA() {
   // iterate over all <span>-elements
   for(var i=0; a = document.getElementsByTagName("span")[i]; i++) {
      // if found a FA span
      if(a.className == "FA") {
         // iterate over all <li>-elements
         for(var j=0; b = document.getElementsByTagName("li")[j]; j++) {
            // if found a FA link
            if(b.className == "interwiki-" + a.id) {
               b.style.padding = "0 0 0 16px";
               b.style.backgroundImage = "url('//upload.wikimedia.org/wikipedia/en/6/60/LinkFA-star.png')";
               b.style.backgroundRepeat = "no-repeat";
               b.title = "Odabrani članak";
            }
         }
      }
   }
}

/* </pre>
==Dynamic Navigation bars==
<pre> */
 // ============================================================
 // BEGIN Dynamic Navigation Bars (experimantal)
 
 // set up the words in your language
 var NavigationBarHide = ' Sakrij ';
 var NavigationBarShow = ' Pokaži ';
 
 // 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
 var NavigationBarShowDefault = 1;
 
 
 // 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;
                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;
                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;
            }
        }
    }
} 


/* </pre>
===Show/hide Dyn Navigation bars===
<pre> */

// adds show/hide-button to navigation bars
function createNavigationBarToggleButton() {
    var indexNavigationBar = 0;
    // iterate over all < div >-elements
    for(
            var i=0; 
            NavFrame = document.getElementsByTagName("div")[i]; 
            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', 'javascript:toggleNavigationBar(' + 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);
        }
    }
 
}
  
 // END Dynamic Navigation Bars
 // ============================================================




/* </pre>
==Page Numbering==
<pre> */
 //default setting, may be overridden by user
 var DisplayPageNumbersDefault = true;

 CookieDisplayPageNumbers = $.cookie("DisplayPageNumbers")
 if (CookieDisplayPageNumbers ) {
   if (CookieDisplayPageNumbers == "false") DisplayPageNumbersDefault = false;
 }
 

/* </pre>
===PageNumbers===
<pre> */
function PageNumbers() {
   var indexNavigationBar = 0;
   // iterate over all < span >-elements until class "PageNumber" is found
   for(
           var i=0; 
           SpanElem = document.getElementsByTagName("span")[i]; 
           i++
       ) {
       // if found a page number
       if (SpanElem.className == "PageNumber") {
          SpanElem.style.display = 'none';
          var PageDisplay = document.createElement("li");
          PageDisplay.setAttribute('id', 't-pagenumberdisplay');
          var PageDisplayLink = document.createElement("a");

          PageNumberText = document.createTextNode("");
          PageDisplayLink.appendChild(PageNumberText);
          PageDisplay.appendChild(PageDisplayLink);

          var SpecialPageLink = document.getElementById("t-specialpages");
          SpecialPageLink.parentNode.appendChild(PageDisplay);
          displayPageNumbers(DisplayPageNumbersDefault);
          break;
       }
   }
 }


/* </pre>
===displayPageNumbers===
<pre> */
function displayPageNumbers(bool) {  
  $.cookie("DisplayPageNumbers",bool);
  var PageDisplayLink =  document.getElementById("t-pagenumberdisplay").firstChild;;

   // iterate over all < span >-elements
   for(
           var i=0; 
           SpanElem = document.getElementsByTagName("span")[i]; 
           i++
       ) {
        // if found a page number
        if (SpanElem.className == "PageNumber") {
          // if page number shall be displayed
          if(bool==true && SpanElem.style.display=='none') {
            SpanElem.style.display = 'inline';
            //SpanElem.style.color = '#000000';
            //SpanElem.style.fontWeight = 'bold';
            PageDisplayLink.firstChild.data = ("Seitenzahlen ausblenden");
            PageDisplayLink.setAttribute('href', 'javascript:displayPageNumbers(!DisplayPageNumbersDefault);');
          }
          // if page number shall be hidden
          if(bool==false) {
            SpanElem.style.display = 'none';
            PageDisplayLink.firstChild.data = ("Seitenzahlen einblenden");
            PageDisplayLink.setAttribute('href', 'javascript:displayPageNumbers(!DisplayPageNumbersDefault);');

         }
      }
   }
 DisplayPageNumbersDefault = bool;
 }


/* </pre>
==Annotations==
<pre> */

 //default setting, may be overridden by user
 var DisplayAnnotationsDefault = true;

function Annotations() {
   var indexNavigationBar = 0;
   // iterate over all < span >-elements until class "Annotation" is found
   for(
           var i=0; 
           SpanElem = document.getElementsByTagName("span")[i]; 
           i++
       ) {
       // if found a annotation
       if (SpanElem.className == "Annotation") {
          SpanElem.style.display = 'none';
          var AnnotationDisplay = document.createElement("li");
          AnnotationDisplay.setAttribute('id', 't-annotationdisplay');
          var AnnotationDisplayLink = document.createElement("a");

          AnnotationText = document.createTextNode("");
          AnnotationDisplayLink.appendChild(AnnotationText);
          AnnotationDisplay.appendChild(AnnotationDisplayLink);

          var SpecialPageLink = document.getElementById("t-specialpages");
          SpecialPageLink.parentNode.appendChild(AnnotationDisplay);
          displayAnnotations(DisplayAnnotationsDefault);
          break;
       }
   }
}



/* </pre>
===displayAnnotations===
<pre> */

function displayAnnotations(bool) {

  var AnnotationDisplayLink =  document.getElementById("t-annotationdisplay").firstChild;;

   // iterate over all < span >-elements
   for(
           var i=0; 
           SpanElem = document.getElementsByTagName("span")[i]; 
           i++
       ) {
        // if found a page number
        if (SpanElem.className == "Annotation") {
          // if page number shall be displayed
          if(bool==true) {
            SpanElem.style.display = 'inline';
            AnnotationDisplayLink.firstChild.data = ("Anmerkungen ausblenden");
            AnnotationDisplayLink.setAttribute('href', 'javascript:displayAnnotations(!DisplayAnnotationsDefault);');
          }
          // if page number shall be hidden
          if(bool==false) {
            SpanElem.style.display = 'none';
            AnnotationDisplayLink.firstChild.data = ("Anmerkungen einblenden");
            AnnotationDisplayLink.setAttribute('href', 'javascript:displayAnnotations(!DisplayAnnotationsDefault);');

         }        
      }
   }
 DisplayAnnotationsDefault = bool;
}




/* </pre>
==LineBreaks==
<pre> */

 //default setting, may be overridden by user
 var DisplayLineBreaksDefault = true;

function LineBreaks() {
   var indexNavigationBar = 0;
   // iterate over all < span >-elements until class "LineBreak" is found
   for(
           var i=0; 
           SpanElem = document.getElementsByTagName("span")[i]; 
           i++
       ) {
       // if found a lbr
       if (SpanElem.className == "LineBreak") {
          SpanElem.style.display = 'none';
          var LineBreakDisplay = document.createElement("li");
          LineBreakDisplay.setAttribute('id', 't-linebreakdisplay');
          var LineBreakDisplayLink = document.createElement("a");

          LineBreakText = document.createTextNode("");
          LineBreakDisplayLink.appendChild(LineBreakText);
          LineBreakDisplay.appendChild(LineBreakDisplayLink);

          var SpecialPageLink = document.getElementById("t-specialpages");
          SpecialPageLink.parentNode.appendChild(LineBreakDisplay);
          displayLineBreaks(DisplayLineBreaksDefault);
          break;
       }
   }
}



/* </pre>
===displayLineBreaks===
<pre> */

function displayLineBreaks(bool) {

  var LineBreakDisplayLink =  document.getElementById("t-linebreakdisplay").firstChild;;

   // iterate over all < span >-elements
   for(
           var i=0; 
           SpanElem = document.getElementsByTagName("span")[i]; 
           i++
       ) {
        // if found a page number
        if (SpanElem.className == "LineBreak") {
          // if page number shall be displayed
          if(bool==true) {
            SpanElem.style.display = 'inline';
            LineBreakDisplayLink.firstChild.data = ("Zeilenumbrüche ausblenden");
            LineBreakDisplayLink.setAttribute('href', 'javascript:displayLineBreaks(!DisplayLineBreaksDefault);');
          }
          // if lbr shall be hidden
          if(bool==false) {
            SpanElem.style.display = 'none';
            LineBreakDisplayLink.firstChild.data = ("Zeilenumbrüche einblenden");
            LineBreakDisplayLink.setAttribute('href', 'javascript:displayLineBreaks(!DisplayLineBreaksDefault);');

         }        
      }
   }
 DisplayLineBreaksDefault = bool;
}






/* </pre>
==interwikiExtra==
<pre> */

function interwikiExtra() {
   // iterate over all <span>-elements
   for(var i=0; a = document.getElementsByTagName("span")[i]; i++) {
      // if found a linkInfo span
      if(a.className == "interwiki-info") {
         // iterate over all <li>-elements
         var count=0;
         
         for(var j=0; b = document.getElementsByTagName("li")[j]; j++) {
            if(b.className == "interwiki-" + a.id) {
               b.innerHTML = b.innerHTML + " "+a.title;
               if(a.title == "(OV)") { b.title = "Originaltext"; }
            }
         else if(b.className == "interwiki-" + a.id.substr(0,a.id.length-1)) {
               count = count+1;
               if(a.id.charAt(a.id.length-1) == count) {
                  b.innerHTML = b.innerHTML + " "+a.title;
               }
            }
         }
      }
      if(a.className == "AndereVersion") {
         p = a.title.indexOf("|");
         pvers = document.getElementById("p-version");
         if (pvers == null) {
           c = document.getElementById("column-one");
           c.innerHTML = c.innerHTML
             + "<div class=\"portlet\" id=\"p-version\">"
             + "<h5>Andere Versionen</h5>"
             + "<div class=\"pBody\">"
             + "<ul>"
             + "</ul>"
             + "</div>";
             pvers = document.getElementById("p-version");
           }
           e = pvers.getElementsByTagName("ul")[0]; 
           e.innerHTML = e.innerHTML 
             + "<li class=\"\"><a href='" 
             + a.title.substr(0,p)
             + "'>" + a.title.substr(p+1,a.title.length-1)+ "</a> " +"</li>"
      }

      if(a.className == "AnderesFormat") {
         p = a.title.indexOf("|");
         pvers = document.getElementById("p-format");
         if (pvers == null) {
           c = document.getElementById("column-one");
           c.innerHTML = c.innerHTML
             + "<div class=\"portlet\" id=\"p-format\">"
             + "<h5>Andere Formate</h5>"
             + "<div class=\"pBody\">"
             + "<ul>"
             + "</ul>"
             + "</div>";
             pvers = document.getElementById("p-format");
           }
           e = pvers.getElementsByTagName("ul")[0]; 
           e.innerHTML = e.innerHTML 
             + "<li class=\"\"><a href=':" 
             + a.title.substr(0,p)
             + "'>" + a.title.substr(p+1,a.title.length-1)+ "</a> " +"</li>"
      }

   }
}



/* </pre>
==BilingualLink==
<pre> */

function BilingualLink() {
     if( document.body.className.substring(0,4) != "ns-0" ) return;
     var doc_url = document.URL;
     var url = '';
     // iterate over all <li>-elements
     for(var j=0; b = document.getElementsByTagName("li")[j]; j++) {
          if(b.className.substring(0,10) == "interwiki-" ) {
                var lang = b.className.substring(10,b.className.length);
                if( doc_url.indexOf('?title=') != -1 ) { 
                    var qm  = doc_url.indexOf('&match=');
                    if( qm != -1 ) url = doc_url.substring(0,qm)+"&match="+lang;
                    else url = doc_url+"&match="+lang;
                } else {
                    var qm  = doc_url.indexOf('?');
                    if( qm != -1 ) url = doc_url.substring(0,qm)+"?match="+lang;
                    else url = doc_url+"?match="+lang;
                }
                b.innerHTML = b.innerHTML+
                "<a href='"+url+"'> ⇔</a>";
              }
          }
}





/* </pre>
==ProofReadLink==
<pre> */

function ProofReadLink () {

	// iterate over all < span >-elements until class "ProofRead" is found
	for(
		var i=0; 
		SpanElem = document.getElementsByTagName("span")[i]; 
		i++
	) {
		// if found a page number
		if (SpanElem.className == "ProofRead") {

			ImageSrc=SpanElem.title;

			var ProofReadTab = document.createElement("li");
			ProofReadTab.setAttribute('id', 'ca-proofread');
			var ProofReadTabLink = document.createElement("a");
			ProofReadTabLink.href=document.getElementById("ca-edit").firstChild.href + "&image="+ImageSrc;
			ProofReadTabText = document.createTextNode("Korrekturlesen");
			ProofReadTabLink.appendChild(ProofReadTabText);
			ProofReadTab.appendChild(ProofReadTabLink);

			var VersionLink = document.getElementById("ca-history");
			VersionLink.parentNode.appendChild(ProofReadTab);
			break;
		}
	}
}




/* </pre>
==Only If Editing==
<pre> */

 //Vordefinition für eigene Sonderzeichenleiste
 MyChar = new Array();
 MyCharText = new Array();
 MyCharEnd = new Array();
 MyCharDefault = new Array();


 //Im Bearbeitungsmodus?
 var isEditing = document.URL.indexOf("action=edit") > 0 || document.URL.indexOf("action=submit") > 0;

// ============================================================
 // BEGIN import Onlyifediting-functions (z.B. für Dropdown-Leiste zum Einfügen von Sonderzeichen)


 // Optionen für das Sonderzeichenmenü in [[MediaWiki:Edittools]]
 // wird in [[MediaWiki:Monobook.js]] ganz unten eingebunden
 
 // Diese Variablen können in den Benutzer-Javascripts angepasst werden




/* </pre>
===addEditButton===
<pre> */

// @deprecated since 2013 Use mw.toolbar.addButton instead
function addEditButton(){
}

/* </pre>

===bsImprovedToolbar===
<pre> */

//============================================================
// Insertion de nouveaux boutons dans la barre d'outil
//============================================================

/**
 * Ajoute quelques boutons sur la barre d'outil
 * Inspiré de mon code précédent et des icônes sur he:
 * @author: fr:user:dake
 * @version: 0.1
 */
function bsImprovedToolbar()
{
 tooly = document.getElementById('toolbar');
 if ( (!tooly) ) return;


 var buttonAB = document.createElement("img");
	buttonAB.width = 23;
	buttonAB.height = 22;
	buttonAB.src = '//upload.wikimedia.org/wikipedia/commons/5/59/Button_replace.png';
	buttonAB.border = 0;
	buttonAB.alt = 'Zamjeni tekst';
	buttonAB.title = 'Zamjeni Tekst'
	buttonAB.style.cursor = "pointer";
	buttonAB.onclick = function() {
		stringReplaceBox();
		return false;
	}

  tooly.appendChild(buttonAB);

}


 $(document).ready(bsImprovedToolbar);






/* </pre>
===InsertTagsValue===
<pre> */

 //Autoinkrement-Tags
 function insertTagsValue(uchar, ucharend, uchardefault, ucharnr) {
 
	var txtarea = document.editform.wpTextbox1;
 
	// IE
	if (document.selection) {
		var theSelection = document.selection.createRange().text;
 
	// Mozilla
	} else if(txtarea.selectionStart || txtarea.selectionStart == '0') {
		var replaced = false;
		var startPos = txtarea.selectionStart;
		var endPos = txtarea.selectionEnd;
		if (endPos-startPos)
			replaced = true;
		var scrollTop = txtarea.scrollTop;
		var theSelection = (txtarea.value).substring(startPos, endPos);
	}
	
	if (theSelection == "") {

		if(!(lastVal = $.cookie("CharDefaultValue-"+ ucharnr))) lastVal ="0";
		theSelection= parseInt(lastVal)+parseInt(uchardefault.substr(1));
		theSelection= theSelection.toString();
	}
 
	$.cookie("CharDefaultValue-"+ ucharnr,theSelection);
	insertTags(uchar,ucharend,theSelection);
 }




/* </pre>
===stringReplaceBox===
<pre> */

 function stringReplaceBox() {

	Valreplace=$.cookie("StrReplace");
	Valreplacement=$.cookie("StrReplacement");
	if (Valreplace && Valreplacement) {
		//Anführungszeichen ersetzen
		Valreplace=Valreplace.replace(/"/g,"&#34;");
		Valreplacement=Valreplacement.replace(/"/g,"&#34;");
	} else {
		Valreplace="";
		Valreplacement="";
	}

	PromptWin = window.open("about:blank", "PromptWin", "width=280,height=120,dependent=yes,location=no,menubar=no,resizable=yes,status=no,toolbar=no");
	PromptWin.focus();

	PromptWin.document.open();
	PromptWin.document.write("<title>Text ersetzen</title>");
	PromptWin.document.write("<body style=\"background-color: threedface;\">");
	PromptWin.document.write("<form id=\"replaceform\" name=\"replaceform\" method=POST action=\"javascript:void(0)\">");
	PromptWin.document.write("<center><table border=\"0\">");
	PromptWin.document.write("<tr><td style=\"font: message-box\">zamjeni:</td> <td><input type=TEXT name=\"valreplace\" value=\"" + Valreplace + "\" size=25 tabindex=\"1\"></td></tr>");
	PromptWin.document.write("<tr><td style=\"font: message-box\">sa:</td> <td><input type=TEXT name=\"valreplacement\" value=\"" + Valreplacement + "\" size=25 tabindex=\"2\"></td></tr></table>");
	PromptWin.document.write("<p><input type=SUBMIT value=\"&nbsp;Zamjeni&nbsp;\" tabindex=\"3\" onclick=\"opener.stringReplace(document.replaceform.valreplace.value,document.replaceform.valreplacement.value); self.close()\"> ");
	PromptWin.document.write("<input type=RESET value=\"Poništi\" tabindex=\"4\" onclick=\"self.close()\"></p>");
	PromptWin.document.write("</center></form></body>");
	PromptWin.document.close();
	PromptWin.document.replaceform.valreplace.select();
 }

 

 function stringReplace(inReplace,inReplacement) {

	$.cookie("StrReplace",inReplace);
	$.cookie("StrReplacement",inReplacement);
	var StrReplace = new RegExp(inReplace, "g");
	var StrReplacement=inReplacement;

	if (document.editform)
		var txtarea = document.editform.wpTextbox1;
	else {
		// some alternate form? take the first one we can find
		var areas = document.getElementsByTagName('textarea');
		var txtarea = areas[0];
	}
	txtarea.value=txtarea.value.replace(StrReplace,StrReplacement);
 }


/* </pre>
===ProofReading===
<pre> */


 //Height of ProofReadDiv
 var DivHeight=0;

 function ProofReading () {

	if (window.location.search.indexOf("image=") != -1) {
		var ImageString = window.location.search.substring(window.location.search.indexOf("image=")+6,window.location.search.length);

		if (ImageString != "") {
			TextBoxRows= document.getElementsByName("wpTextbox1")[0].getAttribute('rows');
			TextBoxRows=Math.ceil(TextBoxRows/2);
			document.getElementsByName("wpTextbox1")[0].setAttribute('rows',TextBoxRows);


			var ImageFrame = "<div id=\"ImageFrame\">" + ImageFrameContent(ImageString) + "</div>";
			document.getElementById("contentSub").innerHTML += ImageFrame
		}
	}
 }



/* </pre>
====ImageFrameContent====
<pre> */

 function ImageFrameContent(ImageString) {
	if (DivHeight == 0) {
		if(document.selection) {
		//IE: 
			DivHeight=Math.ceil(document.body.clientHeight*0.5)+"px";
			} else {
		//andere: 
			DivHeight=Math.ceil(window.innerHeight*0.4)+"px";
		}
	}
 
	var ZoomInIcon = "<a href=\"javascript:Zoom(50)\"><img src=\"//upload.wikimedia.org/wikipedia/commons/4/48/Magnifier_zoom_in.png\" title=\"vergrö&szlig;ern\" width=24 height=24></a>";
	var ZoomOutIcon = "<a href=\"javascript:Zoom(-50)\"><img src=\"//upload.wikimedia.org/wikipedia/commons/9/92/Magifier_zoom_out.png\" title=\"verkleinern\" width=24 height=24></a>";
	var ZoomStdIcon = "<a href=\"javascript:Zoom(0)\"><img src=\"//upload.wikimedia.org/wikipedia/commons/7/79/Magnifier.png\" title=\"Fensterbreite\" width=24 height=24></a>";
 
	var ImageFrame = ZoomOutIcon + " " + ZoomStdIcon + " " + ZoomInIcon;
 
	var ImageApp = /\.png$|\.jpeg$|\.jpg$|\.gif$/;
	if (ImageApp.test(ImageString) == true) {
		ImageFrame += "<div style=\"overflow: scroll; height: " + DivHeight + "; width: 100%;\">";
		ImageFrame += "<img onerror=\"ImageError('"+ ImageString+"')\" id=\"ProofReadImage\" src=\""+ GetImageUrl(ImageString) +"\" alt=\""+ GetImageUrl(ImageString) +"\"";
		if ($.cookie("PrImageWidth")) {
			ImageFrame +="width = \"" + $.cookie("PrImageWidth") +"\"";
		}
		ImageFrame += "></div>";
	} else {
		ImageFrame += "<iframe id=\"ProofReadImage\" src=\""+ GetImageUrl(ImageString) +"\" style=\"height: " + DivHeight + "; width: 100%;\">";
	}
 return ImageFrame
 }



/* </pre>
====GetImageUrl====
<pre> */

 function GetImageUrl(name) {
 var retval = name;
 if (name.indexOf("http:") != 0) retval = "index.php/Special:Filepath/" + name;
 return retval;
 }

 function ImageError(imagename) {

	if (document.getElementById("ProofReadImage").src.indexOf("commons") == -1 && document.getElementById("ProofReadImage").src.indexOf("Special:Filepath") != -1) {
	//image not from commons
		document.getElementById("ProofReadImage").src = "//commons.wikimedia.org/wiki/Special:Filepath/" + imagename;
	}

 }

 function Zoom(value) {
	PrImage = document.getElementById("ProofReadImage");
 
	if (value == 0) PrImage.width = document.getElementById("ImageFrame").offsetWidth-15;
	else PrImage.width=PrImage.width+value;
	$.cookie("PrImageWidth",PrImage.width);
	if(document.selection) {
		//IE: 
		document.getElementById("ImageFrame").innerHTML = ImageFrameContent(PrImage.src);
	}

 }


/* </pre>
===chooseCharSubset===
<pre> */

 // CharSubset-Auswahl
 function chooseCharSubset(ss) {
    s = parseInt( ss );
    if ( isNaN(s) ) s = 0;
	if (SpecCharsAccesskeys.length==0) {
		SpecCharsAccesskeys = new Array("1","2","3","4","5","6","7","8","9","0","!","\"","§","$","%","&","/","(",")","=");
	}
	if (s>=0) {
		var l = document.getElementById('editpage-specialchars').getElementsByTagName('p');
		for (var i = 0; i < l.length ; i++) {
			if (i==s) {
				l[i].style.display = 'inline';  
				SetArrayAccessKeys(l[i].getElementsByTagName('a'),SpecCharsAccesskeys);
			} else l[i].style.display =  'none';
		}
	  $.cookie('CharSubset', s);
	} 
 }

/* </pre>

===SetArrayAccessKeys===
<pre> */

// Ein Array von Accesskeys an ein Array von Elementen
 function SetArrayAccessKeys(elements, keys) {
 	for (var i =0; i < elements.length;i++) {
		if (i < keys.length) {
			elements[i].setAttribute("accessKey",keys[i]);
			elements[i].setAttribute("title","alt-"+keys[i]);
		} else {
			elements[i].setAttribute("accessKey","");
			elements[i].setAttribute("title","");
		}
	}
 }





/* </pre>
===AddMyChars===
<pre> */

 //Vorfunktion für eigene Sonderzeichenleiste, nutzt globale Variablen
 function AddMyChars() {
  if (MyChar[0]) AddMyCharsDo(MyChar, MyCharEnd, MyCharText, MyCharDefault);
 }

 //Eigene Sonderzeichenliste
 function AddMyCharsDo(thechar, thecharend, thechartext, thechardefault) {
	var specialcharslist = document.getElementById('specialchars');
 
	var addtext = "<p class=\"specialbasic\" id=\"Eigene\" title=\"Eigene\" style=\"display: none;\">\n\r";
	addtext += "Eigene Zeichen:\n\r";
	addtext += "<font style=\"text-decoration: none;\" face=\"Arial Unicode MS,Lucida Sans Unicode,MS Mincho,Arial,sans-serif\">";
  
	for (var i = 0; i < thechar.length; i++) {
		if (!thecharend[i]) thecharend[i]="";
		if (!thechardefault[i]) thechardefault[i]="";
		jsfunction ="insertTags('" + thechar[i] + "','" + thecharend[i] + "','" +  thechardefault[i] +"')";
		//Autoinkrement-Funktion einsetzen
		if (thechardefault[i][0] == "+" && !isNaN(parseInt(thechardefault[i].substr(1)))) {
			jsfunction = "insertTagsValue('" + thechar[i] + "','" + thecharend[i] + "','" +  thechardefault[i] + "','" + i +"')";
		}
		if (!thechartext[i]) thechartext[i] = thechar[i]+" "+thecharend[i];
		addtext += "<a href=\"javascript:" +jsfunction +"\">" + thechartext[i] + "</a>\n\r";
	}
	addtext += "</font></p>";
	specialcharslist.innerHTML = addtext+specialcharslist.innerHTML;
 }





/* </pre>
===addCharSubsetMenu===
<pre> */

/*
DANGER-MOUSE NOTE: This code is <<<VERY>>> sensitive to [[MediaWiki:Edittools]] changes!  Make sure there are no <span>s only <div>s.  Make sure there is no <p></p> at top!
*/

 SpecCharsAccesskeys = new Array();

// Combined cross-browser features of [[:zh:MediaWiki:Monobook.js]]...
function addCharSubsetMenu() {
         var SpecCharsMove = true;
	 var edittools = document.getElementById('editpage-specialchars');
	 if (edittools) {
		 var name;
		 var menu=document.createElement("select");
		 menu.style.display="inline";
		 var line = edittools.getElementsByTagName('p');
		 for (var i = 0; i < line.length ; i++) {
			if (line[i].className == "specialbasic" || line[i].className == "speciallang") {
			 if (line[i].title) name=line[i].title;
			 else name = line[i].id;
			 menu.options[menu.options.length]=new Option(name);
			}
		 }

		 menu.onchange=function() {chooseCharSubset(this.selectedIndex);} ;
		if (SpecCharsMove) {
		 edittools.insertBefore(menu,edittools.firstChild);
		} else {
		 edittools.insertAfter(menu,edittools.firstChild);
		}

		var stdsubset = 0;
		if ($.cookie("CharSubset")) stdsubset = parseInt( $.cookie("CharSubset") );
		if ( isNaN(stdsubset) ) stdsubset = 0;
		menu.options[stdsubset].selected = true;
		chooseCharSubset(stdsubset);

	//Gleicher Tabindex für alle Elemente der Toolbar
	var charlinks = document.getElementById('toolbar').getElementsByTagName('a');
	for (var i=0; i < charlinks.length; i++) {
		charlinks[i].setAttribute("tabindex",8);
	}
      } //end if (edittools)
 }

/* </pre>

===elementMoveto===
<pre> */

 //from [[:zh:MediaWiki:Monobook.js]]
 function elementMoveto(node, refNode, pos) {
	 if(node && refNode) {
		 var parent = refNode.parentNode;
		 if (pos && pos == 'after') refNode=refNode.nextSibling;
		 try {
		     parent.insertBefore(node, refNode);
		 } catch (DOMException) {};
	 }
 }



/* </pre>
===fixToolbar===
<pre> */

 //from [[:zh:MediaWiki:Monobook.js]]
 function fixToolbar(){
	 var wpEditToolbar = document.getElementById("toolbar");
	 var dropdownListEditTools = document.getElementById("dropdownListEditTools");
	 elementMoveto(dropdownListEditTools , wpEditToolbar , 'after' );
	 if (dropdownListEditTools) dropdownListEditTools.style.display="block";
	 var editspecialchars = document.getElementById("editpage-specialchars");
	 elementMoveto( editspecialchars, wpEditToolbar, 'after' ); 	 
 }




/* </pre>
===customizeWiktionary===
<pre>  */

 // Menü-Einfügung
 function customizeWiktionary() {
	AddMyChars();
	addCharSubsetMenu();
        fixToolbar();
 }

 
 $(document).ready(customizeWiktionary);
 $(document).ready(ProofReading);

 
 // END import Onlyifediting-functions
 // ============================================================

$(document).ready( LinkFA );
$(document).ready( createNavigationBarToggleButton );
$(document).ready( interwikiExtra );
$(document).ready( BilingualLink );
$(document).ready( PageNumbers );
$(document).ready( Annotations );
$(document).ready( LineBreaks );
$(document).ready( ProofReadLink );




/* </pre>

==mainpg==
<pre> */

//Main page tab no longer says article
function mainpg() 
{
if (mw.config.get('wgIsMainPage'))
  {
      if(document.getElementById('ca-nstab-main'))
      {
      document.getElementById('ca-nstab-main').firstChild.innerHTML = 'početna strana';
      }   
  }
else if(document.title.indexOf("Početna strana") != -1)
  {
      if(document.getElementById('ca-nstab-main'))
      {
      document.getElementById('ca-nstab-main').firstChild.innerHTML = 'početna strana';
      }   
  }
}
$(document).ready(mainpg);



/* </pre>
==doRedirect==
<pre> */

/* Redirect if a case-insensitive search on an external link is found */
function doRedirect() {
  dym = document.getElementById('did-you-mean')
   if ( dym ) {
      var dymtarget = dym.firstChild.title ;
      var target = dymtarget ;
      pagetitle = document.getElementsByTagName('h1').item(0).firstChild.nodeValue;
      if (pagetitle == target) {
        alert('No looping allowed.');
        return;
      }
      if ( pagetitle.toLowerCase().replace(/[^a-z]/g, "") != target.toLowerCase().replace(/[^a-z]/g, "") ) {
        alert(target + " does not match " + pagetitle);
        return;
      }
      if ( pagetitle.search(/Editing /g) != -1 ) return;
      pagenamee = pagetitle.replace(/\ /g, "_");
   document.location.replace( '//bs.wiktionary.org/wiki/Posebno:Search/' + pagenamee ) ;
   }
}


/* </pre>
==fixEditSectionWikifiedLinks==
<pre> */

// edit-section still doesn't return to correct spot if link contains a [[wikified]] term.
function fixEditSectionWikifiedLinks() {
  if (/\.5B/.test(window.location.href)) {
   var url=window.location.href.replace(/.5B.5B:/g,"").replace(/.5B/g, "").replace(/.5D/g, "");
   window.location = url;
  }
  //removed check for 7B/7D
}



/* </pre>
==mainCustomizeWiktionary==
<pre> */

/* do any Wiktionary-specific customizations */
function mainCustomizeWiktionary() {
  doRedirect();
  fixEditSectionWikifiedLinks();
}
$(document).ready(mainCustomizeWiktionary) ;



/* </pre>
==Kill Main Page==
<pre> */

//Sakrij "Početna strana" naslov
 var mpTitle = "Početna strana";
 var isMainPage = (document.title.substr(0, document.title.lastIndexOf(" - ")) == mpTitle);
 var isDiff = (document.location.search && (document.location.search.indexOf("diff=") != -1 || document.location.search.indexOf("oldid=") != -1));

 if (isMainPage && !isDiff) mw.util.addCSS('#lastmod, #siteSub, #contentSub, h1.firstHeading { display: none !important; }');



/* </pre> */