Sort clan members according to event points

Add button to sort clan members

当前为 2021-03-17 提交的版本,查看 最新版本

// ==UserScript==
// @name         Sort clan members according to event points
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Add button to sort clan members
// @author       Arekino
// @match        https://www.lordswm.com/clan_info.php*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    var i = document.createElement("button");
    i.innerText = "Sort clan members";
    i.onclick=()=>{[...document.querySelectorAll("tr")].filter(x=>{if(x.childElementCount==6){if(isNaN(parseInt(x.lastElementChild.innerText))) x.lastElementChild.innerText=0;return true}return false}).sort((x,y)=>parseInt(y.lastElementChild.innerText)-parseInt(x.lastElementChild.innerText)).forEach(x=>x.parentElement.appendChild(x))}
    document.querySelectorAll("table.wb")[0].firstElementChild.appendChild(i)
    // Your code here...
})();