Jump to content

Wikipedia:WikiProject User scripts/Scripts/TimeTraveller

From Wikipedia, the free encyclopedia

This user script allows you to browse Wikipedia as it was at a given time in the past. It simplifies the investigation of the history of a discussion for example, as it allows you to move from a discussion to the corresponding articles or other pages, as they appeared at that day in the past.

Without this script, when you click on a link in an old page, you get the current version of the requested page, not its old one. To find the old one, you would need to search the corresponding pages manually in the history pages: what a waste of time!

How to use it

[edit]

In most cases, the following steps will activate the script for you:

  • Make sure you are logged in. The script is available only to logged in users
  • Open your monobook.js page and start editing it
  • Insert the following line:
importScript('Wikipedia:WikiProject User scripts/Scripts/TimeTraveller.js');
  • Save your edit
  • Refresh the page. In some browsers, this is done by holding down the Ctrl key, and pressing F5

To verify proper activation, open this August 31, 2008 version of the Wikipedia article and click on the "free" hyperlink in the first line of the article: it should open an old revision of the "Free content" article, dated 30 August 2008. If not, you can find more detailed user script installation instructions here

After activation of the script, the talk pages will show the dates in the signature of posts as links (not as plain text). When you click on such a date link, the page reloads as it appeared at that time. When you click on a link in that old page, it will lead you to the corresponding page, as it was at the time of the post. That's how it should have worked in the first place, isn't it ? To stop browsing in the past, click on the "current version" link on top of the page.

(We show the current images and templates though. Also, you'll see the link go red very briefly when you bring the mouse on it: that's when we call the Wikipedia server to get the appropriate revision of the linked page.)

If you like the script, share the good news. Add a user box to our user page by inserting the following line in it:

{{userscripts|* [[Wikipedia:WikiProject User scripts/Scripts/TimeTraveller|TimeTraveller]]}}

Users

[edit]

Click here for a list of users of this script.

Known issues

[edit]
  • Need to deal better with the case when the old page does not exist (because the page was not yet created at that time). Strangely enough, that happens sometimes, e.g. for user pages.
Fixed issues

Added in 2.0:

  • add links to the dates in talk pages

Fixed in 1.1:

Fixed in 1.0:

  • the link to the current revision should show the current version, not the old one !

Contributors

[edit]

Possible improvements:

  • don't use onmouseover if the browser is not Firefox. Update the URL of the anchor instead.
  • add a way to search the history, as in WikiBlame, as another mean to set the date in the past.

Technical notes

[edit]
Test sequence
  • select an article (e.g. this one), go to its history page, and open an old page
  • click on 'article' in the top menu, check the version date, then click on the 'back' of your browser. Same for 'discussion' and 'history'
  • click on 'current revision' --> open the current revision, not an old one
  • click on a link in the body of the article --> opens the old version of that article
  • click on links several pages down, and come back using the back button
  • move the mouse quickly over 2 links that are close to each other: the first one stays red, indicating that the API call could not complete before moving over the second link. Bring the mouse over it again, and it turns blue again. Click on it to open the page.
  • test a link to a page with special characters, e.g. WP:Administrators' noticeboard
  • on a talk page, click on a date link, the page reloads as of that date
  • in a talk archive, click on a date link, and the talk page (not the archive) reloads as of that date
Notes

We use the mouseover event to update the href of the anchor, so that when the anchor is clicked, the history of the browser is properly updated, allowing use of the back button of the browser. An alternative design is to use a javascript in the href of the anchor to fetch the old revision, and set window.location, but this does not update the browser history in Firefox.