Jump to content

User talk:Magnus Manske/fixdisambig.js

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

This JavaScript can help you in fixing disambiguation links. To use it, add the following line to your monobook.js user subpage:

importScript('User:Magnus Manske/fixdisambig.js');

How it works[edit]

Say you're looking at article [[A]]. From there, you follow a link to article [[B]]. It turns out that [[B]] is a disambiguation page, with a list of potential meanings of "B". Since you have just been to [[A]], you probably know which of these meanings is the correct one for [[A]].

Say, [[A]] should really link to [[B (foo)]].

  • If you see [[B (foo)]] written out on [[B]], text-select it, then click on Fix disambig in the sidebar.
  • If the () part is not visible, just click on Fix disambig and edit the correct target manually in the pop-up box.

In any case, the script will then load the edit mode for [[A]], and try to replace all links to [[B]] with [[B (foo)]]. It also describes what it has done in the edit summary.

The script will then load the "diff" mode, showing you all the replacements it has performed. If you're satisfied with that, just click on "Save page", and you're done.

Tech stuff[edit]

If you encounter any bugs or want new features, feel free to edit the source, or leave a comment here.

Does not work with Secure login[edit]

Magnus,

Great tool! However, I'm trying to make a habit of editing via the secure login, and the tool fails in that mode. I suspect it's because the web addresses look like https://secure.wikimedia.org/wikipedia/en/wiki/... instead of what you get on the standard login.

I might be able to hack my way through the appropriate code changes, but someone else would be much more able, I'm sure. –RHolton– 01:32, 8 October 2007 (UTC)[reply]

Should work now. I also fixed an issue with going via redirects. --Magnus Manske 11:08, 8 October 2007 (UTC)[reply]

A more generalized tool[edit]

How hard would it be to make this work for any sort of disambiguating title, not just one with parentheses? If a link to a disambiguating page does not include a pipe, then replace the link with the selected target, and pipe with the original link. If the link to the disambiguating page does include a pipe, then just replace the left side of the pipe, leaving the right side unchanged. –RHolton– 01:57, 12 October 2007 (UTC)[reply]