TBD: TorrentBD Ratio Guard

Warns you if you're trying to download a torrent that will push your ratio into the danger zone.

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください。
// ==UserScript==
// @name         TBD: TorrentBD Ratio Guard
// @namespace    https://naeembolchhi.github.io/
// @version      0.10
// @description  Warns you if you're trying to download a torrent that will push your ratio into the danger zone.
// @author       NaeemBolchhi
// @license      GPL-3.0-or-later
// @icon         data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAHYgAAB2IBOHqZ2wAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAACAASURBVHic7Z13eFxXmf8/505RHY16l1WsUbHc414ky7Fj0h2SGAIpJJSls+wuGzZhKQssdZey+7CwCyxl+QGBQCokpLjELY4TO+62XGRbdiwX9T4z9/z+kB0cx9KMNOdO0/k8T574kWbe82rmnu8959y3gEaj0Wg0Go1Go9FoNJqJgIi0A5rw8oiUtrzDHTeaiHpDUiZBSsFxgbn+bGXGn9YI4Y+0j5rwoQVggrD55Mkkb1/qR6UQnwaKRnjZKSHldxzJPT9YVFLSH07/NJFBC0Ccs327dPSmdd4v4fOMPPGv5KwQ/Hsv7u/e4BGDVvqniSxaAOIUKaWx/nDn7Ui+Bkwep5kTAr5qnnL/tLFR+FT6p4kOtADEGX9qkgkpZse7pBAPAdWKzB4TyO8N9A/+eNWM/F5FNjVRgBaAOGFDU3eO3/R9TAjxcSDLomHOS/iJw/R+f0lNzmmLxtCEES0AMc5Lhzoq/MhPgfgAkBymYQeR8hGJ7V8bq9MOhGlMjQVoAYhBpJTGhsOdKyR8BMktgBEhV0zgcQk/WOZxvyCEkBHyQzNOtADEEGuPtacbXrFGDt/xp0Tanys4LAQ/Nk3jJ43Vaecj7YwmOLQARDmPSGnLOdK1EinfJySrgYRI+xSAAeCPQvCz+kr380IIM9IOaUZGC0CU8tL+riqf4X+PEOI+oCzS/owPcV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xI9LyUNAWoTdGQL5Q+ngC43lGWqLEGgsRwtADLP2YFe2EP5/BvFRwp/abQKPCpMHG2rSj4V5bI0itADEAS8e6Ko2DPPLwB2E5zt9XiI/o9tsxz5aAOKIFw91zjeQ3wTqLRlAsF34ebChJv1FS+xrwo4WgDhk7aGOFQK+A0xVZPKEgK/We9w/FkJET0MCTchoAYhT1q6VdqOo8wGJ/GIIRUrbhOCbvbi/e7HwqSbO0AIQ54zziUGfhP/AIb+uT/bjGy0AE4Tnj/bk2X3eh0F8AEga4WUDEn5uSt+Xr63OPhVO/zSRQQvABOOl4x0ZviFxo2HKOimG048lHDek3O81bU+tqE27EGEXNRqNRqPRaDQajUaj0Wg0ivn/SWqpNcs9KZEAAAAASUVORK5CYII=
// @match        https://*.torrentbd.com/torrents-details.php?id=*
// @match        https://*.torrentbd.net/torrents-details.php?id=*
// @match        https://*.torrentbd.org/torrents-details.php?id=*
// @match        https://*.torrentbd.me/torrents-details.php?id=*
// @run-at       document-end
// @grant        none
// ==/UserScript==

// Update Material Icons Font
try {document.querySelector("link[href*='material-icons.css']").href = "https://fonts.googleapis.com/icon?family=Material+Icons";} catch(e) {}

// Global reusable flags
let infinite, freeleech;

// Upload value, download value, ratio value.
const coreValue = document.querySelectorAll(".card-content .profile-info-table tbody tr"),
      coreUpload = coreValue[0].children[1].innerText.replace(": ","").replace(",","").replace(" ",""),
      coreDownload = coreValue[1].children[1].innerText.replace(": ","").replace(",","").replace(" ",""),
      coreRatio = coreValue[2].children[1].innerText.replace(": ","").replace(",","").replace(" ",""),
      torrentSize = document.querySelectorAll(".torrent-info tbody tr")[0].children[1].innerText.replace(",","").replace(" ","");

if (coreDownload.match(/inf/i)) {
    infinite = true;
}

if (document.querySelectorAll(".torrent-info tbody tr")[0].querySelector("img[src*='free']")) {
    freeleech = true;
}

