NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name F // @namespace https://openuserjs.org/users/jasonkhanlar#F // @copyright F // @license GPL-3.0-or-later // @version F // @description F // @author F // @match http://*/* // @match https://*/* // @grant F // ==/UserScript== // ==OpenUserJS== // @author jasonkhanlar // ==/OpenUserJS== (function() { 'use strict'; // https://stackoverflow.com/a/4399718 function getTextNodesIn(node, includeWhitespaceNodes) { var textNodes = [], nonWhitespaceMatcher = /\S/; function getTextNodes(node) { if (node.nodeType == 3) { if (includeWhitespaceNodes || nonWhitespaceMatcher.test(node.nodeValue)) { textNodes.push(node); } } else { for (var i = 0, len = node.childNodes.length; i < len; ++i) { getTextNodes(node.childNodes[i]); } } } getTextNodes(node); return textNodes; } let rulenum = 0; function run() { let nodes = getTextNodesIn(document.body); nodes.forEach((a, b) => { if (['NOSCRIPT', 'SCRIPT', 'STYLE'].includes(a.parentElement.tagName)) { //} else if (['A', 'B', 'CITE', 'DIV', 'EM', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'P', 'SMALL', 'SPAN'].includes(a.parentElement.tagName)) { } else { a.textContent = a.textContent.replace(/\w+/gi, 'F'); } }); let rules = []; document.querySelectorAll('body *:not([class*=frule-])').forEach((a, b) => { let after = window.getComputedStyle(a, ':after').getPropertyValue('content') .replace(/\w+/gi, 'F'); let before = window.getComputedStyle(a, ':before').getPropertyValue('content') .replace(/\w+/gi, 'F'); if ((after !== "none" && after !== "") || (before !== "none" && before !== "")) { rulenum++; a.classList.add(`frule-${rulenum}`); } if (after !== "none" && after !== "") { rules.push(`.frule-${rulenum}::after { content: ${after} !important; }`); } if (before !== "none" && before !== "") { rules.push(`.frule-${rulenum}::before { content: ${before} !important; }`); } }); if (document.querySelectorAll("head style.frules").length > 0) { document.querySelectorAll("head style.frules")[0].textContent += rules.join("\n"); } else { let head = document.getElementsByTagName('head')[0]; let style = document.createElement('style'); style.setAttribute('class', 'frules'); style.setAttribute('type', 'text/css'); style.textContent = rules.join("\n"); head.appendChild(style); } } let fcobserver = new MutationObserver(mutations => { run(); }); fcobserver.observe(document.body, {childList: true,subtree: true}); run(); })();