move the languages bar to the top like the old github
当前为
// ==UserScript==
// @name Old Github languages bar
// @namespace http://tampermonkey.net/
// @version 0.2
// @description move the languages bar to the top like the old github
// @author jrvgr
// @match https://github.com/*/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=github.com
// @grant window.onurlchange
// ==/UserScript==
(function() {
'use strict';
shiftLayout()
if (window.onurlchange === null) {
window.addEventListener('urlchange', (info) => 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.Link--secondary)")
const newLangsPlace = document.querySelector("div.Layout-sidebar > div > div.BorderGrid-row.hide-sm.hide-md > div > h3");
newLangsPlace.insertAdjacentElement("beforeBegin", langs)
}
})();