// Units and conversion values
const unitCalc = [
    {"unit": "YiB", "math": "80"},
    {"unit": "ZiB", "math": "70"},
    {"unit": "EiB", "math": "60"},
    {"unit": "PiB", "math": "50"},
    {"unit": "TiB", "math": "40"},
    {"unit": "GiB", "math": "30"},
    {"unit": "MiB", "math": "20"},
    {"unit": "KiB", "math": "10"},
    {"unit": "B", "math": "0"}
];

function byteGet(value) {
    for (let x = 0; x < unitCalc.length; x++) {
        if (value.match(unitCalc[x].unit)) {
            let multiplicand = parseFloat(value.replace(unitCalc[x].unit,"")),
                multiplier = Math.pow(2,parseInt(unitCalc[x].math)),
                product = multiplicand*multiplier;
            return product;
        }
    }
}

// Calculate future ratio after downloading the viewing torrent
function futureRatio() {
    let realize;
    if (infinite === true) {
        realize = byteGet(coreUpload)/byteGet(torrentSize);
    } else {
        realize = byteGet(coreUpload)/(byteGet(coreDownload)+byteGet(torrentSize));
    }
    return realize.toFixed(2);
}

// Guard info for various ratio levels
const ratioState = [
    {"state": "1.0", "icon": "gpp_good", "text": "Safe", "color": "#4caf50"},
    {"state": "0.9", "icon": "notification_important", "text": "Risky", "color": "#63b04e"},
    {"state": "0.8", "icon": "notification_important", "text": "Risky", "color": "#97b246"},
    {"state": "0.7", "icon": "warning", "text": "Dangerous", "color": "#cab33a"},
    {"state": "0.6", "icon": "warning", "text": "Dangerous", "color": "#f3ad2b"},
    {"state": "0.5", "icon": "file_download_off", "text": "Critical", "color": "#ff9f25"},
    {"state": "0.4", "icon": "file_download_off", "text": "Critical", "color": "#ff862b"},
    {"state": "0.3", "icon": "do_not_disturb_on", "text": "Fatal", "color": "#ff6931"},
    {"state": "0.2", "icon": "do_not_disturb_on", "text": "Fatal", "color": "#f64d35"},
    {"state": "0.1", "icon": "gpp_maybe", "text": "Deadly", "color": "#f44336"}
];

// Ratio Guard Button
let guardIcon = "sync_problem",
    guardText = "Sync Error",
    guardColor = "#400307",
    guardRatio = "???";

(function() {
    let ratio = parseFloat(futureRatio());
    guardRatio = futureRatio();
    for (let x = 0; x < ratioState.length; x++) {
        if (ratio <= parseFloat(ratioState[x].state)) {
            guardIcon = ratioState[x].icon;
            guardText = ratioState[x].text;
            guardColor = ratioState[x].color;
        }
    }
    if (ratio > parseFloat(ratioState[0].state)) {
        guardIcon = ratioState[0].icon;
        guardText = ratioState[0].text;
        guardColor = ratioState[0].color;
    }
    if (freeleech) {
        guardIcon = ratioState[0].icon;
        guardText = ratioState[0].text;
        guardColor = ratioState[0].color;
        guardRatio = "No Change";
    }
})();

// Content of Guard Button
const guardInfo = `
<style>
  #guard-btn {
    color: ${guardColor};
    border-color: ${guardColor};
    background: transparent;
  }
  #guard-btn:hover, #guard-btn:active {
    color: whitesmoke;
    background: ${guardColor};
  }
  #guard-btn span.hide-guard {
    display: none;
  }
</style>
<a id="guard-btn" class="btn waves-effect inline tgaction" onclick="swapGuard()">
  <i class="material-icons left">${guardIcon}</i>
  <span>${guardText}</span>
  <span class="hide-guard">${guardRatio}</span>
</a>
`;
const guardJS = `
function swapGuard() {
  let spanGuard = document.querySelectorAll("#guard-btn span");
  if (spanGuard[0].className.match(/hide/)) {
    spanGuard[0].classList.remove("hide-guard");
    spanGuard[1].classList.add("hide-guard");
  } else {
    spanGuard[1].classList.remove("hide-guard");
    spanGuard[0].classList.add("hide-guard");
  }
}
`;

// Button Wrapper Elements
const downBtn = document.getElementById("dl-btn"),
      downWrp = downBtn.parentNode,
      downDiv = downWrp.parentNode;

// Function for adding Guard Button
function addGuard(info, js) {
    let guard, script;
    guard = document.createElement("div");
    guard.classList.add("torrtopbtn-wrapper");
    guard.innerHTML = info;
    downDiv.insertBefore(guard, downWrp);
    downDiv.innerHTML = downDiv.innerHTML.replace(/>\s+</g,'><');
    script = document.createElement("script");
    script.setAttribute("type","text/javascript");
    script.innerHTML = js;
    downDiv.appendChild(script);
}

// Appending Guard Button
addGuard(guardInfo, guardJS);