MediaWiki:Sysop.js: Difference between revisions

From XentaxWiki
Jump to navigation Jump to search
imported>Dinoguy1000
imported>Dinoguy1000
(add a bit from Yu-Gi-Oh! Wikia)
 
(One intermediate revision by the same user not shown)
Line 30: Line 30:
     })();
     })();
  }
  }
/*******************************************************
*
* blanks the "Other/additional reason" field when
* deleting pages so we don't get stupid vandalism and
* spam and whatnot preserved for posterity in the
* delete log
*/
addOnloadHook(function() {
if ( wgAction == 'delete' && ( document.getElementById('wpReason').value.indexOf('content was: "') == 0
    || document.getElementById('wpReason').value.indexOf('content before blanking was: "') == 0 ) ) {
    document.getElementById('wpReason').value = '';
}
})


//</syntaxhighlight>
//</syntaxhighlight>

Latest revision as of 07:59, 24 February 2012

//<syntaxhighlight lang="JavaScript">
 
 
 /** Creates a button to invert checkboxes on Special:Undelete */
 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 );
     })();
 }

/*******************************************************
 *
 * blanks the "Other/additional reason" field when
 * deleting pages so we don't get stupid vandalism and
 * spam and whatnot preserved for posterity in the
 * delete log
 */
addOnloadHook(function() {
if ( wgAction == 'delete' && ( document.getElementById('wpReason').value.indexOf('content was: "') == 0
     || document.getElementById('wpReason').value.indexOf('content before blanking was: "') == 0 ) ) { 
    document.getElementById('wpReason').value = '';
}
})

//</syntaxhighlight>