您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
auto-clicks on the Name button in Firefox until the file list is sorted alphabetically then stops
// ==UserScript== // @name Firefox Local file viewer Firefox - sort alphabetically by default // @namespace http://tampermonkey.net/ // @version 2025-05-20 // @description auto-clicks on the Name button in Firefox until the file list is sorted alphabetically then stops // @author You // @match file:///* // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== // @grant none // ==/UserScript== 'use strict'; function clickUntilTableSortedAsc() { const table = document.querySelector('table[order][order-by]'); const targetOrder = 'asc'; const targetOrderBy = '0'; // Stop if table has the desired attributes if (table && table.getAttribute('order') === targetOrder && table.getAttribute('order-by') === targetOrderBy) { console.log('Table is sorted in ascending order by column 0. Stopping clicks.'); clearInterval(intervalId); return; } // Find the <a> tag with text exactly "Name" const nameLink = Array.from(document.querySelectorAll('a')).find( a => a.textContent.trim() === 'Name' ); if (nameLink) { console.log('Clicking "Name" link...'); nameLink.click(); } else { console.log('"Name" link not found.'); } } // Repeat every 0.1 seconds const intervalId = setInterval(clickUntilTableSortedAsc, 100);