Mousehunt Birthday Map Color Coder

MH Birthday event map colour coder

اعتبارا من 07-03-2019. شاهد أحدث إصدار.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

// ==UserScript==
// @name         Mousehunt Birthday Map Color Coder
// @namespace    http://tampermonkey.net/
// @version      1.4
// @description  MH Birthday event map colour coder
// @author       Lim Yi Qin
// @match        https://www.mousehuntgame.com/*
// @include      https://www.mousehuntgame.com/*
// @grant        none
// ==/UserScript==

//credits to @Limerence#0448 for his GWH Map Colour Coder! 
//check out his GWH Map Colour Coder here : https://greasyfork.org/en/scripts/375676-mousehunt-gwh-map-color-coder

function displayHeader() {

    var miceTab = $(".treasureMapPopup-tabHeader").eq(0);

    if (miceTab.hasClass("active")) { //display header if user looking at mice list
        $(".treasureMapPopup-leftBlock-content-default.bdMapHeader").css("display", "inline-flex");
    } else { //hide header
        $(".treasureMapPopup-leftBlock-content-default.bdMapHeader").css("display", "none");
    }

}

function highlightMice() {

    if ($("#highlightMice").is(":checked")) {
        window.localStorage.setItem('highlightPref', 'uncaught-only');
        for (var i = 0; i < 20; i++) {
            var mouseObj = $(".treasureMapPopup-goals-group-goal.treasureMapPopup-searchIndex").eq(i);
            if (mouseObj.hasClass("complete")) {
                $(".treasureMapPopup-goals-group-goal.treasureMapPopup-searchIndex > div > div > span").eq(i).css("background-color", "");
            }
        }
    } else {
        window.localStorage.setItem('highlightPref', 'all');
        colorize();
    }

}

