Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

MediaWiki:Gadget-challenge-live-tracker.js

MediaWiki interface page

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
( function ( $ ) {
	'use strict';
	
	$( function() {
		var $bubbles = $( '#cl-tracker' ).children();
		
		var today = new Date(
			new Date().toLocaleString( 'en-US', { timeZone: 'Asia/Tokyo' } )
		);
		var day = today.getDay();
		
		if ( today.getHours() < 4 ) { // go back a bubble if before 4 AM
			day = ( day - 1 + 7 ) % 7; // wrap between 0-6
		}
		
		if ( day === 0 ) { // 0 is sunday, which is day 7 in CL
			day = 7;
		}
		
		$bubbles.each( function( index ) {
			if ( index < day ) {
				$( this ).addClass( 'cl-bubble-complete' );
			}
		} );
	} );
	
} )( jQuery );
Cookies help us deliver our services. By using our services, you agree to our use of cookies.