barnacles833 / 1337x always sort by leech

// ==UserScript==
// @namespace     https://openuserjs.org/users/barnacles833
// @name          1337x always sort by leech
// @description   Always sort by leech
// @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[2].textContent;
}