Chain Timer Enhancer

Increase the size and move an element with class "bar-descr___muXn5" to the top of the page

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

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

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name         Chain Timer Enhancer
// @namespace    http://tampermonkey.net/
// @version      1.4
// @description  Increase the size and move an element with class "bar-descr___muXn5" to the top of the page
// @author       Omanpx [1906686] & Flav [2499383]
// @license      MIT
// @match        https://www.torn.com/*
// @grant        unsafeWindow
// ==/UserScript==

(function (window, $) {
    'use strict';

    // Define requirements
    // These are user ID ranges that should cover players between 15 and 400 days old
    const minID = 2800000;
    const maxID = 3100000;
    function getRandomNumber(min, max) {
        return Math.floor(Math.random() * (max - min + 1)) + min;
    }

    // Define the CSS rule to increase the size
    // Edit the font-size parameter to increase the size of the timer
    const sizeRule = `
        .bar-timeleft___B9RGV {
            font-size: 80px !important; // You can adjust the size as needed
            cursor:pointer;
        }
    `;

    // Create a <style> element and append it to the <head>
    const sizeStyleElement = document.createElement('style');
    sizeStyleElement.textContent = sizeRule;
    document.head.appendChild(sizeStyleElement);

    // Find the element with the class "bar-descr___muXn5"
    const element = document.querySelector('.bar-timeleft___B9RGV');
    if (element) {
        // Move the element to the top of the page
        element.style.position = 'fixed';
        element.style.top = '80px';
        element.style.right = '10px';
        element.style.background = "green";
        element.style.color = "black";

		// Add a click event listener to open Google in a new tab
		element.addEventListener('click', function() {
			let randID = getRandomNumber(minID,maxID);
			let profileLink = `https://www.torn.com/profiles.php?XID=${randID}`;
			// Comment this line and uncomment the one below it if you want the profile to open in a new tab
			window.location.href = profileLink;
		});

        var config = { characterData: true, attributes: false, childList: false, subtree: true };
        var observer = new MutationObserver((list) => {
            //console.log(list[0].target.textContent);
			var timeArray = list[0].target.textContent.split(":");
			var minutes = timeArray[timeArray.length-2];
			if(parseInt(minutes) > 3)
				list[0].target.parentElement.style.backgroundColor = "green";
			else if(parseInt(minutes) > 2)
				list[0].target.parentElement.style.backgroundColor = "orange";
			else if(parseInt(minutes) >= 0)
				list[0].target.parentElement.style.backgroundColor = "red";
            list[0].target.parentElement.style.position = 'fixed';
            list[0].target.parentElement.style.top = '80px';
            list[0].target.parentElement.style.right = '10px';
            list[0].target.parentElement.style.color = "black";
        });
        observer.observe(element, config);

    }
})(unsafeWindow, unsafeWindow.jQuery);