// ==UserScript== // @name TFGamesSite Sort By Likes // @namespace https://github.com/imaginary-upside // @version 0.1 // @description When searching on tfgames.site, sort by number of likes. // @author imaginary-upside // @match https://tfgames.site/index.php?module=search&* // @match https://tfgames.site/?module=search&* // @grant none // @downloadURL none // ==/UserScript== function getLikes(row) { return parseInt(row.children[4].innerText); } var rows = Array.from(document.querySelectorAll("tbody tr")); rows.sort(function(a, b) { return getLikes(b) - getLikes(a); }); rows.forEach(row => { document.querySelector("tbody").appendChild(row); });