Jump to content

User:Tpbradbury/common.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Tpbradbury (talk | contribs) at 14:44, 3 June 2024 (cleanup script using AI...). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
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.
// Load scripts from various users
mw.loader.load("https://meta.wikimedia.org/w/index.php?title=User:Zhaofeng_Li/Reflinks.js&action=raw&ctype=text/javascript");
importScript('User:Trappist_the_monk/HarvErrors.js'); // Backlink: [[User:Trappist_the_monk/HarvErrors.js]]
importScript('User:Ohconfucius/script/Common_Terms.js'); // Backlink: [[User:Ohconfucius/script/Common_Terms.js]]
importScript('User:Headbomb/unreliable.js'); // Backlink: [[User:Headbomb/unreliable.js]]
importScript('User:Tpbradbury/unreliable-rules.js'); // Backlink: [[User:Tpbradbury/unreliable-rules.js]]
importScript('User:Novem_Linguae/Scripts/CiteHighlighter.js'); // Backlink: [[User:Novem_Linguae/Scripts/CiteHighlighter.js]]
mw.loader.load('/w/index.php?title=User:Evad37/rater.js&action=raw&ctype=text/javascript'); // Backlink: [[User:Evad37/rater.js]]
importStylesheet('User:N8wilson/AQFetcher-Icons.css'); // Linkback: [[User:N8wilson/AQFetcher.css]]
importScript('User:Anomie/linkclassifier.js'); // Backlink: [[User:Anomie/linkclassifier.js]]
importScript('User:EpochFail/ArticleQuality-loader.js'); // Backlink: [[User:EpochFail/ArticleQuality-loader.js]]
importScript('User:Skynxnex/VitalTopicon.js'); // Backlink: [[User:Skynxnex/VitalTopicon.js]]
importScript('User:Phlsph7/Readability.js'); // Backlink: [[User:Phlsph7/Readability.js]]
importScript('User:Phlsph7/HighlightUnreferencedPassages.js'); // Backlink: [[User:Phlsph7/HighlightUnreferencedPassages.js]]

// Highlight unreferenced passages automatically
highlightUnreferencedPassagesAutomatic = true;

// Ensure compatibility with Monobook
mw.loader.using(['mediawiki.util'], function () {
    function highlightUnreferencedPassages() {
        var elements = document.querySelectorAll('.unreferenced');
        elements.forEach(function (element) {
            element.style.backgroundColor = 'yellow';
        });
    }
    
    $(document).ready(function () {
        highlightUnreferencedPassages();
    });
});

// Scroll to top when previewing
(function(){
    const allowedActions = ['edit', 'submit'];
    if (allowedActions.indexOf(mw.config.get("wgAction")) !== -1) {
        setTimeout(function() {
            window.scrollTo({ top: 0 });
        }, 1000);
    }
})();