Jump to content

MediaWiki:Common.js: Difference between revisions

final test, based on a proposed solution to this -- inserting Sysop.js code directly into Common.js; worth a try for informational purposes
(removing code that imports Sysop.js, as it breaks certain code (if not all code) past this point for sysops)
(final test, based on a proposed solution to this -- inserting Sysop.js code directly into Common.js; worth a try for informational purposes)
Line 23: Line 23:
   *  Description: Allows for sysop-specific Javascript at [[MediaWiki:Sysop.js]].
   *  Description: Allows for sysop-specific Javascript at [[MediaWiki:Sysop.js]].
   */
   */
/*function sysopFunctions() {
function sysopFunctions() {
     if ( wgUserGroups && !window.disableSysopJS ) {
     if ( wgUserGroups && !window.disableSysopJS ) {
         for ( var g = 0; g < wgUserGroups.length; ++g ) {
         for ( var g = 0; g < wgUserGroups.length; ++g ) {
             if ( wgUserGroups[g] == "sysop" ) {
             if ( wgUserGroups[g] == "sysop" ) {
                importScript("MediaWiki:Sysop.js");
                if (wgCanonicalNamespace == "Special" && wgCanonicalSpecialPageName == "Undelete") {
    (function () {
        var form            = document.forms["undelete"];
        if( !form ) {
            return;
        }
        var elements        = form.elements;
        var submitButton    = elements["mw-undelete-submit"];
        if( !submitButton ) {
            return;
        }
        var toggleButton    = document.createElement("input");
        toggleButton.type    = "button";
        toggleButton.value  = "Invert selection";
       
        toggleButton.onclick = function () {
                for( var i = 0; i < elements.length; ++i ) {
                    var input = elements[i];
                    if( input.type != "checkbox" ) {
                        continue;
                    }
                    input.checked = !input.checked;
                }
            };
        submitButton.parentNode.insertBefore( toggleButton, submitButton );
    })();
}
                 break;
                 break;
             }
             }
         }
         }
     }
     }
}*/ // this code is currently not working for an unknown reason, and it adds little value for us sysops anyway, so it's inactive for now -- [[User_talk:Iritscen]]
} // this code is currently not working for an unknown reason, and it adds little value for us sysops anyway, so it's inactive for now -- [[User_talk:Iritscen]]


// addOnloadHook( sysopFunctions ); // be sure to uncomment this if restoring above code
addOnloadHook( sysopFunctions ); // be sure to uncomment this if restoring above code