Old Github languages bar

move the languages bar to the top like the old github

目前为 2023-08-06 提交的版本。查看 最新版本

// ==UserScript==
// @name         Old Github languages bar
// @namespace    http://tampermonkey.net/
// @version      0.3
// @description  move the languages bar to the top like the old github
// @author       jrvgr
// @match        https://github.com/*/*
// @exclude      https://github.com/*/*/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=github.com
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    shiftLayout()
    if (window.onurlchange === null) addEventListener('urlchange', shiftLayout);

    function shiftLayout() {
    const bar = document.querySelector(".mb-2:has(.Progress > span.Progress-item.color-bg-success-emphasis)")
    const legacyNewBarPlace = document.querySelector(".Layout-main div")
    const newBarPlace = document.querySelector("div[data-selector='repos-split-pane-content'] div:has(div + div) div")
    if (newBarPlace) {
        newBarPlace.insertAdjacentElement("afterEnd", bar)
    } else {
        legacyNewBarPlace.insertAdjacentElement("afterEnd", bar)
    }
    bar.setAttribute('style', 'margin-bottom: 1em !important');

    const langs = document.querySelector(".BorderGrid-row ul:has(li > a > svg + span + span)")
    const newLangsPlace = document.querySelector("div.Layout-sidebar > div > div.BorderGrid-row.hide-sm.hide-md > div > h3");

    newLangsPlace.insertAdjacentElement("beforeBegin", langs)}

})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址