barnacles833 / 1337x.to smart sort torrents

// ==UserScript==
// @namespace     https://openuserjs.org/users/barnacles833
// @name          1337x.to smart sort torrents
// @description   Sorts torrent table columns on page load by comparing sum of seeder/leechers
// @copyright     2022, barnacles833 (https://openuserjs.org/users/barnacles833)
// @license       MIT
// @version       0.1.0
// @include       https://www.1337x.to/*
// @grant none
// ==/UserScript==

// ==OpenUserJS==
// @author barnacles833
// ==/OpenUserJS==

document
    .querySelectorAll("table")
    .forEach(({ tBodies: { 0: tBody } }) => tBody.append(...[...tBody.children].sort((a, b) => vf(b) - vf(a))));
    
function vf(tr) {
    return +tr.cells[1].textContent + +tr.cells[2].textContent;
}