function colorize() {

    var specialMice = [
        "Factory Technician",
        "Vincent, The Magnificent"
    ];

    var standardMice = [
        "Birthday",
        "Buckethead",
        "Dinosuit",
        "Pintail",
        "Present",
        "Sleepwalker",
        "Terrible Twos",
    ];

    var sbMice = [
        "Cheesy Party"
    ];

    var mixingMice = [
         "Force Fighter Blue",
        "Force Fighter Green",
        "Force Fighter Yellow",
        "Force Fighter Red",
        "Force Fighter Pink",
        "Super FighterBot MegaSupreme"
    ];

    var breakMice = [
         "Dance Party",
        "Para Para Dancer",
        "Breakdancer",
        "El Flamenco"
    ];

    var pumpMice = [
         "Time Punk",
        "Time Tailor",
        "Time Thief",
        "Reality Restitch"
    ];

    var qaMice = [
        "Cupcake Runner",
        "Cupcake Cutie",
        "Cupcake Candle Thief",
        "Cupcake Camo",
        "Sprinkly Sweet Cupcake Cook"
    ];

    var bdMaps = [
        "11th Birthday Event Map",
        "Rare 11th Birthday Event Map",
        "Gilded Birthday Treasure Map",
        "Rare Gilded Birthday Treasure Map"
    ];

    var mapName = $(".treasureMapPopup-header-title.mapName").text(); //only show gwh decoration headers if it's a GWH map.
    if (bdMaps.indexOf(mapName) < 0) { //exit function if ajax call is not displaying a GWH map
        return;
    }

    var specialMiceCount = 0;
    var standardMiceCount = 0;
    var sbMiceCount = 0;
    var mixingMiceCount = 0;
    var breakMiceCount = 0;
    var pumpMiceCount = 0;
    var qaMiceCount = 0;

    for (var i = 0; i < 20; i++) {

        var mouseObj = $(".treasureMapPopup-goals-group-goal.treasureMapPopup-searchIndex").eq(i);
        var mouseName = mouseObj.data("search-term");

        if (specialMice.indexOf(mouseName) > -1) {
            $(".treasureMapPopup-goals-group-goal.treasureMapPopup-searchIndex > div > div > span").eq(i).css("background-color", "#c97c49");
            if (!mouseObj.hasClass("complete")) {
                specialMiceCount++;
            }
        } else if (standardMice.indexOf(mouseName) > -1) {
            $(".treasureMapPopup-goals-group-goal.treasureMapPopup-searchIndex > div > div > span").eq(i).css("background-color", "#f06a60");
            if (!mouseObj.hasClass("complete")) {
                standardMiceCount++;
            }
        } else if (sbMice.indexOf(mouseName) > -1) {
            $(".treasureMapPopup-goals-group-goal.treasureMapPopup-searchIndex > div > div > span").eq(i).css("background-color", "#5ae031");
            if (!mouseObj.hasClass("complete")) {
                sbMiceCount++;
            }
        } else if (mixingMice.indexOf(mouseName) > -1) {
            $(".treasureMapPopup-goals-group-goal.treasureMapPopup-searchIndex > div > div > span").eq(i).css("background-color", "#4fcaf0");
            if (!mouseObj.hasClass("complete")) {
                mixingMiceCount++;
            }
        } else if (breakMice.indexOf(mouseName) > -1) {
            $(".treasureMapPopup-goals-group-goal.treasureMapPopup-searchIndex > div > div > span").eq(i).css("background-color", "#cd87ff");
            if (!mouseObj.hasClass("complete")) {
                breakMiceCount++;
            }
        }else if (pumpMice.indexOf(mouseName) > -1) {
            $(".treasureMapPopup-goals-group-goal.treasureMapPopup-searchIndex > div > div > span").eq(i).css("background-color", "#d3e530");
            if (!mouseObj.hasClass("complete")) {
                pumpMiceCount++;
            }
        } else if (qaMice.indexOf(mouseName) > -1) {
            $(".treasureMapPopup-goals-group-goal.treasureMapPopup-searchIndex > div > div > span").eq(i).css("background-color", "#30e5ae");
            if (!mouseObj.hasClass("complete")) {
                qaMiceCount++;
            }
        }

    }

    var specialMiceColor = specialMiceCount > 0 ? "#c97c49" : "#949494";
    var standardMiceColor = standardMiceCount > 0 ? "#f06a60" : "#949494";
    var sbMiceColor = sbMiceCount > 0 ? "#5ae031" : "#949494";
    var mixingMiceColor = mixingMiceCount > 0 ? "#4fcaf0" : "#949494";
    var breakMiceColor = breakMiceCount > 0 ? "#cd87ff" : "#949494";
    var pumpMiceColor = pumpMiceCount > 0 ? "#d3e530" : "#949494";
    var qaMiceColor = qaMiceCount > 0 ? "#30e5ae" : "#949494";

    if ($(".treasureMapPopup-leftBlock-content-default.bdMapHeader").size() == 0) { //only add header if it does not exist

        var isChecked = "";
        try { //get stored checked preference
            if (window.localStorage.getItem('highlightPref') === "uncaught-only") {
                isChecked = "checked";
            }
        } catch (e) {
            console.log('Browser does not support localStorage.');
        }

        var htmlString = "<div class='treasureMapPopup-leftBlock-content-default bdMapHeader' style='display: inline-flex;margin-bottom: 10px;width: 100%;text-align: center;line-height: 1.5;overflow: hidden'>" +
            "<span class='treasureMapPopup-goals-group-goal-name' style='background-color: " + specialMiceColor + ";width: 20%;font-weight: bold;font-size: 13.5px;'>Special<br>" + specialMiceCount + "</span>" +
            "<span class='treasureMapPopup-goals-group-goal-name' style='background-color: " + standardMiceColor + ";width: 20%;font-weight: bold;font-size: 13.5px;'>Standard<br>" + standardMiceCount + "</span>" +
            "<span class='treasureMapPopup-goals-group-goal-name' style='background-color: " + sbMiceColor + ";width: 20%;font-weight: bold;font-size: 13.5px;'>SB<br>" + sbMiceCount + "</span>" +
            "<span class='treasureMapPopup-goals-group-goal-name' style='background-color: " + mixingMiceColor + ";width: 20%;font-weight: bold;font-size: 13.5px;'>Mixing<br>" + mixingMiceCount + "</span>" +
            "<span class='treasureMapPopup-goals-group-goal-name' style='background-color: " + breakMiceColor + ";width: 20%;font-weight: bold;font-size: 13.5px;'>Break<br>" + breakMiceCount + "</span>" +
            "<span class='treasureMapPopup-goals-group-goal-name' style='background-color: " + pumpMiceColor + ";width: 20%;font-weight: bold;font-size: 13.5px;'>Pump<br>" + pumpMiceCount + "</span>" +
            "<span class='treasureMapPopup-goals-group-goal-name' style='background-color: " + qaMiceColor + ";width: 20%;font-weight: bold;font-size: 13.5px;'>QA<br>" + qaMiceCount + "</span>" +
            "</div><span style='vertical-align: middle;float: right'><input id='highlightMice' type='checkbox' style='vertical-align: middle; '" + isChecked + ">Highlight uncaught mice only.</span>";
        $("[data-tab='map_mice'] .treasureMapPopup-leftBlock-content").prepend(htmlString);
        highlightMice();
    }

    $("#highlightMice").change(highlightMice);
    $(".treasureMapPopup-tabHeaderContainer").on("click", displayHeader);

}

$(document).ajaxSuccess(colorize);