User:Davidgothberg/clock

This is the documentation for the DavidClock user script.

This is the documentation for the DavidClock user script.

This script puts an UTC clock in the upper right corner of all pages, like this:

...    My talk    My preferences    My watchlist    My contributions    Log out    10:25    10:22    9 Aug

It can show one or several of these things:

  • A ticking clock in UTC time. Same time as the Wikipedia servers use.
  • A static clock that shows when the page was loaded.
  • A static date that shows when the page was loaded.

As a bonus the clocks are links to purge the page and to edit section 0.

Note that this clock runs of your local computer clock. If you have the wrong time in your computer then this clock will also be wrong.

Usage

To use this script put the below code in your personal /vector.js page. (If you are using another skin, here's a link to your personal skin file.)

importScript( "User:Davidgothberg/clock.js" );

Nowadays scripts here on Wikipedia usually start working immediately (on next page load). But if not, then you need to wait one minute for the servers to update, then bypass your browser cache to load the clock the first time.

Advanced usage

The default is to show both the ticking and the static clock, and the clock ticks once a minute. This can be changed by adding one of the lines below to your "/monobook.js" page:

window.davidClock = -60;  //Only ticking clock, every minute.
window.davidClock = -5;   //Only ticking clock, every 5 seconds.
window.davidClock = 0;    //Only static clock
window.davidClock = 5;    //Static + ticking clock, every 5 seconds.
window.davidClock = 60;   //Static + ticking clock, every minute.
window.davidClock = 120;  //Static + ticking clock, every 2 minutes.

Don't set below 60 seconds on slow computers.

The current default is to show the date. To disable or enable the date add one of the lines below to your "/monobook.js" page:

window.davidClockDate = 0;  //Don't show the date.
window.davidClockDate = 1;  //Show the date.

We might change this default if people don't like it. Tell me what you think on my talk page. The reason we use 0/1 instead of false/true is that we might want to add more date styles later on, then we might need "window.davidClockDate = 2;" and so on.

Technical details

Tested and works in Firefox 2.0, Opera 9.02 and Internet Explorer 5.5.

Works in the following Wikipedia skins: Vector, MonoBook, Chick, Modern, MySkin, Simple. Has no effect in the other skins.

The script itself (the javascript code) is at User:Davidgothberg/clock.js.

The only thing that runs on each tick is the small inner function updateTimeMinutes() or updateTimeSeconds(), thus very efficient.

Based on code from AzaToth, Ilmari Karonen and Voice of All. This script was created by and is maintained by: David Göthberg

See also

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.