Last active
August 10, 2017 02:15
-
-
Save streetturtle/045b606494a175a5aeee8012dc98abe6 to your computer and use it in GitHub Desktop.
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 prepareForScreenshot(selector) { | |
var textElements = document.querySelectorAll(selector); | |
for (i = 0; i < textElements.length; ++i) { | |
textElements[i].innerHTML = randomiseString(textElements[i].textContent); | |
} | |
var imgElements = document.querySelectorAll('img'); | |
for (i = 0; i < imgElements.length; ++i) { | |
imgElements[i].style.filter = 'blur(7px)'; | |
} | |
} | |
function randomiseString(str){ | |
var chars = " abcdefghijklmnopqrstuvwxyz0123456789"; | |
var _str = str.replace(/[^-]/g,function(a){ | |
return chars[Math.floor(Math.random() * chars.length)]; | |
}); | |
return _str; | |
} | |
prepareForScreenshot('span'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment