您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
Trophymanager: hall of fame of tournament
当前为
// ==UserScript== // @name TMVN League HOF // @namespace https://trophymanager.com // @version 2 // @description Trophymanager: hall of fame of tournament // @match https://trophymanager.com/history/league/* // @grant none // ==/UserScript== (function () { 'use strict'; var clubChampionMap = new Map(); var clubRunnerUpMap = new Map(); var clubThirdMap = new Map(); var clubSortMap = new Map(); var clubMap = new Map(); var currentSeason = $('#top_menu a[class="none white small"]')[0].innerText.split(/(\s+)/)[2]; var url = location.href; var country = url.split('/')[5]; if (url.slice(-1) != '/') { url += '/'; } var scanCount = 0; for (var i = currentSeason - 1; i > 0; i--) { $.ajax(url + i, { type: "GET", dataType: 'html', crossDomain: true, success: function (response) { let trArr = $('.box_body .border_bottom tr', response); if (trArr.length >= 4) { for (var j = 1; j <= 4; j++) { let rank = trArr[j].children[0].innerText; let clubId = trArr[j].children[1].children[0].getAttribute('club_link'); let clubName = trArr[j].children[1].children[0].innerText; if (!clubMap.has(clubId)) { clubMap.set(clubId, clubName); } if (rank == 1) { increaseValueOfMap(clubChampionMap, clubId); } else if (rank == 2) { increaseValueOfMap(clubRunnerUpMap, clubId); } else if (rank == 3) { increaseValueOfMap(clubThirdMap, clubId); } } } scanCount++; }, error: function (e) {} }); } var myInterval = setInterval(append, 1000); function append() { if (scanCount < currentSeason - 1) { return; } clearInterval(myInterval); for (let[key, value]of clubMap) { let champion = clubChampionMap.get(key) == undefined ? 0 : clubChampionMap.get(key); let runnerUp = clubRunnerUpMap.get(key) == undefined ? 0 : clubRunnerUpMap.get(key); let third = clubThirdMap.get(key) == undefined ? 0 : clubThirdMap.get(key); if (champion * 1000 + runnerUp * 100 + third > 0) { clubSortMap.set(key, champion * 1000 + runnerUp * 100 + third); } } clubSortMap[Symbol.iterator] = function * () { yield * [...this.entries()].sort((a, b) => b[1] - a[1]); } /*APPEND HALL OF FAME TABLE*/ let hof = "<div class=\"column3_a\">" + "<div class=\"box\">" + "<div class=\"box_head\">" + "<h2 class=\"std\">HALL OF FAME</h2>" + "</div>" + "<div class=\"box_body\">" + "<div class=\"box_shadow\"></div>" + "<div id=\"hof_content\" class=\"content_menu\"></div>" + "</div>" + "<div class=\"box_footer\">" + "<div></div>" + "</div>" + "</div>" + "</div>"; if ($('#bteam_reminder').length == 1) { $(".main_center")[3].innerHTML += hof; } else { $(".main_center")[2].innerHTML += hof; } let hof_content = "<table>" + "<tr><th>#</th><th>Club</th><th align='right'>Champion</th><th align='right'>2</th><th align='right'>3</th></tr>"; let rowCount = 0; for (let[key, value]of clubSortMap) { rowCount++; let classOdd = ""; if ((rowCount % 2) == 1) { classOdd = "class='odd'"; } let clubName = clubMap.get(key); let championCount = clubChampionMap.get(key); let runnerUpCount = clubRunnerUpMap.get(key); let thirdCount = clubThirdMap.get(key); hof_content += "<tr " + classOdd + ">" + "<td>" + rowCount + "</td>" + "<td><span onclick = \"window.open(\'https:\/\/trophymanager.com\/club\/" + key + "\')\">" + clubName + "</span></td>" + "<td align='right'>" + (championCount != undefined ? championCount : "") + "</td>" + "<td align='right'>" + (runnerUpCount != undefined ? runnerUpCount : "") + "</td>" + "<td align='right'>" + (thirdCount != undefined ? thirdCount : "") + "</td>" + "</tr>"; } hof_content += "</table>"; $("#hof_content").append(hof_content); $('.column3')[0].parentNode.removeChild($('.column3')[0]); } function increaseValueOfMap(map, key) { if (map.has(key)) { let count = map.get(key); count++; map.set(key, count); } else { map.set(key, 1); } } })();