您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Sorts threads by most unread posts
// ==UserScript== // @name FP Read Page Sorter // @namespace member.php?u=197522 // @version 1.0 // @description Sorts threads by most unread posts // @author Xemit // @match https://facepunch.com/fp_read.php // @grant none // ==/UserScript== (function() { 'use strict'; // Count the threads to sort var threadcount = 0; var t = document.getElementById("threads").children[0]; var limit = t.children.length; var i; for(i = 1; i < limit; i++) { if(t.children[i].className != "threadlisthead") { threadcount++; } else { break; } } console.log("Sorting " + threadcount + " threads"); // We need to get the threads to sort var threads = []; for(i = 0; i < threadcount; i++) { threads[i] = document.getElementById("threads").children[0].children[i + 1]; } // Now make a map (I guess) of thread indexes and how many new posts they have var posts = []; for(i = 0; i < threads.length; i++) { var s = threads[i].getElementsByClassName("newposts"); if(!s) { console.error("There's a thread with no new posts in there somehow, aborting!"); return false; } s = s[0].innerText.trimLeft().substr(0, s[0].innerText.trimLeft().indexOf(" ")); posts[i] = { index: i, posts: s }; } // Finally sort those posts baby posts.sort(function(a, b) { return a.posts - b.posts; }); // Making an array of sorted threads var sortedThreads = []; for(i = 0; i < threads.length; i++) { sortedThreads[i] = threads[posts[i].index].cloneNode(true); } // Remove old unsorted threads for(i = 0; i < threads.length; i++) { threads[i].parentNode.removeChild(threads[i]); } // Put those cool new sorted threads into place for(i = 0; i < sortedThreads.length; i++) { t = document.getElementById("threads").children[0]; t.insertBefore(sortedThreads[i], t.children[1]); } console.log("Probably sorted threads successfully"); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址