User:Pyrospirit/scriptcontrol.js
Appearance
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. |
Documentation for this user script can be added at User:Pyrospirit/scriptcontrol. |
/*
This is the location of a script I'm currently working on. The goal of the
script is to allow users to enable and disable any user script at will from
any page. Currently, this requires manual editing of your JavaScript page,
which is impractical for frequent use.
The basic idea of the script is to set a cookie for each user script
installed and determine whether to load the script or not based on the value
of the cookie.
Once the script is complete, the installation should work roughly like this:
1) Install this script like usual.
2) Configure it with your other scripts using a format similar to this:
function scriptControlConfig ()
{
scriptControlAddScript ( 'http://en.wikipedia.org/w/index.php?title=User:Example/script.js', 'Example script', true );
scriptControlAddScript ( 'http://en.wikipedia.org/w/index.php?title=User:Someone/something.js', 'Some script', false );
}
This would have the first script labeled "Example script" and enabled by
default and the second script labeled "Some script" and disabled by default.
Of course, this could be later changed with a cookie without editing any
pages.
I am expecting to have a stable version completed... er... eventually.
*/
// <pre><nowiki>
var scriptControlVersion = '0.0.2'; // hacking around, mostly. Version 0.1 will be when it does something.
function scriptcontrolLink(){
addPortletLink ('p-personal', 'javascript:scriptcontrolpanel()', 'scripts', 'pt-scripts', 'Turn scripts on/off');
}
function scriptcontrol() {
alert('zo\'e, just testing out the portlet...');
}
$(scriptcontrolLink);
// </nowiki></pre>