MediaWiki:Common.js: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
Loki (Diskussion | Beiträge) (test) |
Loki (Diskussion | Beiträge) Keine Bearbeitungszusammenfassung |
||
Zeile 53: | Zeile 53: | ||
if (objects[i].id == targetID) { | if (objects[i].id == targetID) { | ||
if (objects[i].style.display == 'none') { | if (objects[i].style.display == 'none') { | ||
objects[i].style.display = ''; | objects[i].style.display = ''; |
Version vom 21. April 2012, 17:48 Uhr
/* Das folgende JavaScript wird für alle Benutzer geladen. */ function createFunctionButtons() { var Selection = document.getElementsByClassName( "jsFunctionButton" ); for ( var i = Selection.length - 1; i >= 0 ; i-- ) { var input = Selection[i].id.split("_"); var jsFunction = input.shift(); var Button = document.createElement( "a" ); var inputString = ""; for ( var j = 0; j < input.length; j++ ) { inputString = inputString + "'"+input[j]; if (j != input.length - 1) { inputString = inputString + "',"; } else { inputString = inputString + "'"; } } Button.setAttribute( "href", "javascript:"+jsFunction+"("+inputString+")" ); Button.appendChild( Selection[i].childNodes[0] ); $(Selection[i]).replaceWith( Button ); } } function toggleVisibility( targetClass, targetID ) { var objects = document.getElementsByClassName( targetClass ); for ( var i = 0; i < objects.length; i++ ) { if (objects[i].id != targetID) { objects[i].style.display = 'none'; } else { objects[i].style.display = ''; } } } function switchVisibility( targetClass, targetID ) { var objects = document.getElementsByClassName( targetClass ); for ( var i = 0; i < objects.length; i++ ) { if (objects[i].id == targetID) { if (objects[i].style.display == 'none') { objects[i].style.display = ''; } else { objects[i].style.display = 'none'; } } } } addOnloadHook( createFunctionButtons );