User:JPxG/common.js

// Enable caching for resource loads, see User:SD0001/Making_user_scripts_load_faster, @revision 5 if (!/\bnocache=\b/.test(location.href)) { // Don't enable if nocache=1 url parameter is given var loadResource = function(page, sitename, ctype) { page = page.replace(/special:mypage/i, 'User:' + mw.config.get('wgUserName')); return $.get(                       'https://' + sitename + '/w/api.php?titles=' + page + // page is already URL-encoded                        '&origin=*&format=json&formatversion=2&uselang=content&maxage=86400&smaxage=86400' +                         '&action=query&prop=revisions|info&rvprop=content&rvlimit=1'                ).then(function(apiResponse) {                        var apiPage = apiResponse.query.pages[0];                        if (apiPage.missing) {                                return;                        }                        var content = apiPage.revisions[0].content;                        if ((!ctype || ctype === 'text/javascript') && apiPage.contentmodel === 'javascript') {                                if (apiPage.ns !== 2 && apiPage.ns !== 8) {                                        return $.Deferred.reject('Refused to load "' + page + '"@' + sitename + ': outside User and MediaWiki space'); }                               var scriptTag = document.createElement('script'); scriptTag.innerHTML = content; document.head.appendChild(scriptTag); } else if (ctype === 'text/css' && apiPage.contentmodel === 'css') { mw.loader.addStyleTag(content); } else { return $.Deferred.reject('Refused to load "' + page + '"@' + sitename + ': content type mismatch'); }               });        };        var getSiteTitle = function(url) {                var siteRgx = /^(?:(?:https:)?\/\/(.*))?\/w\/index.php/.exec(url),                        titleRgx = /\btitle=([^=?&]*)/.exec(url);                if (siteRgx && titleRgx && /\baction=raw\b/.test(url) && /\bctype=/.test(url)) {                        return [titleRgx[1], siteRgx[1] || mw.config.get('wgServerName')];                      } else return null;        };        window.importScript = function(page) {                loadResource(encodeURIComponent(page), mw.config.get('wgServerName'), 'text/javascript');        };        window.importStyleSheet = function(page) {                loadResource(encodeURIComponent(page), mw.config.get('wgServerName'), 'text/css');        };        var oldMwLoaderLoad = mw.loader.load;        mw.loader.load = function(url, type) {                var linkParts = getSiteTitle(url); if (linkParts) { loadResource(linkParts[0], linkParts[1], type); } else { oldMwLoaderLoad.apply(mw.loader, Array.prototype.slice.call(arguments)); }       };        var oldMwLoaderGetScript = mw.loader.getScript; mw.loader.getScript = function(url) { var linkParts = getSiteTitle(url); if (linkParts) { return loadResource(linkParts[0], linkParts[1], 'text/javascript'); } else { return oldMwLoaderGetScript.apply(mw.loader, Array.prototype.slice.call(arguments)); }       }; }

/* Cat-a-lot - changes category of multiple files */

mw.loader.using(['jquery.ui', 'mediawiki.util'], function{ mw.loader.load('//commons.wikimedia.org/w/load.php?modules=ext.gadget.Cat-a-lot'); }); /* // Failed test (2023 01 09) //mw.loader.using(['jquery.ui', 'mediawiki.util'], function{ //mw.loader.load('/w/index.php?title=User:JPxG/Cat-a-little.js&action=raw&ctype=text/javascript'); }); // Backlink: User:JPxG/Cat-a-little.js ////////// Cat-a-lot user preferences ////////// window.catALotPrefs = {"watchlist":"preferences","minor":true,"editpages":true,"docleanup":false,"subcatcount":10}; ////////////////////////////////////catALotEnd//

/* 2021 March 12 */ //importScript('User:Ais523/catwatch.js'); // Backlink: User:Ais523/catwatch.js //importScript('User:MusikAnimal/customWatchlists.js'); // Backlink: User:MusikAnimal/customWatchlists.js importScript('User:Evad37/OneClickArchiver.js'); // Backlink: User:Evad37/OneClickArchiver.js //importScript('User:Frietjes/findargdups.js'); // Backlink: User:Frietjes/findargdups.js //importScript('User:PrimeHunter/Source links.js'); // Backlink: User:PrimeHunter/Source links.js //importScript('User:JPxG/CopyTitle.js'); // Backlink: User:JPxG/CopyTitle.js //importScript('User:JPxG/Monthreplacer.js'); // Backlink: User:JPxG/Monthreplacer.js //importScript('User:JPxG/OpenAllNPP.js'); // Backlink: User:JPxG/OpenAllNPP.js //importScript('User:Dschwen/highlightredirects.js'); // Backlink: User:Dschwen/highlightredirects.js //importScript('User:Opencooper/IPtoEmoji.js'); // Backlink: User:Opencooper/IPtoEmoji.js //importScript('User:JPxG/Monthcounter-agnostic.js'); // Backlink: User:JPxG/Monthcounter-agnostic.js //importScript('User:JPxG/TrackSum.js'); // Backlink: User:JPxG/TrackSum.js //importScript('User:JPxG/test.js'); // Backlink: User:JPxG/test.js //importScript('User:Shubinator/DYKcheck.js'); // Backlink: User:Shubinator/DYKcheck.js //importScript('User:P999/Toggle VF.js'); // Backlink: User:P999/Toggle VF.js //importScript('User:Enterprisey/diff-context.js'); // Backlink: User:Enterprisey/diff-context.js //importScript('User:JPxG/wigout.js'); // Backlink: User:JPxG/wigout.js //importScript('User:Lourdes/PageCuration.js'); // Backlink: User:Lourdes/PageCuration.js

