MediaWiki:Gadget-Without text.js

From Wikisource
Jump to navigation Jump to search
Note: After saving, changes may not occur immediately. Click here to learn how to bypass your browser's cache.
  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (Cmd-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (Cmd-Shift-R on a Mac)
  • Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Clear the cache in Tools → Preferences

For details and instructions about other browsers, see Wikipedia:Bypass your cache.

/*
One-click "Without text"

Tagging an empty page as "Without text" potentially requires

    Clearing the header box (of the index-specified default)
    Clearing the edit box (of any spurious OCR)
    Clearing the footer box (of the index-specified default)
    Clicking the "without text" radio box
    Clicking "Save"

This script performs all of these tasks upon clicking of the "without text" radio box

Users can add this to their scripts by editing [[Special:MyFiles/common.js]] and adding the following line

  mw.loader.load('//en.wikisource.org/w/index.php?title=MediaWiki:Gadget-Without text.js&action=raw&ctype=text/javascript')

*/

$(function(){
    qualityContainer = document.getElementById('wpQuality-container');
    if (qualityContainer == null) return;
 
    quality0 = qualityContainer.getElementsByClassName('quality0')
    withouttext = quality0[0].childNodes[0];
 
    withouttext.addEventListener('click', function () {
        document.getElementsByName('wpTextbox1')[0].value = "";
        document.getElementsByName('wpHeaderTextbox')[0].value = "";
        document.getElementsByName('wpFooterTextbox')[0].value = "";
        document.getElementsByName('wpSave')[0].click();
    });
});