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:39, 3 June 2024 (hopefully fixing monobook highlighting). 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.
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]]
highlightUnreferencedPassagesAutomatic = true;
importScript('User:Phlsph7/Readability.js'); // Backlink: [[User:Phlsph7/Readability.js]]

// shows monthly views, watchers, size, and word count on every page
// marks duplicate links
//setTimeout(function(){document.getElementById('ca-showCk').click()}, 3000); // automatically active after loading
// Highlight duplicated references
// always 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);
	}
})();
importScript('User:Skynxnex/VitalTopicon.js'); // Backlink: [[User:Skynxnex/VitalTopicon.js]]
highlightUnreferencedPassagesAutomatic = true;
importScript('User:Phlsph7/HighlightUnreferencedPassages.js'); // Backlink: [[User:Phlsph7/HighlightUnreferencedPassages.js]]
// Load the HighlightUnreferencedPassages.js script
importScript('User:Phlsph7/HighlightUnreferencedPassages.js');

// Ensure compatibility with Monobook
mw.loader.using(['mediawiki.util'], function () {
    // Function to highlight unreferenced passages
    function highlightUnreferencedPassages() {
        // Select all passages that need highlighting
        var elements = document.querySelectorAll('.unreferenced');
        elements.forEach(function (element) {
            element.style.backgroundColor = 'yellow';
        });
    }
    
    // Run the function when the page is ready
    $(document).ready(function () {
        highlightUnreferencedPassages();
    });
});