您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Orders entries on the GitHub dashboard page from the newest one to the oldest one on the page load.
当前为
// ==UserScript== // @name Fix Order of GitHub Dashboard // @namespace http://prantlf.me/ // @version 1.1 // @description Orders entries on the GitHub dashboard page from the newest one to the oldest one on the page load. // @author [email protected] // @license MIT // @match https://github.com/ // @icon https://www.google.com/s2/favicons?sz=64&domain=github.com // @grant none // ==/UserScript== (function() { 'use strict'; let retries = 10 const interval = setInterval(reorder, 500) function reorder() { const feed = document.getElementById('conduit-feed-frame') if (!feed) { console.log('no articles found') if (!--retries) { clearInterval(interval) } return } clearInterval(interval) const articles = Array .from(feed.children) .filter(({ tagName }) => tagName === 'ARTICLE') for (const article of articles) { const div = article.nextElementSibling article.div = div const time = article.querySelector('relative-time') article.time = time && new Date(time.getAttribute('datetime')) || new Date article.remove() div.remove() } articles.sort((l, r) => l.time < r.time ? 1 : l.time > r.time ? -1 : 0) let current = feed.firstElementChild for (const article of articles) { const { div } = article current.insertAdjacentElement('afterend', article) article.insertAdjacentElement('afterend', div) delete article.div delete article.time current = div } console.log(articles.length, 'articles reordered') } })();