您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Forces Twitter (X) to sort by likes instead of relevancy
// ==UserScript== // @name Twitter (X) Sort By Likes // @namespace http://tampermonkey.net/ // @version 1.0 // @description Forces Twitter (X) to sort by likes instead of relevancy // @author colleidoscope // @match https://x.com/* // @match https://twitter.com/* // @grant none // @license MIT // ==/UserScript== (function() { 'use strict'; // Create a proxy for XMLHttpRequest const XHR = XMLHttpRequest.prototype; const open = XHR.open; const send = XHR.send; // Override the open method XHR.open = function(method, url) { // Check if this is a TweetDetail request if (url.includes('/TweetDetail?')) { // Convert URL to URLSearchParams for easier manipulation const urlObj = new URL(url); const params = new URLSearchParams(urlObj.search); // Parse the variables parameter const variables = JSON.parse(decodeURIComponent(params.get('variables'))); // Modify the ranking mode to "Likes" variables.rankingMode = "Likes"; // Update the URL with modified parameters params.set('variables', JSON.stringify(variables)); url = `${urlObj.origin}${urlObj.pathname}?${params.toString()}`; } // Call the original open method return open.apply(this, [method, url]); }; // Override the send method XHR.send = function() { return send.apply(this, arguments); }; })();