User:Largoplazo/watchpoint.js/doc

From OpenWetWare
Jump to: navigation, search

The WatchPoint user script is a watchlist utility that will shade the background of all entries that occurred before a given entry of your selection, including earlier sub-entries of later entries, making it easier to distinguish newer entries from older ones. It is designed for use with the Enhanced Recent Changes feature in your Wikipedia preferences.

In the initial watchlist view, with WatchPoint installed, clicking the time of day at the beginning of any main-level entry causes two things to happen:

  1. All earlier entries, as well as their sub-entries (individual edits), are given a shaded background.
  2. All earlier sub-entries of later main-level entries are also given a shaded background.

For example, given:

09:02 ...
      09:02 ...
      08:37 ...
      08:15 ...
      07:42 ...
08:58 ...
08:52 ...
08:29 ...
08:17 ...
08:10 ...
08:06 ...

Clicking 08:29 produces the following:

09:02 ...
      09:02 ...
      08:37 ...
      08:15 ...
      07:42 ...
08:58 ...
08:52 ...
08:29 ...
08:17 ...
08:10 ...
08:06 ...

Requirements

At present, the WatchPoint feature is configured to load only in Firefox, as (a) the code isn't working in Internet Explorer and (b) the code hasn't been tested in any other browser (including, as a matter of fact, versions of Firefox earlier than version 3).

WatchPoint has not been tested with any skin other than MonoBook.

WatchPoint assumes that the Enhanced Recent Changes feature in your Wikipedia preferences is turned on. When Enhanced Recent Changes is turned off, every edit is shown individually and there would be no benefit to using WatchPoint anyway.

Installation

To install WatchPoint, assuming you are using the MonoBook skin, add the following line to your monobook.js script:

importScript('User:Largoplazo/watchpoint.js');

Afterwards, be sure to bypass your cache.

Technical details

Conditions for loading

The WatchPoint script creates a global Javascript variable called watchPoint. It does this only when both of the following are true:

  • The current page is the watchlist.
  • The browser is Firefox.

If Enhanced Recent Changes is turned on<ref>This is guessed at by relying on the fact that at present the enhanced watchlist includes <tt> elements but the plain version doesn't.</ref>, the script then turns the time of day for each main entry into a hyperlink.

Background color

The default shading color is "#ddd". This may be replaced by assigning any other CSS-compatible color value to the property watchPoint.bgColor:

watchPoint.bgColor = "magenta";

or

watchPoint.bgColor = "#ffffcc";

Time of day

Since the times given for main entries and sub-entries are in hours and minutes, the background of entries below the entry whose time is clicked will remain (or turn) white if their listed time of day is the same as the one that was clicked, even if they are lower on the page.

18:04 ...
18:03 ...
18:03 ...
18:03 ...
18:02 ...

Clicking any of the 18:03 links will cause the 18:02 entry to be shaded, but the background of all of the 18:03 entries will still be white.

Questions and comments

Please leave any communications regarding this script on this article's talk page.

Footnotes

<references group=""></references>