Munzee Links

Show some more links in the main menu

目前為 2018-03-30 提交的版本,檢視 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Munzee Links
// @version      0.1
// @description  Show some more links in the main menu
// @author       rabe85
// @match        https://www.munzee.com/*
// @grant        none
// @namespace    https://greasyfork.org/users/156194
// ==/UserScript==

(function() {
    'use strict';

    function munzee_links() {

        // Bootstrap Script laden
        var bootstrap_script_start = document.createElement('script');
        var bootstrap_script_function = document.createTextNode('$(window).load(function(){ $(\'.tooltip-helper\').tooltip(); });');
        bootstrap_script_start.appendChild(bootstrap_script_function);
        document.head.appendChild(bootstrap_script_start);


        // User eingeloggt?
        var usermenu_logged_in = document.getElementsByClassName('user')[0];
        if(usermenu_logged_in) {

            // Navbar
            var navbar0 = document.getElementsByClassName('nav-short tooltip-helper');
            for(var nav = 0, navbar; !!(navbar=navbar0[nav]); nav++) {
                var navbar_original_title = navbar.getAttribute("data-original-title");

                // Special Munzees Map
                var map_specials = ' <li class="hidden-xs nav-short tooltip-helper" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="View Special Munzees Map"><a href="https://www.munzee.com/specials/"><i class="fa fa-globe"></i><img src="https://munzee.global.ssl.fastly.net/images/pins/svg/nomad.svg" alt="Special Map" style="width: 100%; max-width: 12px; height: auto;"><span class="visible-xs">Special Map</span></a></li>';
                // Munzee Gardens Map
                var map_gardens = '<li class="hidden-xs nav-short tooltip-helper" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="View Munzee Gardens Map"><a href="https://www.munzee.com/gardens/"><i class="fa fa-globe"></i><img src="https://munzee.global.ssl.fastly.net/images/pins/svg/virtualemerald.svg" alt="Gardens Map" style="width: 100%; max-width: 12px; height: auto;"><span class="visible-xs">Gardens Map</span></a></li>';

                // User ist Premium?
                var premium_new_deploys = '';
                var user_premium = document.getElementsByClassName('fa fa-star')[0];
                if(user_premium) {
                    // Premium Member: New Deploys In Your Area
                    premium_new_deploys = '<li class="hidden-xs nav-short tooltip-helper" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="New Deploys In Your Area"><a href="https://statzee.munzee.com/player/where/"><i class="fa fa-globe"></i><img src="https://munzee.global.ssl.fastly.net/images/pins/svg/premiumpersonal.svg" alt="New Deploys In Your Area" style="width: 100%; max-width: 12px; height: auto;"><span class="visible-xs">New Deploys In Your Area</span></a></li>';
                }

                // Add all new icons after map icon
                if(navbar_original_title == "View Munzee Map") navbar.insertAdjacentHTML('afterend', map_specials + map_gardens + premium_new_deploys);
            }

        }

    }


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

})();