This repository has been archived by the owner on Dec 1, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
363 lines (338 loc) · 15.9 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link type="text/css" rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css"/>
<link type="text/css" rel="stylesheet" href="demo/bsdocs.css"/>
<link type="text/css" rel="stylesheet" href="demo/fork.css"/>
<!--[if lt IE 9]>
<link rel="stylesheet" href="demo/gh-fork-ribbon.ie.css">
<![endif]-->
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.17/angular.min.js"></script>
<script src="dist/ipsum.min.js"></script>
<script src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js"></script>
<script>
var app = angular.module("app", ["ipsum"]);
app.controller("peopleController", function($scope, ipsumService) {
$scope.person = ipsumService.randomName('r');
(function() {
var people = [];
for(var i = 0; i < 10; i++)
{
var person = ipsumService.randomName('r');
person.email = person.first + '.' + person.last + '@' + ipsumService.words(1) + ipsumService.randomItem(['.net','.org','.com','.biz'])
people.push(person);
}
$scope.people = people;
})();
});
</script>
<style>
/* The default background color is #c00 */
.right-bottom .github-fork-ribbon {
background-color: #090;
}
.right .github-fork-ribbon {
background-color: #f80;
}
.left-bottom .github-fork-ribbon {
background-color: #333;
}
</style>
</head>
<body ng-app="app">
<div class="github-fork-ribbon-wrapper right">
<div class="github-fork-ribbon">
<a href="https://github.com/adamczak/ng-ipsum">Fork me on GitHub</a>
</div>
</div>
<div class="container">
<div class="header">
<h3 class="text-muted">angular-ipsum</h3>
</div>
<div class="jumbotron">
<h1>AngularJS randomness</h1>
<blockquote>
<p ipsum="2s"></p>
<footer><cite ipsum-name="rfl"></cite></footer>
</blockquote>
</div>
<div class="row marketing">
<div class="col-md-12">
<h1>Getting started</h1>
<p>
<code>bower install angular-ipsum</code>
or download from <a href="https://github.com/adamczak/ng-ipsum">here</a>.
</p>
<p>Then include it in the list of dependencies for your application:</p>
<code>var app = angular.module("app", ["ipsum"]);</code>
<div class="bs-docs-section">
<h1 id="words" class="page-header">Words</h1>
<p class="lead">Ipsum-y text.</p>
<h3 id="words-example">As a directive</h3>
<p>Add the <code>ipsum</code> attribute to an element.</p>
<div class="bs-example">
<div class="dropdown clearfix">
<div ipsum="10w"></div>
<br/>
<div ipsum="2s"></div>
<br/>
<div ipsum="1p"></div>
<hr/>
<div ipsum="1-4p"></div>
</div>
</div><!-- /example -->
<div class="highlight"><pre><code class="html"><div ipsum="10w"></div>
<div ipsum="2s"></div>
<div ipsum="1p"></div>
<div ipsum="1-4p"></div>
</code></pre></div>
<h3>Options</h3>
<p>
The value of the ipsum attribute defines the output. Format is number of items + type: <code>\d+(-*\d+)*w|s|p</code>. Options can be chained, i.e.: <code><span ipsum='2w1p3s'/></code> for 2 words, 1 paragraph and 3 sentences.
</p>
<table class="table">
<thead>
<tr>
<th>Value</th>
<th>Meaning</th>
</tr>
</thead>
<tbody>
<tr>
<td>10w</td>
<td>10 words, no punctuation</td>
</tr>
<tr>
<td>2s</td>
<td>2 sentences. First letter of each capatalized, period at end.</td>
</tr>
<tr>
<td>1-4p</td>
<td>
1-4 paragraphs. Will be wrapped in <code><p></p></code> tags
</td>
</tr>
</tbody>
</table>
<h1 id="names" class="page-header">Names</h1>
<p class="lead">Ipsum-y names.</p>
<h3 id="names-example">As a directive</h3>
<p>Add the <code>ipsum-name</code> attribute to an element.</p>
<div class="bs-example">
<div class="dropdown clearfix">
<div ipsum-name="mfml"></div>
<br/>
<div ipsum-name="ffml"></div>
<br/>
<div ipsum-name="rf"></div>
</div>
</div><!-- /example -->
<div class="highlight"><pre><code class="html"><div ipsum-name="mfml"></div>
<div ipsum-name="flmf"></div>
<div ipsum-name="rf"></div>
</code></pre></div>
<h3>Options</h3>
<p>
The value of the ipsum-name attribute defines the output. Format is sex + format: <code>[fmr][fml]+</code>.
</p>
<table class="table">
<thead>
<th>
<tr>
<th>Option</th>
<th>Values</th>
</tr>
</th>
</thead>
<tbody>
<tr>
<td>Sex</td>
<td>
m = male<br/>
f = female<br/>
r = randomly pick m or f
</td>
</tr>
<tr>
<td>Format</td>
<td>
f = first<br/>
m = middle initial<br/>
l = last<br/>
<i>
One or more is required, and only 1 of each can be specified.<br/> Output will be in order provided, i.e.: <code>
<span ipsum-name='fmlf' /></code> will output a female name in the format MI Last First
</i>
</td>
</tr>
</tbody>
</table>
<h1 id="service-example">As a service</h1>
<p>Inject the <code>ipsumService</code> into your controller/service/directive
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>Operation</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>
ipsumService.paragraphs(count)
</td>
<td>
Get a random string of sentences in paragraph format (wrapped in <p> tags)
</td>
</tr>
<tr>
<td>
ipsumService.sentences(count)
</td>
<td>
Get a random string of words in sentence format
</td>
</tr>
<tr>
<td>
ipsumService.words(count)
</td>
<td>
Get a random string of words
</td>
</tr>
<tr>
<td>
ipsumService.randomFemale()
</td>
<td>
Get a random female first name
</td>
</tr>
<tr>
<td>
ipsumService.randomMale()
</td>
<td>
Get a random male first name
</td>
</tr>
<tr>
<td>
ipsumService.randomFirst()
</td>
<td>
Get a random first name
</td>
</tr>
<tr>
<td>
ipsumService.randomLast()
</td>
<td>
Get a random last name
</td>
</tr>
<tr>
<td>
ipsumService.randomMi()
</td>
<td>
Get a random middle initial (a letter)
</td>
</tr>
<tr>
<td>
ipsumService.randomName()
</td>
<td>
Get a random 'person' object - {first: '', mi: '', last: '', full: ''}
</td>
</tr>
<tr>
<td>
ipsumService.randomItem()
</td>
<td>
Get a item from a provided list
</td>
</tr>
</tbody>
</table>
<h3>Example</h3>
<div class="row">
<div class="col-md-6">
<pre class="prettyprint" ng-non-bindable>
app.controller('peopleController', function($scope, ipsumService) {
$scope.person = ipsumService.randomName('r');
$scope.people = [];
for(var i = 0; i < 10; i++)
{
var person = ipsumService.randomName('r');
person.email = person.first + '.' + person.last + '@' + ipsumService.words(1) + ipsumService.randomItem(['.net','.org','.com','.biz'])
$scope.people.push(person);
}
});</pre>
<pre class="prettyprint" ng-non-bindable>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>First</th>
<th>M.I.</th>
<th>Last</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="person in people">
<td>{{person.first}}</td>
<td>{{person.mi}}</td>
<td>{{person.last}}</td>
</tr>
</tbody>
</table>
<div ng-repeat="person in people|random">
A random person from the list above: {{person.first}} {{person.last}}
</div>
</pre>
</div>
<div class="col-md-6" ng-controller="peopleController">
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>First</th>
<th>M.I.</th>
<th>Last</th>
<th>Email</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="person in people">
<td>{{person.first}}</td>
<td>{{person.mi}}</td>
<td>{{person.last}}</td>
<td>{{person.email}}</td>
</tr>
</tbody>
</table>
<div ng-if="people && people.length" ng-repeat="person in people|random">
A random person from the list above: {{person.first}} {{person.last}}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-248590-10', 'ng-ipsum.azurewebsites.net');
ga('send', 'pageview');
</script>
</body>
</html>