Jump to content

User:Sunrise/Scripts/AjaxInlineDiffs

From Wikipedia, the free encyclopedia

This is a script that combines the Ajax watchlist by User:Theopolisme with the in-place diff script by User:Writ Keeper. These two scripts are not compatible with each other if imported separately, because the in-place diffs will only be available before the first refresh of the watchlist. This script is identical to the Ajax watchlist, except for the added command to call the diff script after each Ajax refresh. (The difference can be seen here.)

I don't actually know JavaScript (I figured out the code by trial and error plus Google), so if anyone knows how the script could be improved, please let me know. Two specific issues are:

  • If you're viewing a diff when the watchlist updates, it will reset. This effect can be reduced by changing the watchlist refresh rate, as described on the Ajax documentation page.
  • Since the diff script is called again at each refresh of the watchlist, the link will briefly disappear and reappear.

Since the diff script won't run until the first time the watchlist updates, you will still need to import the commonHistory.js script so that it runs the first time you load your watchlist. So to use this script, add the following to your common.js page and clear your cache:

importScript("User:Writ Keeper/Scripts/commonHistory.js");
importScript("User:Sunrise/Scripts/AjaxInlineDiffs.js");

or, if you have already imported the commonHistory.js script:

importScript("User:Sunrise/Scripts/AjaxInlineDiffs.js");

It seems to work if the regular Ajax watchlist is also activated, although it appears to lengthen the "cooldown" of the links on each refresh.