Munzee Coins

Count the discovered coins

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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

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

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

(I already have a user script manager, let me install it!)

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.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Munzee Coins
// @version      0.1
// @description  Count the discovered coins
// @author       rabe85
// @match        https://www.munzee.com/m/*/coins/discovered/
// @grant        none
// @namespace    https://greatest.deepsurf.us/users/156194
// ==/UserScript==

(function() {
    'use strict';

    function munzee_coins() {

        var cointable = document.getElementsByClassName('table coin-table')[0];
        var coin_discovered_count = 0;
        var coin_type_count = 0;

        var cointypes0 = document.getElementsByTagName('td');
        for(var ct = 0, cointypes; !!(cointypes=cointypes0[ct]); ct++) {
            var cointypes_number = Number(cointypes.innerHTML);
            if(Number.isInteger(cointypes_number)) {
                coin_discovered_count += cointypes_number;
                coin_type_count++;
            }
        }

        var coins_header = document.getElementsByClassName('page-header')[0];
        coins_header.innerHTML = '<h2>Discovered Coins: ' + coin_discovered_count + '&nbsp;&nbsp;&nbsp;<small><i>' + coin_type_count + ' Types</i></small></h2>';

    }


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

})();