Tietääkö joku miten saa tehtyä itse ilmoitukset- ja seuratut langat napit jotka toimii? Ohessa sivupalkin poistaja joka kloonaa nuo napit mutta niiden klikkaaminen ei tee mitään.
// ==UserScript==
// @name Remove sidebar - ylilauta.org
// @match *://ylilauta.org/*
// @version 1.3
// @grant none
// @author MrDarkHooD
// ==/UserScript==
function addGlobalStyle(css) {
const nonce = document.getElementsByTagName("script")[0].nonce;
const head = document.getElementsByTagName('head')[0];
const style = document.createElement('style');
style.type = 'text/css';
style.nonce = nonce;
style.innerHTML = css;
head.appendChild(style);
}
addGlobalStyle('body { padding-top: 5px !important; padding-bottom: 5px !important; }')
addGlobalStyle('#sidebar,
#navbar { display: none; }')
addGlobalStyle('#content, html:not(.no-sidebar)
#content { margin: 0 5px }')
// Add your own, or rather report missing names to author
const shortNames =
shortNames["anime"] = "a"
shortNames["satunnainen"] = "b"
shortNames["palaute"] = "meta"
shortNames["pub"] = "rr"
shortNames["matkailu"] = "coco"
shortNames["huumeet"] = "h"
shortNames["ohjelmointi"] = "o"
shortNames["masiinat"] = "m"
shortNames["musiikki"] = "mu"
shortNames["talous"] = "biz"
shortNames["pelit"] = "g"
shortNames["muoti"] = "fa"
shortNames["ihmissuhteet"] = "soc"
shortNames["deitti"] = "d"
const contentDiv = document.querySelector('#content');
const sideBar = document.getElementById("sidebar")
const notificationsButton = document.querySelector("[data-notifications-fn]")
const followedThreadsButton = document.querySelector("[data-thread-follow-box-fn]")
const tabs = ["[data-tab-id='profile']", "#nav-threads", "#nav-boards"]
let topBar = document.createElement('div');
topBar.setAttribute("id", "topBar");
contentDiv.prepend(topBar);
tabs.forEach((i, idx, tab) => {
const currentTab = sideBar.querySelector(tab[idx])
currentTab.querySelectorAll("nav a").forEach((link) => {
// Make board names shorter
if(currentTab.getAttribute("id") == "nav-boards") {
let boardUrlName = link.getAttribute("href").replace(/\//g, "")
if(shortNames[boardUrlName]) {
link.innerHTML = shortNames[boardUrlName]
}else {
link.innerHTML = boardUrlName
}
}
topBar.append(link, " / ")
});
if(idx === 0) {
topBar.append(notificationsButton)
topBar.append(" ")
topBar.append(followedThreadsButton)
}
topBar.innerHTML += "<br>"
});
//contentDiv.append(topBar.cloneNode(true));