Skip to content

Instantly share code, notes, and snippets.

@netsi1964
Created June 5, 2017 08:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save netsi1964/f6e20b1ad95e46fcef738e2a1e78694b to your computer and use it in GitHub Desktop.
Save netsi1964/f6e20b1ad95e46fcef738e2a1e78694b to your computer and use it in GitHub Desktop.
Make site lorem ipsum
var lorem = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quod neque eaque fuga culpa doloribus adipisci vel explicabo! Nihil ipsa commodi quae voluptates laudantium fugit nam. Itaque veniam iure aliquid harum!'
Array.from(document.querySelectorAll("a,h1,h2,h3,h4,h5,h6")).map((ele, i) => {
var img = ele.querySelector('img');
var span = ele.querySelector('span');
if (img) {
var info = getComputedStyle(img);
img.src = 'http://dummyimage.com/'+parseInt(info.width)+'x'+parseInt(info.height)
} else {
if (span) {
span.innerText = lorem.substr(0, span.innerText.length)
} else {
ele.innerText = lorem.substr(0, ele.innerText.length)
}
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment