Chain called hit alert

Helps you from unknownly claiming a faction hit

当前为 2020-09-24 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 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);