Last active
January 4, 2024 16:00
-
-
Save myfonj/3bdb6bbacd3b080938716495d8989c19 to your computer and use it in GitHub Desktop.
Dummyze bookmarklet - replace all texts in page with ▒▒▒▒ and images with dummyimage.com counterparts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p>Bookmarklet: | |
<a title="Dummyze2" href="javascript:(function (dummyze, entry) {function textWalker(node, cbck) {var i = -1,n, s, w, h;if (!node) {return}if (node.nodeType === 3) {cbck(node, 'nodeValue');return}if (node.tagName == 'IFRAME') {try {textWalker(node.contentDocument.documentElement, cbck)} catch (e) {}return}if (node.tagName == 'STYLE' || node.tagName == 'SCRIPT' || node.tagName == 'SVG') {return}if (node.tagName == 'IMG') {s = getComputedStyle(node);node.src = 'https://dummyimage.com/' + (parseInt(s.width) || 10) + 'x' + (parseInt(s.height) || 10);return}if (node.tagName == 'INPUT' || node.tagName == 'TEXTAREA') {cbck(node, 'placeholder');cbck(node, 'value');return}if (node.tagName) {if ((s = node.getAttribute('style')) && (s = (s = getComputedStyle(node)).backgroundImage) && (s != 'none') && (s = (s.match(/url\("([^"]+)"\)/))) && (s = s[1])) {pic = new Image();pic.onload = function () {node.style.backgroundImage = 'url(https://dummyimage.com/' + (parseInt(pic.width) || 10) + 'x' + (parseInt(pic.height) || 10) + ')'};pic.src = s;}if ((b = (b = getComputedStyle(node, '::before')).content) && (b != 'none') && b.indexOf('attr(') == 0 && (b = b.match(/^attr\((.*?)\)$/)) && (b = b[1])) {cbck(node, b);}if ((b = (b = getComputedStyle(node, '::after')).content) && (b != 'none') && b.indexOf('attr(') == 0 && (b = b.match(/^attr\((.*?)\)$/)) && (b = b[1])) {cbck(node, b);}while (n = node.childNodes[++i]) textWalker(n, cbck);}};textWalker(entry, dummyze)})(function (n, p, a, w, pic) {p = p || 'nodeValue';a = n[p];if (a) {w = a.replace(/\S/g, '\u2591');if (a != w) n[p] = w} else {a = n.getAttribute && n.getAttribute(p);if (a) {w = a.replace(/\S/g, '\u2591');if (a != w) n.setAttribute(p, w);}}}, document.documentElement);">Dummyze2</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (dummyze, entry) { | |
function textWalker(node, cbck) { | |
var i = -1, | |
n, s, w, h; | |
if (!node) { | |
return | |
} | |
if (node.nodeType === 3) { | |
cbck(node, 'nodeValue'); | |
return | |
} | |
if (node.tagName == 'IFRAME') { | |
try { | |
textWalker(node.contentDocument.documentElement, cbck) | |
} catch (e) {} | |
return | |
} | |
if (node.tagName == 'STYLE' || node.tagName == 'SCRIPT' || node.tagName == 'SVG') { | |
return | |
} | |
if (node.tagName == 'IMG') { | |
s = getComputedStyle(node); | |
node.src = 'https://dummyimage.com/' + (parseInt(s.width) || 10) + 'x' + (parseInt(s.height) || 10); | |
return | |
} | |
if (node.tagName == 'INPUT' || node.tagName == 'TEXTAREA') { | |
cbck(node, 'placeholder'); | |
cbck(node, 'value'); | |
return | |
} | |
if (node.tagName) { | |
if ((s = node.getAttribute('style')) && (s = (s = getComputedStyle(node)).backgroundImage) && (s != 'none') && (s = (s.match(/url\("([^"]+)"\)/))) && (s = s[1])) { | |
pic = new Image(); | |
pic.onload = function () { | |
node.style.backgroundImage = 'url(https://dummyimage.com/' + (parseInt(pic.width) || 10) + 'x' + (parseInt(pic.height) || 10) + ')' | |
}; | |
pic.src = s; | |
} | |
if ((b = (b = getComputedStyle(node, '::before')).content) && (b != 'none') && b.indexOf('attr(') == 0 && (b = b.match(/^attr\((.*?)\)$/)) && (b = b[1])) { | |
cbck(node, b); | |
} | |
if ((b = (b = getComputedStyle(node, '::after')).content) && (b != 'none') && b.indexOf('attr(') == 0 && (b = b.match(/^attr\((.*?)\)$/)) && (b = b[1])) { | |
cbck(node, b); | |
} | |
while (n = node.childNodes[++i]) textWalker(n, cbck); | |
} | |
}; | |
textWalker(entry, dummyze) | |
})(function (n, p, a, w, pic) { | |
p = p || 'nodeValue'; | |
a = n[p]; | |
if (a) { | |
w = a.replace(/\S/g, '\u2591'); | |
if (a != w) n[p] = w | |
} else { | |
a = n.getAttribute && n.getAttribute(p); | |
if (a) { | |
w = a.replace(/\S/g, '\u2591'); | |
if (a != w) n.setAttribute(p, w); | |
} | |
} | |
}, document.documentElement); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function (dummyze, entry) {function textWalker(node, cbck) {var i = -1,n, s, w, h;if (!node) {return}if (node.nodeType === 3) {cbck(node, 'nodeValue');return}if (node.tagName == 'IFRAME') {try {textWalker(node.contentDocument.documentElement, cbck)} catch (e) {}return}if (node.tagName == 'STYLE' || node.tagName == 'SCRIPT' || node.tagName == 'SVG') {return}if (node.tagName == 'IMG') {s = getComputedStyle(node);node.src = 'https://dummyimage.com/' + (parseInt(s.width) || 10) + 'x' + (parseInt(s.height) || 10);return}if (node.tagName == 'INPUT' || node.tagName == 'TEXTAREA') {cbck(node, 'placeholder');cbck(node, 'value');return}if (node.tagName) {if ((s = node.getAttribute('style')) && (s = (s = getComputedStyle(node)).backgroundImage) && (s != 'none') && (s = (s.match(/url\("([^"]+)"\)/))) && (s = s[1])) {pic = new Image();pic.onload = function () {node.style.backgroundImage = 'url(https://dummyimage.com/' + (parseInt(pic.width) || 10) + 'x' + (parseInt(pic.height) || 10) + ')'};pic.src = s;}if ((b = (b = getComputedStyle(node, '::before')).content) && (b != 'none') && b.indexOf('attr(') == 0 && (b = b.match(/^attr\((.*?)\)$/)) && (b = b[1])) {cbck(node, b);}if ((b = (b = getComputedStyle(node, '::after')).content) && (b != 'none') && b.indexOf('attr(') == 0 && (b = b.match(/^attr\((.*?)\)$/)) && (b = b[1])) {cbck(node, b);}while (n = node.childNodes[++i]) textWalker(n, cbck);}};textWalker(entry, dummyze)})(function (n, p, a, w, pic) {p = p || 'nodeValue';a = n[p];if (a) {w = a.replace(/\S/g, '\u2591');if (a != w) n[p] = w} else {a = n.getAttribute && n.getAttribute(p);if (a) {w = a.replace(/\S/g, '\u2591');if (a != w) n.setAttribute(p, w);}}}, document.documentElement); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In a web page for "installation":
http://myfonj.github.io/utils/bookmarklets/dummyze-scramble-obfuscate-greek-page-content.html