user:js/urldecoder
urldecoder | |
---|---|
Browsers | * |
Skins | * |
Code | urldecoder.js |
Released | April 24, 2009 |
Updated | April 25, 2009 |
Developer | AlexSm |
→[[]]
[http://meta.wikime……
[[meta:Page]]
urldecoder is a script that converts URLs to internal links:
you can paste URL into the editing window
http://meta.wikimedia.org/wiki/Meta:Babel#Spam_links|
then press the button (see pic on the right) and you'll get
[[meta:Meta:Babel#Spam links]]
Features
- you can also type the link description, and then press the button:
http://de.wikipedia.org/wiki/Ding this page|
→[[:de:Ding|this page]]
- URLs from secure login browsing will be converted to normal links;
- URLs to bugzilla bugs will be converted into
[[mediazilla:...]]
- URLs will also be percent-decoded from %-sequences into normal chars:
http://…a%26b
→http://…a&b
- this is tremendously useful in non-Latin language projects where most URLs look like
%D1%EB%F3%E6…
- the script can also simplify all URLs in the selected text.
Installation
- English Wikipedia:
importScript('user:js/urldecoder.js')
→ your monobook.js
- Other Wikimedia projects:
importScriptURI('http://en.wikipedia.org/w/index.php?title=user:js/urldecoder.js&action=raw&ctype=text/javascript')
Localization
The script should work in all Wikimedia projects.
However, in non-English projects it has to make an extra API request each time to get the list of local namespaces. This is neccessary to correctly convert URLs into [[:File:X]]
and [[:Category:X]]
with leading colon.
Every time the script makes API request it displays the string with some code, for example for Polish Wikipedia:
urlDecoderNS = {'pl':'plik|kategoria|image|grafika'}
It is recommended that you add this code into your monobook.js in your local project. This will allow the script to avoid API requests and should save you some traffic.
Optional parameters
urlDecoderKey = 'c' //accesskey
urlDecoderIntLinks = true //also decode existing [[internal links]] in selected text