User:Nericat/common.js

'use strict';

rswiki.caches = { count: false, init { rswiki.caches.count = window.setInterval(rswiki.caches.tick, 1000); },       tick { let time = Date.now; let timeToNext = 3600 - ((time / 1000) % 3600); if (timeToNext > 3000) { let div = $("cache-timer"); div.css("cache-active"); div.text("Now!"); } else { let minutes = Math.floor(timeToNext / 60); let seconds = Math.floor(timeToNext % 60); if (seconds < 10) { seconds = '0' + seconds; // lolololol implicit type conversions }               let div = $("cache-timer"); div.css("cache-inactive"); div.text(`${minutes}:${seconds}`); }       }    }    rswiki.caches.init; })(this, this.jQuery, this.rswiki = this.rswiki || {});
 * (function(window, $, rswiki) {