User:Scottywong/diffconverter

Script installationEdit

  1. Copy the text below and paste it into the bottom of your skin script file:
    importScript('User:Scottywong/diffconverter.js'); //[[User:Scottywong/diffconverter.js]]
    
  2. Save the page.
  3. Bypass your browser cache.

Using the scriptEdit

Diffconverter is a simple script to assist with converting diff URL's into the {{diff}} template format (and it will also convert URL's for previous article revisions into the {{oldid}} template). Note that this script can only be used while you are editing an article (i.e. while you are looking at the edit window). To use it:

  1. Copy and paste the diff URL into the edit window.
  2. Select the entire URL with your mouse.
  3. Press Ctrl-Alt-D on your keyboard. The script will parse the URL and replace it with a properly formatted {{diff}} template.
  4. Replace the last parameter of the {{diff}} template (which by default will be filled in with "Diff of <article name>") with the text that you'd like the diff link to display.

Alternately, you can also select a previously formatted diff link (select everything including the square brackets), for instance:

[http://en.wikipedia.org/w/index.php?title=Main_Page&diff=139993&oldid=139992 Second edit to the main page]

and the script will create a properly formatted {{diff}} template with "Second edit to the main page" as the label.

DisclaimerEdit

This script has been tested and works with the Google Chrome 8.0 and Firefox 3.6 web browsers, but may not work with other browsers (because many browsers detect keyboard activity and selected text a little differently). If you'd like to use this script but it's not working in your preferred browser, either switch to Chrome or Firefox, or leave me a message on talk page and I'll see if I can fix it to be more compatible.