Created
June 5, 2017 08:57
-
-
Save netsi1964/f6e20b1ad95e46fcef738e2a1e78694b to your computer and use it in GitHub Desktop.
Make site lorem ipsum
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
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