Jump to content

user:js/urldecoder

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Alex Smotrov (talk | contribs) at 21:41, 15 July 2010 (new button file:Link_go.png, now works in new toolbar as well, rm Localization: now using only included JS vars). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

urlDecoder button

 [http://meta.wikime…
 [[meta:Page]]

urldecoder
Browsers *
Skins *
Code urldecoder.js
Released April 24, 2009; 16 years ago (2009-04-24)
Updated July 15, 2010; 14 years ago (2010-07-15)
Developer   AlexSm

urldecoder is a userscript for easy pasting links into wikicode:
paste any URLs and type the link name (if needed)

http://de.wikipedia.org/wiki/Ding this page|

then press the urlDecoder button button:

[[:de:Ding|this page]]

the script will automatically add brackets to form an external link and, if possible, will convert it into internal link.

Features

  • While trying to convert the link into InterWikimedia link, the script will recognize all multilingual projects (Wikipedia, Wiktionary, etc.) and also Meta, MediaWiki, Commons and MediaZilla.
  • URL from secure login browsing will be converted to normal link;
  • URL will also be percent-decoded from %-sequences into normal chars:
    http://…a%26bhttp://…a&b
    this is tremendously useful in non-Latin language projects where most URLs look like %D1%EB%F3%E6…
  • By selecting some text and then pressing the button you can simplify all URLs inside.

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')

Notes

  • While converting the link to internal, the script will correctly add leading colon for category and file links, and for interwiki links, with the exception of article and category pages, where you can use the script for adding interwikis and categories.
  • The script will also decode links anchors, although in some rare cases the correct decoding is impossible. For example, #2$ и #2.24 produce the same encoded anchor.
  • This script is a gadget in Russian Wikipedia.

Optional parameters

urlDecoderKey = 'c' //accesskey (works only in old toolbar)
urlDecoderIntLinks = true //also decode existing [[internal links]] in selected text