Last active
August 29, 2015 14:11
-
-
Save hmps/bd70abb9713d8987882b to your computer and use it in GitHub Desktop.
UX testing bookmarklets
This file contains hidden or 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(d) { | |
var style = document.querySelector('#hmpsBlurStyle'), | |
body; | |
if ( style ) { | |
style.parentElement.removeChild(style); | |
} else { | |
body = d.querySelector('body'); | |
style = d.createElement('style'); | |
style.id = 'hmpsBlurStyle'; | |
style.innerText = "body{-moz-filter: blur(3px);-webkit-filter: blur(3px);filter: blur(3px);}"; | |
body.appendChild(style); | |
} | |
}(document)) |
This file contains hidden or 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(d) { | |
var style = document.querySelector('#hmpsFlipStyle'), | |
body; | |
if ( style ) { | |
style.parentElement.removeChild(style); | |
} else { | |
body = d.querySelector('body'); | |
style = d.createElement('style'); | |
style.id = 'hmpsFlipStyle'; | |
style.innerText = "body{-moz-transform: rotateY(-179.9deg);-webkit-transform: rotateY(-179.9deg);transform: rotateY(-179.9deg);}"; | |
body.appendChild(style); | |
} | |
}(document)) |
This file contains hidden or 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(d) { | |
var style = document.querySelector('#hmpsHideStyle'), | |
body; | |
if ( style ) { | |
style.parentElement.removeChild(style); | |
} else { | |
body = d.querySelector('body'); | |
style = d.createElement('style'); | |
style.id = 'hmpsHideStyle'; | |
style.innerText = "body:after{content:'';position:fixed;top:0;left:0;right:0;bottom:0;height:100%;width:100%;background-color:#87D37C;z-index:10000}"; | |
setTimeout(function() { | |
body.appendChild(style); | |
}, 5000); | |
} | |
}(document)) |
This file contains hidden or 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() { | |
var elements = [], | |
textNodes = []; | |
forEach(document.querySelectorAll('*'), function(el) { | |
forEach(el.childNodes, goDeep); | |
}); | |
textNodes = elements.filter(function(element) { | |
return element.nodeType === Node.TEXT_NODE && element.nodeValue.trim() !== ''; | |
}).forEach(function(node) { | |
node.nodeValue = generateJibberish(node.nodeValue.length); | |
}); | |
function forEach(ctx, cb) { | |
Array.prototype.forEach.call(ctx, cb); | |
} | |
function goDeep(el) { | |
if(el.childNodes.length) { | |
forEach(el.childNodes, goDeep); | |
} else { | |
elements.push(el); | |
} | |
} | |
function generateJibberish(len) { | |
var returnStr = ''; | |
while(len--) { | |
returnStr += String.fromCharCode(Math.random() * (122 - 97) + 97); | |
} | |
return returnStr; | |
} | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment