Munzee Coins

Count the discovered coins

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==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://greasyfork.org/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);
    }

})();