MediaWiki:Common.js: Unterschied zwischen den Versionen

Aus Shadowhelix
Zur Navigation springen Zur Suche springen
(+functions switchWeight, resetWeight)
Keine Bearbeitungszusammenfassung
Zeile 82: Zeile 82:
         if (objects[i].id == targetID) {
         if (objects[i].id == targetID) {
             if (objects[i].style.fontWeight == 'normal') {
             if (objects[i].style.fontWeight == 'normal') {
                objects[i].style.fontWeight = 'bold';
            } else {
                 objects[i].style.fontWeight = 'normal';
                 objects[i].style.fontWeight = 'normal';
            } else {
                objects[i].style.fontWeight = 'bold';
             }
             }
         }
         }

Version vom 18. Februar 2013, 12:37 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 toggleVisibilityMatch( targetClass, targetID ) {

    var objects = document.getElementsByClassName( targetClass );

    for ( var i = 0; i < objects.length; i++ ) {     

        if (objects[i].id.search(targetID) == -1) {
            objects[i].style.display = 'none';
        } else {
            objects[i].style.display = '';
        }
    }
}

function toggleWeight( targetClass, targetID ) {

    var objects = document.getElementsByClassName( targetClass );

    for ( var i = 0; i < objects.length; i++ ) {     

        if (objects[i].id != targetID) {
            objects[i].style.fontWeight = 'normal';
        } else {
            objects[i].style.fontWeight = 'bold';
        }
    }
}

function switchWeight( targetClass, targetID ) {

    var objects = document.getElementsByClassName( targetClass );

    for ( var i = 0; i < objects.length; i++ ) {

        if (objects[i].id == targetID) {
            if (objects[i].style.fontWeight == 'normal') {
                objects[i].style.fontWeight = 'bold';
            } else {
                objects[i].style.fontWeight = 'normal';
            }
        }
    }
}

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';
            }
        }
    }
}

function resetVisibility( targetClass, allVisible ) {

    var objects = document.getElementsByClassName( targetClass );

    for ( var i = 0; i < objects.length; i++ ) {     

        if (allVisible != 0) {
            objects[i].style.display = '';
        } else {
            objects[i].style.display = 'none';
        }
    }
}

function resetWeight( targetClass, allNormal ) {

    var objects = document.getElementsByClassName( targetClass );

    for ( var i = 0; i < objects.length; i++ ) {     

        if (allNormal != 0) {
            objects[i].style.fontWeight = 'normal';
        } else {
            objects[i].style.fontWeight = 'bold';
        }
    }
}

function multiCall222( func1,var11,var12,func2,var21,var22,func3,var31,var32 ) {

    window[func1](var11,var12);
    window[func2](var21,var22);
    window[func3](var31,var32);

}

function multiCall22( func1,var11,var12,func2,var21,var22 ) {

    window[func1](var11,var12);
    window[func2](var21,var22);

}

addOnloadHook( createFunctionButtons );