Commons:User scripts
Hi, interested in scripting? We need help, so do not hesitate to ask what you can do. We recommend start testing in your user-namespace (new users see basic instructions here).
We have a JavaScript styleguide, but it is a guide, not a policy. Nevertheless, consider reading the MediaWiki manual.
A list of currently available scripts can be found at Category:User scripts.
TO-DO edit
- Clarify the copyright situation of user-scripts.
- standardize scripts’ i18n methods → Gadgets 2.0 (mw.msg; example; explanation)
- Search & Detecting security vulnerable
- (urgent) Fix script affected by changes in the default continuation
To create edit
These are just suggestions. Feel free to comment in the talk-section.
- A script to get a formatted list of uploads, category-members, …
- A plugin to install scripts loaded with &withJS= – URL parameter to the user’s common or skin.js
- A script-installer which is invokable by a template (URL-params maybe) with a step-by-step wizard (done for gadgets → Template:ActivateGadget)
A global-user-page and settings wizard allowing to create and update the userpage on several wikis.Done- A slideshow-framework using templates and script like Image Annotator or {{ImageStack}} with customizable caption-boxes, slide-effects, drag&slide, preview thumb-bar, …
- Integrate code for VIC and FPC nomination in MediaWiki:Gadget-QInominator.js.
An autotranslate-template creation wizardDone, see AutotranslateHelper — 0x010C ~talk~ 09:40, 4 April 2017 (UTC)- Refractor MediaWiki:Gadget-LanguageSelect.js: Multiple language-preferences, showing a (+) like HotCat allowing to add a translation (create an input on-the-fly) to push i18n forward
- Script to show 1-3 file examples in parent categories from their child categories (Special:Permalink/84246834#Galleries in Categories)
Rewrite DerivativeFX as a JavaScript applicationm:WMDE Technical Wishes/Move files to Commons phab:T190716- A tool to visually explore Flickr-Images from streams/sets/… before uploading and allowing to unselect some of them by given criteria
A script to allow admins to close undeletion requests like closing deletion requests with MediaWiki:Gadget-DelReqHandler.js (maybe inside delreqhandler)Done here by Perhelion- A tool similar to Help:QuickDelete but instead of adding deletion templates you can choose to add {{Opaque}}, {{Convert to SVG}} or {{BadJPEG}}.
Scripts without il8n edit
Other edit
- MediaWiki:Gadget-ChooseResolution.js, MediaWiki:Gadget-dictionaryLookupHover.js not installed as a gadget
- MediaWiki:Gadget-Tag.js – ? not installed
Under construction edit
- Improve: Gallery-like mass-changing script Help:VisualFileChange.js
(former User:Rillke/AjaxMassDelete.js) - Improve: Gallery of uploads Commons:Gallery tool (wrapper for MediaWiki:JSONListUploads.js)
- Improve: licensereviewer.js (switch to API, ease the process)
- Waiting for clearance: Common SVG Checker MediaWiki:CommonsSvgChecker.js and Commons:Commons SVG Checker as UI (former Commons:SVG Check)
General Talk edit
→ /talk
Users with script experience that may help edit
| ||
{{User script developer}} |
User:DieBuche (maybe inactive)- User:Dschwen
- User:Helder
- User:Ilmari Karonen
- User:Krinkle (WMF)
- User:Lupo
- User:Magnus Manske (WMF)
User:Rillke (maybe too busy)User:Perhelion (maybe inactive)
→ See also: Category:Commons JavaScript coders
See also edit
Learning edit
- Wikibooks (de, en)
- mw:ResourceLoader/Default modules
- jQuery – code less, do more
- Usability drafts by Guillaume Paumier
Testing edit
You can test any script by running it from your console or put the code in a Special:MyPage/test.js and hit “preview”.
- jsfiddle.net – Edit CSS, JavaScript, HTML and run it (big sandbox)
- Testing with different IE versions (Windows) (IETester: For slow machines) (Expression Web SuperPreview: For mordern machines)
- &withJS functionality: Commons has per-page JavaScript functionality, via this code being included in MediaWiki:Common.js. Try a random image file with MediaWiki:VisualFileChange.js.
- Testing the API
Validating and styling edit
- Commons:User scripts/reports
- Use MediaWiki:Gadgetprototype.js for new gadgets.
- ESLint – JavaScript Code Quality Tool (former jshint)
- jslint – another JavaScript Code Quality Tool
- jsbeautifier – Indenting and formatting your script – also on Commons:
- Commons Beautifier: escape unsafe characters and beautify the source code
- compactor- or just search yourself
Tools edit
Troubleshooting edit
- Commons Diagnostic: Let affected users make the test
- &debug=true – URL parameter to get un-minified code
- Debug AJAX requests (using mockjax) GitHub doc