More actions
Content deleted Content added
mNo edit summary |
mNo edit summary |
||
(5 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
(function ( $ ) { |
( function ( $ ) { |
||
'use strict'; |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
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 |
|||
} |
|||
⚫ | |||
day = 7; |
|||
} |
|||
$bubbles.each( function( index ) { |
|||
if ( index < day ) { |
|||
⚫ | |||
} |
|||
} ); |
|||
} ); |
|||
⚫ | |||
⚫ | |||
⚫ | |||
} |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ |
Latest revision as of 05:58, 22 December 2021
( 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 );