GT - Summoning Room Time Checker

To notify hunters if time is up for a glyph

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         GT - Summoning Room Time Checker
// @version      2.2
// @description  To notify hunters if time is up for a glyph
// @author       Rani Kheir
// @include      *www.ghost-trappers.com/fb/hunt.php*
// @include      *www.ghost-trappers.com/fb/camp.php*
// @namespace https://greasyfork.org/users/4271
// ==/UserScript==

(function() {
    'use strict';
    var x_x = $.get("/fb/eleventh_floor.php", function( response ) {
        var y_y = x_x.responseText;

        try {
            var arrayTimes = $(response).find('.timerText');
            if (arrayTimes.length === 0) { throw "No items!"; }
            var time = "";
            var glyphName = "";

            // div creation
            var divForSummoner = document.createElement("DIV");
            divForSummoner.id = "summonerDetails";
            document.getElementById("rightContainer").appendChild(divForSummoner);

            // adding div header and spacing
            var spanE = document.createElement("span");
            var te = document.createTextNode("Active Glyphs");
            spanE.appendChild(te);

            divForSummoner.appendChild(document.createElement("BR"));
            divForSummoner.appendChild(spanE);
            divForSummoner.appendChild(document.createElement("BR"));
            divForSummoner.appendChild(document.createElement("BR"));

            // Adding all running glyphs to div
            for (var i = 0; i < arrayTimes.length; i++) {
                glyphName = $(arrayTimes[i]).parent().find('.glyphName')[0].innerHTML;
                divForSummoner.appendChild(document.createTextNode(glyphName + ": " + arrayTimes[i].innerHTML));
                divForSummoner.appendChild(document.createElement("BR"));
            }

            // Styling div through jQuery, and title through span vanilla js
            $(divForSummoner).css({ 'color': 'white', 'font-size': '100%', 'text-align': 'center' });
            spanE.style.fontWeight = 'bold';
            spanE.style.fontSize = 'larger';

        } catch (e) {}

        if (y_y.search("time is over") > 0) {

            // Confirm dialogue box
            var result = confirm("Glyph time has run out!\n\nGo to 11th Floor now?");
            if (result === true) {
                window.location.href = "/fb/eleventh_floor.php";
            }

            // for testing
            //document.getElementById("profile_gbp").innerHTML = "";
        }

        // for testing
        //document.getElementById("profile_gbp").innerHTML = "";
    });
})();