Created
July 18, 2015 18:48
-
-
Save anonymous/88768512a0e162d48191 to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/nowaja
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="https://code.jquery.com/jquery-1.11.0.min.js"></script> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<div class="foo" style="background:red;">123 | |
</div> | |
<div class="foo" style="background:orange;">456 | |
</div> | |
<div class="foo" style="background:yellow;">789 | |
</div> | |
<script id="jsbin-javascript"> | |
(function(){ | |
var lipsum = "Lorem ipsum dolor sit amet, consectetur adipiscing elit." + | |
"Fusce sit amet nunc eu purus bibendum pharetra non non mi. Ut tincidunt vulputate neque." + | |
"Vestibulum condimentum lacus eget egestas rutrum."; | |
window.printLipsum = function(lines, paragraphs, className) { | |
var text = ''; | |
var paragraph = '<p>'; | |
for (var i = 0; i < lines; i++) { | |
paragraph += lipsum; | |
} | |
paragraph += '</p>'; | |
for (var j = 0; j < lines; j++) { | |
text += paragraph; | |
} | |
if(jQuery) { | |
if (className[0] !== '.') { | |
className = '.' + className; | |
} | |
jQuery(className).html(text); | |
} | |
}; | |
})(); | |
$(document).ready(function(){ | |
// params 1 : sentences per paragraph | |
// param 2 : the number of paragraphs | |
//param 3 : the name of the class to fill with text (fills all elements with the class name) | |
printLipsum(4, 3, 'foo'); | |
}); | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">(function(){ | |
var lipsum = "Lorem ipsum dolor sit amet, consectetur adipiscing elit." + | |
"Fusce sit amet nunc eu purus bibendum pharetra non non mi. Ut tincidunt vulputate neque." + | |
"Vestibulum condimentum lacus eget egestas rutrum."; | |
window.printLipsum = function(lines, paragraphs, className) { | |
var text = ''; | |
var paragraph = '<p>'; | |
for (var i = 0; i < lines; i++) { | |
paragraph += lipsum; | |
} | |
paragraph += '</p>'; | |
for (var j = 0; j < lines; j++) { | |
text += paragraph; | |
} | |
if(jQuery) { | |
if (className[0] !== '.') { | |
className = '.' + className; | |
} | |
jQuery(className).html(text); | |
} | |
}; | |
})(); | |
$(document).ready(function(){ | |
// params 1 : sentences per paragraph | |
// param 2 : the number of paragraphs | |
//param 3 : the name of the class to fill with text (fills all elements with the class name) | |
printLipsum(4, 3, 'foo'); | |
});</script></body> | |
</html> |
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 lipsum = "Lorem ipsum dolor sit amet, consectetur adipiscing elit." + | |
"Fusce sit amet nunc eu purus bibendum pharetra non non mi. Ut tincidunt vulputate neque." + | |
"Vestibulum condimentum lacus eget egestas rutrum."; | |
window.printLipsum = function(lines, paragraphs, className) { | |
var text = ''; | |
var paragraph = '<p>'; | |
for (var i = 0; i < lines; i++) { | |
paragraph += lipsum; | |
} | |
paragraph += '</p>'; | |
for (var j = 0; j < lines; j++) { | |
text += paragraph; | |
} | |
if(jQuery) { | |
if (className[0] !== '.') { | |
className = '.' + className; | |
} | |
jQuery(className).html(text); | |
} | |
}; | |
})(); | |
$(document).ready(function(){ | |
// params 1 : sentences per paragraph | |
// param 2 : the number of paragraphs | |
//param 3 : the name of the class to fill with text (fills all elements with the class name) | |
printLipsum(4, 3, 'foo'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment