GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Main page
  • Contents
  • Current events
  • Random article
  • About Wikipedia
  • Contact us
  • Help
  • Learn to edit
  • Community portal
  • Recent changes
  • Upload file
  • Special pages
  • Search
  • Donate

This view

  • Original page
  • New address

GeezerVison is showing en.wikipedia.org — User:Hilst/Scripts/scriptManager.js - Wikipedia

< User:Hilst | Scripts
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump.
This code will be executed when previewing this page.
This user script seems to have a documentation page at User:Hilst/Scripts/scriptManager.
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.
/** 
 * scriptManager, based on [[:en:User:MusikAnimal/scriptManager.js]] by [[User:MusikAnimal]]
 */

$( document ).ready( function () { 
mw.loader.using(['mediawiki.util', 'mediawiki.api'], function () {
	"use strict";
	
	var skin = mw.config.get('skin');
	var portlet = mw.util.addPortlet("p-enable-scripts", "Enable scripts");
	
	if (skin === 'vector'){
		mw.util.addPortlet("p-enable-scripts", "Enable scripts", "#p-lang"); // Vector doesn't style the portlet
	                                                                       // If we don't attach it when created
	} else if (skin === 'timeless' || $('#p-coll-print_export').length > 0) {
		$(portlet).insertAfter('#p-tb');
	} else {
		$(portlet).insertAfter('#p-lang');
	}

	var loadScript = function(e) {
		mw.loader.load(e.data.src); // Load the script
		                            // TODO: implement error handling
		mw.notify(`${e.data.script} has been enabled.`, {title: "scriptManager", type: "success"});
		$(`#t-enablescript-${e.data.scriptName}`).remove();
	};
 
 	if (window.scriptsToManage) {
		$.each(scriptsToManage, function(script, src) {
			var scriptName = script.replace(/ /g,"_"); 

			mw.util.addPortletLink("p-enable-scripts", "javascript:", script, `t-enablescript-${scriptName}`, `Enable ${script} for this page`);

			// If a script has been clicked, pipe it to loadScript
			$(`#t-enablescript-${scriptName}`).click({
				scriptName: scriptName,
				script: script,
				src: src
			}, loadScript);
		});
 	} else {
		mw.util.addPortletLink("p-enable-scripts", "en.wikipedia.org/wiki/User:Hilst/Scripts/scriptManager", "No scripts registered!");
 	}
});
}());
Retrieved from "https://en.wikipedia.org/w/index.php?title=User:Hilst/Scripts/scriptManager.js&oldid=1236012026"
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.