Greasy Fork is available in English.

Reverse Order of GitHub Dashboard

Orders entries on the GitHub dashboard page from the newest one to the oldest one on the page load.

Versión del día 07/12/2024. Echa un vistazo a la versión más reciente.

// ==UserScript==
// @name         Reverse Order of GitHub Dashboard
// @namespace    http://prantlf.me/
// @version      1.0
// @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) {
      current.insertAdjacentElement('afterend', article)
      article.insertAdjacentElement('afterend', article.div)
      delete article.div
      delete article.time
    }
    console.log(articles.length, 'articles reordered')
  }
})();