importScript('User:Plastikspork/massmove.js'); // \\ 0 //importScript('User:Mr. Stradivarius/gadgets/SignpostTagger.js'); // Backlink: User:Mr. Stradivarius/gadgets/SignpostTagger.js importScript('User:Ahecht/Scripts/refresh.js'); // Backlink: User:Ahecht/Scripts/refresh.js importScript('User:SuperHamster/view-it-full.js'); importScript('User:Enterprisey/search-shortcuts.js'); // Backlink: User:Enterprisey/search-shortcuts.js \\ 989 importScript('User:JPxG/Unbreaker.js'); // Backlink: User:JPxG/Unbreaker.js \\ 1,206 importScript('User:DannyS712/PageMoverClosure.js'); // Backlink: User:DannyS712/PageMoverClosure.js \\ 2,421 importScript('User:JPxG/ThinkOutDaBox.js'); // Backlink: User:JPxG/ThinkOutDaBox.js \\ 2,558 importScript('User:Evad37/Thanky.js'); // Backlink: User:Evad37/Thanky.js \\ 3,553 importScript('User:Kaniivel/RefConsolidate_start.js'); // Backlink: User:Kaniivel/RefConsolidate_start.js \\ 3,940 importScript('User:Waldyrious/formatcitations.js'); // Backlink: User:Waldyrious/formatcitations.js \\ 4,150 importScript('User:Enterprisey/quick-before.js'); // Backlink: User:Enterprisey/quick-before.js \\ 4,560 importScript('User:Writ_Keeper/Scripts/massRollback.js'); // Backlink: User:Writ_Keeper/Scripts/massRollback.js \\ 5,805 importScript('User:Frietjes/masspurge.js'); // Backlink: User:Frietjes/masspurge.js \\ 6,470 importScript('User:JPxG/recency.js'); // Backlink: User:JPxG/recency.js \\ 8,229 importScript('User:JPxG/current-switcher.js'); // Backlink: User:JPxG/current-switcher.js \\ 8,949 importScript('User:JPxG/CSSImageCrop.js'); // Backlink: User:JPxG/CSSImageCrop.js        \\ 9,187 importScript('User:Enterprisey/delsort.js'); // Backlink: User:Enterprisey/delsort.js \\ 24,110 importScript('User:JPxG/SignpostTagger.js'); // Backlink: User:JPxG/SignpostTagger.js \\ 46,108 importScript('User:JPxG/SPS.js'); // Backlink: User:JPxG/SPS.js \\ 71,879 importScript('User:JPxG/JWB.js/load.js'); // Backlink: User:Joeytje50/JWB.js/load.js \\ 86,134

mw.util.addPortletLink("p-tb", "//en.wikipedia.org/wiki/Special:Massmove", "Mass move", "p-massmove", "Mass move"); //

// 2022 November 6 /* Automate purge confirmation dialog */ if (mw.config.get('wgAction') === 'purge') { $('form[action*="action=purge"]').submit; }

// A bunch of stuff commented out 2023 Jan 9, because scripts were taking forever to load. importScript('User:Enterprisey/diff-permalink-2.js'); // Backlink: User:Enterprisey/diff-permalink-2.js \\ 1,505 importScript('User:JPxG/Difformatter.js'); // Backlink: User:JPxG/Difformatter.js \\ 1,088 importScript('User:JPxG/refill-menu.js'); // Backlink: User:JPxG/refill-menu.js\\ 663 importScript('User:SD0001/quickViewDeleted.js'); // Backlink: User:SD0001/quickViewDeleted.js \\ 1,435 importScript('User:JPxG/AsbestosGun.js'); // Backlink: User:JPxG/AsbestosGun.js \\ 1,518 importScript('User:Nardog/MoveHistory.js'); // Backlink: User:Nardog/MoveHistory.js \\ 826

// Commenting in pagesizes for scripts, 2024 Jan 11 -- this is ridiculous that I have to do this crap // commenting out bigass + rarely used scripts -- again

// importScript('User:JPxG/Monthcounter.js'); // Backlink: User:JPxG/Monthcounter.js \\ 3,262 // importScript('user:theleekycauldron/DYK promoter.js'); // Backlink: user:theleekycauldron/DYK promoter.js \\ 11,456 // importScript('User:Ohconfucius/script/MOSNUM dates.js'); // Backlink: User:Ohconfucius/script/MOSNUM dates.js \\ 82,231 // importScript('User:SD0001/DYK-helper.js'); // Backlink: User:SD0001/DYK-helper.js \\ 20,576 // importScript('User:Evad37/OneClickArchiver.js') \\ 23,162 // importScript('User:Beetstra/Gadget-Spam-whitelist-Handler.js') \\ 48,900 // importScript('User:Enterprisey/easy-brfa.js'); // Backlink: User:Enterprisey/easy-brfa.js \\ 12,685 importScript('User:PrimeHunter/Search sort.js'); // Backlink: User:PrimeHunter/Search sort.js importScript('User:Phlsph7/WikiChatbot.js'); // Backlink: User:Phlsph7/WikiChatbot.js importScript('User:Awesome_Aasim/xfdvote.js'); // Backlink: User:Awesome_Aasim/xfdvote.js importScript('User:Nardog/RefRenamer.js'); // Backlink: User:Nardog/RefRenamer.js importScript('User:JPxG/signpost-filetools.js'); // Backlink: User:JPxG/signpost-filetools.js