This is an information page. It is neither an encyclopedia article nor one of Wikipedia's policies or guidelines; rather, its purpose is to explain certain aspects of Wikipedia's norms, customs, technicalities, or practices. It may reflect differing levels of consensus and vetting. |
| You take full responsibility for any actions taken using any user script. You must read and abide by all relevant Wikipedia policies when using this tool; failure to do so may result in being blocked from editing. |
User scripts are programs written in JavaScript to facilitate the editing of Wikipedia. User scripts enable user accounts to do things they otherwise could not. Many user scripts are available, ready for you to install. Also, you can write a new user script, either by modifying an existing script or by starting from scratch.
Security
[edit]User scripts have unlimited access to your account by their very nature – unlike OAuth/bot password based applications such as Huggle, where you can control access levels, the script runs in your browser. Anything you can do on Wikipedia, it can do. As such, and this is especially pertinent to users with advanced permissions, make sure that you trust the user who wrote the script, as you will be held responsible for any actions it takes on your behalf. If you are "importing" a script (instead of copying the code itself) be warned that the user you are importing from could alter their script at any time. Only import from users you trust.
List of user scripts
[edit]If you come across or write a user script, please add it to Wikipedia:User scripts/List and Category:Wikipedia scripts. To add new scripts to the main list, use the {{user script table row}} template. Include at least the code page path and a short description. For example:
{{user script table row
|name=My script
|code=User:Example/MyJSpage.js
|doc=User:Example/MyJSdocumentationPage
|desc=This script does something useful.
}}
- Name defaults to the code page's name, without its path or ".js".
- If a documentation page exists matching your .js page name, it will be linked automatically, without the need for a doc parameter.
Search for user scripts
[edit]Don't see what you need? You can request a new user script or search for an existing script.
Search within the code of user scripts:
Search user scripts by their title:
Installation
[edit]Automatic installation
[edit]- Check the checkbox at Preferences → Gadgets → Advanced →
Install scripts without having to manually edit JavaScript files (documentation) and click Save. - Visit Wikipedia:User scripts/List.
- Click "Install" after each script name to install the script. Some scripts may require additional steps, so be sure to visit the documentation if any.
Manual installation
[edit]Method for scripts which are located on the English Wikipedia.
- First, make sure you are logged in. Only logged-in users can install user scripts.
- Click here to edit your common.js file.
- Add the following line:
{{subst:Iusc|script_path}}– replace "script_path" with the full name of the .js page that opens when a script's "(source)" link is clicked. The Install user script (Iusc) template will add the necessaryimportScript()line along with a backlink.- For example, to install the Sharebox script, add the following line:
{{subst:Iusc|User:TheDJ/sharebox.js}}
- For example, to install the Sharebox script, add the following line:
- Save the page and bypass your cache to make sure the changes take effect.
Remote scripts
[edit]Method for scripts which are not located on the English Wikipedia.
Many of these scripts may not work at other wikis, either because the wiki has a different setup or their home wiki's URL is hardcoded into the script. Most script authors probably don't think about how to make their script work at other wikis. If you install a script globally, then you should avoid also keeping a copy in your local common.js file. Otherwise, the same script is loaded twice when using that wiki and may cause issues.
- First, make sure you are logged in. Only logged-in users can install scripts.
- Edit your common.js file on the other wiki. Alternatively, you may use your skin.js to work only your current skin.
- Add the following line, replacing
SCRIPT_PATHwith the full name of the .js page that opens when a script's "(source)" link is clicked:mw.loader.load( '//en.wikipedia.org/wiki/SCRIPT_PATH?action=raw&ctype=text/javascript' );
- For example, to install the NoEditSummary script, add the following line:
mw.loader.load( '//en.wikipedia.org/wiki/User:GhostInTheMachine/NoEditSummary.js?action=raw&ctype=text/javascript' );
- Save the page and bypass your cache to make sure the changes take effect.
Writing user scripts
[edit]Instructions for writing your own user scripts are included in Wikipedia:User scripts/Guide.
Additional script-writing resources are presented below.
Snippets
[edit]The following code snippets still exist under the now defunct WikiProject User scripts. Many are still in use by live scripts, and they may provide insights for current script developers.
Userbox
[edit]To advertise your user script development skills on your user page, you can use these userboxes.
| Markup | Renders as | ||
|---|---|---|---|
{{user script developer}} |
| ||
{{user script developer2}} |
| ||
{{user scripts created}} |
| ||
{{user scripts created|99}} |
|
See also
[edit]- Information on user scripts from Wikipedia: The Missing Manual
- The most imported user scripts
- WikiProject JavaScript, a collaboration of editors to improve Wikipedia's JavaScript coverage