Greasy Fork is available in English.
Github按文件更新日期排序...
// ==UserScript==// @name Github按文件更新日期排序// @namespace https://github.com/androidcn/// @version 1.1// @description Github按文件更新日期排序...// @author @Androidcn// @match https://github.com/*// @icon https://www.google.com/s2/favicons?sz=64&domain=github.com// @grant none// ==/UserScript==(function() {'use strict';function createButton() {// Create a button elementconst button = document.createElement('button');button.textContent = '排序';button.style.position = 'fixed';button.style.top = '60px';button.style.right = '20px';button.style.zIndex = '9999';// Append the button to the bodydocument.body.appendChild(button);// Add click event listener to the buttonbutton.addEventListener('click', performSortedAction);}function performSortedAction() {var files = document.querySelector('[aria-labelledby="folders-and-files"] tbody');var children = [...files.children];files.replaceChildren(children[0],...[...files.querySelectorAll('.react-directory-row')].sort((a, b) => new Date(a.querySelector('relative-time').datetime) < new Date(b.querySelector('relative-time').datetime) ? 1 : -1),children.at(-1),);console.log('已按文件更新日期排序');}// Wait for the page to loadwindow.addEventListener('load', createButton);})();