您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Sort light novels by publisher on https://www.reddit.com/r/LightNovels/wiki/upcomingreleases by clicking on "Purchase Page"
// ==UserScript== // @name Sort Light Novel releases by publisher on r/LightNovels // @namespace http://tampermonkey.net/ // @version 0.1 // @description Sort light novels by publisher on https://www.reddit.com/r/LightNovels/wiki/upcomingreleases by clicking on "Purchase Page" // @author Only_Brad // @match https://www.reddit.com/r/LightNovels/wiki/upcomingreleases // @icon https://www.google.com/s2/favicons?sz=64&domain=reddit.com // @grant none // @run-at document-idle // @license MIT // ==/UserScript== /* jshint esversion:6 */ (function() { 'use strict'; document.querySelectorAll("h3 + table th:nth-child(4)").forEach(button => { button.style.cursor = "pointer"; button.addEventListener("click", e => { const tbody = e.target.closest("table").tBodies[0]; const rows = [...tbody.querySelectorAll("tr")]; rows.sort((row1,row2) => { const data1 = row1.querySelector("td:nth-child(4)").textContent; const data2 = row2.querySelector("td:nth-child(4)").textContent; if(tbody.dataset.sort === "asc") { return data2 > data1 ? 1 : -1; } return data2 > data1 ? -1 : 1; }); if(tbody.dataset.sort === "asc") { tbody.dataset.sort = "desc"; } else { tbody.dataset.sort = "asc"; } rows.forEach(row => tbody.appendChild(row)); }); }); })();