Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

MediaWiki Developer's Handbook/Add JavaScript/Hiding unwanted information on the deletion form

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

function cleanDeleteReason(){ //Declare the function and its parameters var wpReason = document.getElementById("wpReason"); //declare a variable and set its value if (!wpReason) return; //if there's no such thing (i.e. the //previous line didn't find an //element with that id) then return var regexp = /(content waspage was emptycontent before blanking was)/i; //create a regexp object which //matches the default delete reasons if (regexp.test(wpReason.value)){ //if the regexp object we created tests true against the value //of wpReason (which is a DOM element)... wpReason.value = ""; //then set the value of wpReason to an empty string } } if (wgAction == 'delete') addOnloadHook(cleanDeleteReason); //if the current action is deleting, then hook onto page load //and run the cleanDeleteReason function