Programmatic GreekingWidget for dojo
When playing with dojo's fancy container and layout widgets, it is nice to be able to greek quickly. Pasting a bunch of generated lorem ipsum text gets old quickly, so here's a programmatic, custom dojo widget that'll generate as much or as little placeholder text as you need. The JavaScript source code uses the dojo 0.4.x APIs. Please feel free to use and improve this widget however you like.
Here's an HTML snippet that demonstrates the widget's usage...
And here's the test page output...
<html>
<head>
<title>Usage and unit tests for GreekingWidget</title>
<script type="text/javascript">
djConfig = { isDebug: true };
</script>
<!-- Be sure to point to your local dojo installation -->
<script type="text/javascript" src="dojo-0.4.3-widget/dojo.js"></script>
<!-- Be sure to point to where you save the source code -->
<script type="text/javascript" src="GreekingWidget.js"></script>
<style type="text/css">
.FooBarClass {
color: red;
}
</style>
</head>
<body>
<h2>Usage and unit tests for GreekingWidget</h2>
<h3>Default options</h3>
<div dojoType="GreekingWidget"></div>
<h3>One sentence</h3>
<div dojoType="GreekingWidget"
paragraphs="1"
sentencesPer="1"
loremIpsum="true"></div>
<h3>Generate blockquotes</h3>
<div dojoType="GreekingWidget"
paragraphs="2"
tag="blockquote"></div>
<h3>Add CSS class to make them red</h3>
<div dojoType="GreekingWidget"
paragraphs="2"
addClass="FooBarClass"></div>
<h3>Add CSS style to make them tiny</h3>
<div dojoType="GreekingWidget"
paragraphs="2"
sentencesPer="20"
addStyle="font-size:xx-small;"></div>
</body>
</html>