NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @icon http://s.pikabu.ru/favicon.ico // @name pikabu potrashki and nick // @namespace http://pikabu.ru/ // @license MIT // @version 0.1.2 // @include http://pikabu.ru/* // @run-at document-idle // @grant none // ==/UserScript== (function () { function textNodesUnder(el) { var walk, arr = []; walk = document.createTreeWalker(el, NodeFilter.SHOW_TEXT, { acceptNode: function (node) { var name, tNode = node; while ((tNode = tNode.parentNode) && (name = tNode.nodeName.toLowerCase()) != 'body') { if (~['style', 'script', 'texarea', 'pre', 'code'].indexOf(name)) { return NodeFilter.FILTER_REJECT; } } if (node.data.trim() !== '') { return NodeFilter.FILTER_ACCEPT; } } }, false); while (el = walk.nextNode()) { arr.push(el); } return arr; } let textNodes = textNodesUnder(document.body); let profile = document.querySelector('div#right_menu a[href^="http://pikabu.ru/profile/"]'); if (profile) { let nick = profile.textContent; let profileLinks = document.querySelectorAll('.b-comment__user > a[href="' + profile.href + '"] > span'); for (let link of profileLinks) { if (!link.classList.contains('b-comment__user_author_story')) { link.className = 'b-comment__user_author_story'; link.style.backgroundColor = '#00BCD4'; } } } for (let node of textNodes) { node.data = node.data.replace(/п[о|o]т[р|p].ш([a-zа-я]+)\B/gi, 'потраш$1'); //[A|А|Ɐ|Ⱥ|@] } })();