[greasemonkey] Fix my menu-symbols script

This commit is contained in:
Sebastian Schulze 2023-11-09 14:45:30 +01:00
parent ddd31570cc
commit 703247846f
No known key found for this signature in database
GPG Key ID: F6BA63C6A7D3044E
1 changed files with 16 additions and 3 deletions

View File

@ -24,7 +24,7 @@
document.addEventListener('readystatechange', async function onReadyStateChange() {
var lastTopBarItem = document.querySelector("div.top-bar-container nav ul li:last-child");
console.log(lastTopBarItem);
if (lastTopBarItem) {
lastTopBarItem.style.marginRight = "20px"
document.querySelectorAll("ul[data-testid=pinned-nav-items]>li>a").forEach((a) => {
a.querySelector("div.gl-truncate-end").innerText = [
@ -33,10 +33,23 @@
].join(" ")
var newTopBarItem = a.cloneNode(true);
newTopBarItem.style.fontSize = "0.8em";
newTopBarItem.removeChild(newTopBarItem.querySelector("div[data-testid=active-indicator]"))
newTopBarItem.removeChild(newTopBarItem.querySelector("span>button").parentNode)
if(newTopBarItem.querySelector("span.badge-pill") !== null) {
const badgeCount = Number(newTopBarItem.querySelector("span.badge-pill")?.innerText.trim())
if(badgeCount == 0 || isNaN(badgeCount)) {
newTopBarItem.removeChild(newTopBarItem.querySelector("span.badge-pill").parentNode)
}
}
const glTextRight = newTopBarItem.querySelector(".gl-text-right")?.innerText.trim();
if(glTextRight == undefined || glTextRight == "") {
newTopBarItem.removeChild(newTopBarItem.querySelector(".gl-text-right"))
}
newTopBarItem.removeChild(newTopBarItem.querySelector("svg[data-testid=grip-icon]").parentNode)
lastTopBarItem.parentNode.append(newTopBarItem);
})
});
}}
);
})();