Munzee Time Zone

Change the time zone for the (mouseover) times at the munzee website

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         Munzee Time Zone
// @namespace    https://greasyfork.org/users/156194
// @version      0.1
// @description  Change the time zone for the (mouseover) times at the munzee website
// @author       rabe85
// @match        https://www.munzee.com/m/
// @match        https://www.munzee.com/m/*
// @match        https://statzee.munzee.com/player/day/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    function munzee_time_zone() {

        const TimeString = { year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit', second: '2-digit', timeZone: 'Europe/Berlin', hour12: false };

        // Munzee - Player pages
        function change_all(type) {
            var classname_at0 = document.getElementsByClassName(type + '-at');
            for(var at = 0, classname_at; !!(classname_at=classname_at0[at]); at++) {
                var classname;
                if(type == 'expires') {
                    classname = new Date(parseInt(classname_at.getAttribute('data-' + type + '-at')));
                } else {
                    classname = new Date(classname_at.getAttribute('data-' + type + '-at'));
                }
                classname_at.setAttribute('title', classname.toLocaleDateString('de-DE', TimeString));
            }
        }

        change_all('deployed');
        change_all('expires');
        change_all('captured');
        change_all('wrote');


        // Statzee - Daily Stats
        var stats_table0 = document.querySelectorAll('td');
        for(var hq = 0, stats_table; !!(stats_table=stats_table0[hq]); hq++) {
            if(stats_table.innerHTML.endsWith('HQ Time')) {
                var hq_date = window.location.pathname.split('/')[window.location.pathname.split('/').length - 1];
                var hq_timezone = document.getElementById('hqtime').parentNode.innerHTML.split(')')[0].substr(-1);
                var hq_time = new Date(hq_date + 'T' + stats_table.innerHTML.substr(0, 8) + '-0' + hq_timezone + ':00');
                stats_table.setAttribute('title', hq_time.toLocaleDateString('de-DE', TimeString));
            }
        }

    }

    // DOM vollständig aufgebaut?
    if (/complete|interactive|loaded/.test(document.readyState)) {
        munzee_time_zone();
    } else {
        document.addEventListener("DOMContentLoaded", munzee_time_zone, false);
    }

})();