Greasy Fork 还支持 简体中文。

Tetr.io advanced stats

Adds three columns with advanced stats (DS/piece, APP, APP+DS/piece) to the tetra channel's game list.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Tetr.io advanced stats
// @namespace    http://tampermonkey.net/
// @version      0.2
// @license MIT
// @description  Adds three columns with advanced stats (DS/piece, APP, APP+DS/piece) to the tetra channel's game list.
// @author       Fischly
// @match        https://ch.tetr.io/s/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=tetr.io
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    if (!document.location.pathname.includes('league')) return;

    const observer = new MutationObserver(function(mutations, observer) {
        observer.disconnect();

        const header = document.querySelector('#theader');
        const addAfter = header.children[5];

        addAfter.insertAdjacentHTML('afterend', '<th title="attack per piece + downstack per piece">APP+DS/pce</th>');
        addAfter.insertAdjacentHTML('afterend', '<th title="attack per piece">APP</th>');
        addAfter.insertAdjacentHTML('afterend', '<th title="downstack per piece">DS/pce</th>');

        const recordList = document.querySelector('#recordlist');

        const extract = item => Number.parseFloat(item.firstChild.textContent + item.childNodes[1].innerText);

        for (const row of recordList.children) {
            const pps = extract(row.children[3]);
            const apm = extract(row.children[4]);
            const vs  = extract(row.children[5]);

            const app = apm / (pps * 60);
            const ds_pce = ((vs / 100) - (apm / 60)) / pps;
            const app_ds_pce = app + ds_pce;

            console.log(pps, apm, vs, app, ds_pce);

            const addColAfter = row.children[5];

            const app_decimal = (app.toFixed(3) - (app.toFixed(3) | 0)).toString().slice(2);
            const ds_pce_decimal = (ds_pce.toFixed(3) - (ds_pce.toFixed(3) | 0)).toString().slice(2);
            const app_ds_pce_decimal = (app_ds_pce.toFixed(3) - (app_ds_pce.toFixed(3) | 0)).toString().slice(2);

            addColAfter.insertAdjacentHTML('afterend', `<td>${app_ds_pce | 0}<sub>.${app_ds_pce_decimal}</td>`);
            addColAfter.insertAdjacentHTML('afterend', `<td>${app | 0}<sub>.${app_decimal}</td>`);
            addColAfter.insertAdjacentHTML('afterend', `<td>${ds_pce | 0}<sub>.${ds_pce_decimal}</td>`);
        }
    });

    observer.observe(document.querySelector('#recordlist'), {attributes: true, childList: true, subtree: true});
})();