MediaWiki:Mobile.js: Difference between revisions

MediaWiki interface page
imported>76561198018895007
(Created page with "→‎All JavaScript here will be loaded for users of the mobile site: const countDownDate = 'January 21 2021 07:00:00 GMT+0000'; function getTimeRemaining(endtime) {...")
 
imported>76561198018895007
No edit summary
 
Line 1: Line 1:
/* All JavaScript here will be loaded for users of the mobile site */
/* All JavaScript here will be loaded for users of the mobile site */
/*
     const countDownDate = 'January 21 2021 07:00:00 GMT+0000';
     const countDownDate = 'January 21 2021 07:00:00 GMT+0000';


Line 32: Line 33:


     initializeClock('launch_timer', countDownDate);
     initializeClock('launch_timer', countDownDate);
*/

Latest revision as of 05:19, 23 January 2021

/* All JavaScript here will be loaded for users of the mobile site */
/*
     const countDownDate = 'January 21 2021 07:00:00 GMT+0000';

    function getTimeRemaining(endtime) {
        const total = Date.parse(endtime) - Date.parse(new Date());
        const seconds = Math.floor((total / 1000) % 60);
        const minutes = Math.floor((total / 1000 / 60) % 60);
        const hours = Math.floor((total / (1000 * 60 * 60)) % 24);
        const days = Math.floor(total / (1000 * 60 * 60 * 24));
        return {
          total: total, 
          days: days, 
          hours: hours,  
          minutes: minutes, 
          seconds: seconds
        };
    }
    function tick(id, endtime) {
      const clock = document.getElementById(id);
      if(clock != null)
      {
    	const t = getTimeRemaining(endtime);
    	clock.innerHTML = t.days + "d " + t.hours + "h " + t.minutes + "m " + t.seconds + "s ";
        if (t.total <= 0) { clearInterval(timeinterval); }
      }
    }

    function initializeClock(id, endtime) {
        const timeinterval = setInterval(function() { tick(id, endtime) }, 1000);
        tick(id, endtime);
    }

    initializeClock('launch_timer', countDownDate);
*/
🍪 We use cookies to keep session information to provide you a better experience.