Jump to content

MediaWiki:Common.js

From Verified Wikipedia

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
// Remove stats box on CreateAccount page (strong force)
mw.loader.using('mediawiki.util').then(function () {
    if (mw.config.get('wgCanonicalSpecialPageName') === 'CreateAccount') {

        function removeStatsBox() {
            var statsSelectors = [
                '.mw-ge-homepage-stats',
                '.mw-ge-homepage-impact',
                '.growth-homepage-module--impact',
                '.growth-homepage-module-type-impact'
            ];

            statsSelectors.forEach(function(selector) {
                document.querySelectorAll(selector).forEach(function(el) {
                    el.remove();
                });
            });
        }

        // Run immediately + run again after GrowthExperiments loads
        removeStatsBox();
        setTimeout(removeStatsBox, 500);
        setTimeout(removeStatsBox, 1500);
        setTimeout(removeStatsBox, 3000);
    }
});