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.
We have a styleguide. But it is a guide, not a policy. Nevertheless, consider reading the MediaWiki manual.
TO DO
- Clarify the copyright situation of user-scripts.
- standardize scripts' i18n methods → Gadgets 2.0 (mw.msg; example; explanation)
- Search & Detecting security vulnerable
To create
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.
- A slideshow-framework using templates and script like Image Annotator or {{ImageStack}} with customizable caption-boxes, slide-effects, drag&slide, preview thumb-bar, ...
- A script to close undeletion requests like closing deletion requests with MediaWiki:Gadget-DelReqHandler.js (maybe inside delreqhandler)
- Integrate code for VIC and FPC nomination in MediaWiki:Gadget-QInominator.js.
- An autotranslate-template creation wizard
- 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 application
- A tool to visually explore Flickr-Images from streams/sets/… before uploading and allowing to unselect some of them by given criteria
Scripts without il8n
Broken scripts
- MediaWiki talk:Gadget-massblock.js — will be removed soon. No maintainer.
Other
- MediaWiki:Gadget-ChooseResolution.js, MediaWiki:Gadget-dictionaryLookupHover.js not installed as a gadget
- MediaWiki:Gadget-Slideshow.js obsolete, not installed
- MediaWiki:Gadget-Tag.js - ? not installed
Under construction
- Improve: Gallery-like mass-changing script User:Rillke/AjaxMassDelete.js
- Improve: Gallery of uploads MediaWiki:JSONListUploads.js
- Improve: ZooFaris licensereviewer.js (switch to API, ease the process)
Google Calendar extension causing script error
JFYI:
If you get an error like
Uncaught TypeError: Cannot call method 'match' of undefined chrome-extension://gmbgaklkmjakoegficnlkhebmhkjfich/calendar_utils.js:78
on each file description page, nothing is wrong with our scripts, it's because there is a vevent class on our {{information}} confusing this extension. -- RE rillke questions? 19:52, 6 May 2012 (UTC)
the text-diff tool which is used by default needs really improvements
- Only a small improvement for "identifying identical text fragments in two versions" would be of much help / support, regarding its extremly often usage on wikipedia.
- And there can MUCH be done / improved! I observed that the current diff is very often unable to match identical text fragments which are shifted to the next section or other logical substructure in the same section which is nearby. :-/ The user has to check word-by-word with his eyes, whether small changes had happened in theses shifted text-block or failed to recognize the change. :-( Achim1999 (talk) 10:34, 22 June 2012 (UTC)
- There are JS-text-diff modules available. But if you want to have something changed in MediaWiki (all wikis) then, you have to request this at bugzilla:. It is more common to highlight differences than identical text so I don't think we will ever get this. And when coming to bugzilla it is alwas good when requesting features to show an example application that is doing a better job.
- In Notepad++, identical text is highlighted in blue. -- RE rillke questions? 11:25, 22 June 2012 (UTC)
-
- default installed diff-tools. Almost no user will look to changes what can be possible done internal with this automatic diffs :-(
- Request at bugzilla? From own expirience I am still waiting since about 2 weeks of any reaction for another request / subject (you should know it) :-(
- I only want to be sure that certain not matched text-blocks in two versions are identical, to save time of intensive checking / focus by my eye / mind!
- Well, I can come up with a typical example, but surely not with an application which I don't know or which maybe not exists!
- Thanks for moving this subject/topic to its proper place. Achim1999 (talk) 14:33, 22 June 2012 (UTC)
-
Users with script experience that may help
- User:DieBuche
- User:Dschwen
- Helder
- User:Ilmari Karonen
- User:Krinkle
- User:Lupo
- User:Magnus Manske
- User:Rillke
See also: Category:Commons JavaScript coders
See also
Learning
- Wikibooks (de, en)
- mw:ResourceLoader/Default modules
- jQuery - code less, do more
- Usability drafts by Guillaume Paumier
Testing
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 imagefile with MediaWiki:VisualFileChange.js.
- Testing the API
Validating and styling
- Use MediaWiki:Gadgetprototype.js for new gadgets.
- jslint - JavaScript Code Quality Tool
- jshint - 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
Troubleshooting
- Commons Diagnostic: Let affected users make the test
- &debug=true - URL parameter to get un-minified code
- Debug AJAX requests (using mockjax) github doc
Read in another language
This page is available in 13 languages