Jump to content

User:Qwerfjkl/scripts/subscribeall.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
mw.loader.using( 'mediawiki.util', function () {

    // Wait for the page to be parsed
    $( document ).ready( function () { 

        //see below "Portlets" subsection
        var link = mw.util.addPortletLink( 'p-tb', '#', 'Subscribe all', 't-subscribeall', 'Click all subscribe links on the page'); 
        $( link ).click( function ( event ) {
            event.preventDefault();
            var myLinks = document.getElementsByClassName("ext-discussiontools-init-section-subscribe-link");
            console.log('Links from https://en.wikipedia.org/w/index.php?title=User:Qwerfjkl/scripts/subscribeall.js&action=edit:\n'+myLinks);
            for (var i = 0; i < myLinks.length; i++) {
            	console.log("subscribeall.js: "+myLinks[i]);
            	myLinks[i].click();
            }

        } );
    } );
} );