您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Sort faction members by FF Score
当前为
- // ==UserScript==
- // @name Sort Faction List by FF Score
- // @namespace http://tampermonkey.net/
- // @version 1.0
- // @description Sort faction members by FF Score
- // @author You
- // @match https://www.torn.com/factions.php?step=profile*
- // @grant none
- // @license MIT
- // ==/UserScript==
- (function() {
- 'use strict';
- function sortMembersByFF() {
- const list = document.querySelector('.table-body.tt-modified-ff-scouter');
- if (!list) return;
- let rows = Array.from(list.querySelectorAll('.table-row'));
- rows.sort((a, b) => {
- let ffA = parseFloat(a.getAttribute('data-ff-scout')) || 0;
- let ffB = parseFloat(b.getAttribute('data-ff-scout')) || 0;
- return ffB - ffA; // Sort descending
- });
- rows.forEach(row => list.appendChild(row));
- }
- function addSortButton() {
- const header = document.querySelector('.tt-ff-scouter-faction-list-header');
- if (!header) return;
- const sortButton = document.createElement('div');
- sortButton.innerText = '⇅';
- sortButton.style.cursor = 'pointer';
- sortButton.style.marginLeft = '5px';
- sortButton.style.display = 'inline-block';
- sortButton.style.fontWeight = 'bold';
- sortButton.addEventListener('click', sortMembersByFF);
- header.appendChild(sortButton);
- }
- function init() {
- const observer = new MutationObserver(() => {
- if (document.querySelector('.table-body.tt-modified-ff-scouter')) {
- addSortButton();
- observer.disconnect();
- }
- });
- observer.observe(document.body, { childList: true, subtree: true });
- }
- init();
- })();