您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Allows sorting the branches list of a repository in ways additional to the default, modification time ordering
当前为
// ==UserScript== // @name GitHub Branches Sorter // @namespace Violentmonkey Scripts // @match https://github.com/*/*/branches/* // @grant none // @version 1.0 // @author OctoSpacc // @description Allows sorting the branches list of a repository in ways additional to the default, modification time ordering // @license ISC // ==/UserScript== var tableQuery = 'table.Table__StyledTable-sc-jofqvq-0.gsRldM.Table'; var orderButtonElem = document.createElement('button'); orderButtonElem.innerHTML = 'Sort Branches'; orderButtonElem.onclick = function(){ var tableElems = document.querySelectorAll(`${tableQuery} > tbody`); tableElems[0].style.display = (tableElems[0].style.display ? '' : 'none'); tableElems[1].style.display = (tableElems[1].style.display ? '' : 'none'); }; var tableAlphabElem = document.querySelector(`${tableQuery} > tbody`).cloneNode(false); tableAlphabElem.style.display = 'none'; var alphabRowElems = {}; for (var branchRowElem of document.querySelectorAll(tableQuery + '> tbody > tr')) { var branchName = branchRowElem.querySelector('td > div > a').textContent; var branchRowElemNew = branchRowElem.cloneNode(true); alphabRowElems[branchName] = branchRowElemNew; } alphabRowElems = Object.keys(alphabRowElems).sort().reduce( function(obj, key) { obj[key] = alphabRowElems[key]; return obj; }, {}); for (var branchRowElem of Object.values(alphabRowElems)) { tableAlphabElem.appendChild(branchRowElem); } document.querySelector('.Box-sc-g0xbh4-0.lhFvfi').appendChild(orderButtonElem); document.querySelector(tableQuery).appendChild(tableAlphabElem);
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址