[WikiEN-l] Toolspam: Insert references from viewing mode

Magnus Manske magnusmanske at googlemail.com
Mon Mar 23 17:07:54 UTC 2009


I found it annoying that, to enter a new reference, you'd have to go
to edit mode, find the position again, and then put in the reference.

So I wrote a little javascript...
http://en.wikipedia.org/wiki/User:Magnus_Manske/insertref.js

Works like this:
1. In /view/ mode, select some text (has to be unique, no fotmatting)
2. Click on the "Insert reference" link in the toolbox
3. The script internally loads the raw wikitext, looks if it can find
the selected text uniquely in the wikitext (stops with error
otherwise)
4. The script asks for the reference text and "insert right or left of
selection"
5. The script adds <references/> section if necessary, then opens edit
mode with the changes made, ready to save

Some issues:
* If you select a (unique) link, it will try to "break out" of the
link before inserting the reference, but success is not guaranteed
* I couldn't make it open diff mode by default - yet...
* Some fancier reference entry mechanism would be nice. Ideas?
* It might be possible to make the selection mechanism more
"formatting-tolerant"
* This mechanism could be used to enter other things (turn text into a
link, add images, templates, etc.) - might be worth investigating

Cheers,
Magnus



More information about the WikiEN-l mailing list