NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name TokkiPlugin_YouHighlighter // @namespace http://tokki.be // @version 0.1 // @description Some visual features for kch // @author IUC // @license MIT // @match https://kpop.re/*/* // @excludes https://kpop.re/all/* // @grant GM_download // ==/UserScript== // This will make your (You)s on kch/wood/ very visible (function() { 'use strict'; // Wait until site is fully loaded window.addEventListener('load', function() { //(You) stuff var all_links = document.getElementsByClassName("post-link"); var youCount = 0; for (let link of all_links) { if(link.textContent.includes("(You)")) { link.style.color = "hotpink"; link.style.fontWeight = "bold"; youCount++; } } //You counter var node = document.createElement("a"); var textNode = document.createTextNode(youCount + " (You)s"); node.appendChild(textNode); node.setAttribute("id", "youcount"); document.getElementsByClassName("thread-nav_bottom")[0].appendChild(node); //you listener for new posts var target = document.getElementsByClassName("thread thread_single")[0]; var mutationObs = new MutationObserver(function(mutations, mutationObs){ // Get new post into addedNode var mutation = mutations[0]; var addedNode = mutation.addedNodes[0]; var targetDivLinkList = addedNode.getElementsByTagName("a"); for(var link of targetDivLinkList){ if (link.innerHTML.includes("(You)")){ link.style.color = "hotpink"; link.style.fontWeight = "bold"; youCount++; document.getElementById("youcount").innerText = youCount + " (You)s"; } } }); var config = { attributes: false, childList: true, subtree: false } mutationObs.observe(target, config); }, false); })();