Chain called hit alert

Helps you from unknownly claiming a faction hit

目前為 2020-09-24 提交的版本,檢視 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Chain called hit alert
// @namespace    http://tampermonkey.net/
// @version      0.3
// @description  Helps you from unknownly claiming a faction hit
// @author       Sil3ntOne [2008029]
// @match        https://www.torn.com/*
// @grant        none
// ==/UserScript==

(function(d) {
    'use strict';

    var currentCount = parseInt(d.querySelector('#barChain [class*="bar-value"]').innerText.split('/')[0]);
    console.log(currentCount);

    var limits = [250, 500, 1000, 2500, 5000, 10000, 25000, 50000, 100000];

    for(var limit of limits) {
        var diff = limit - currentCount;
        console.log(diff);
        if(diff <= 10 && diff > 0) {
            if(localStorage.factionChainHitCallMsgAck != limit) {
                var resp = confirm("The " + limit + "th hit might have been called by someone.\nPlease check your faction chat to confirm.\n\nPlease confirm that you have read & acknowleged this message.");
                if(resp) {
                    localStorage.factionChainHitCallMsgAck = limit;
                }
            }
        }
    }

    if(typeof localStorage.factionChainHitCallMsgAck != "undefined") {
        if(currentCount >= localStorage.factionChainHitCallMsgAck) {
            // Reset the ack after the limit has been crossed.
            delete localStorage.factionChainHitCallMsgAck;
        }
    }
})(document);