Old Github languages bar

move the languages bar to the top like in the old Github layout

当前为 2023-08-06 提交的版本,查看 最新版本

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

(function() {
    'use strict';

    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.Link--secondary)")
    const newLangsPlace = document.querySelector("div.Layout-sidebar > div > div.BorderGrid-row.hide-sm.hide-md > div > h3");

    newLangsPlace.insertAdjacentElement("beforeBegin", langs)

})();