This repository has been archived by the owner on Jul 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.html
298 lines (267 loc) · 11.2 KB
/
demo.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>bootstrap-demo.js | Unoffocial Bootstrap extension for demo functionality</title>
<meta name="author" content="Kalman Olah">
<meta name="description" content="bootstrap-demo.js is an unoficcial extension for Twitter Bootstrap that adds 'demo' functionality, allowing you to easily visually demonstrate proper usage of your application to its users.">
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet">
<style type="text/css">
body {
position: relative;
}
</style>
</head>
<body>
<div class="container">
<div id="home" class="jumbotron page-header text-center" data-provide="demo" data-placement="bottom">
<h1>bootstrap-demo.js</h1>
<p>You've already seen it in action.</p>
<p>
<a href="https://github.com/kalmanolah/bootstrap-demo.js/archive/master.tar.gz" class="btn btn-default btn-lg">
Get the tarball <i class="glyphicon glyphicon-download-alt"></i>
</a>
<a href="https://github.com/kalmanolah/bootstrap-demo.js/" class="btn btn-success btn-lg">
View it on Github <i class="glyphicon glyphicon-chevron-right"></i>
</a>
</p>
</div>
<hr>
<div id="about">
<h2>What is <strong>bootstrap-demo.js</strong>?</h2>
<div class="row">
<div class="col-sm-6">
<h3>Easy?</h3>
<p><span class="label label-warning">bootstrap-demo.js</span> is a simple (and also <em class="text-danger">unofficial</em>) solution to schooling those pesky end-users we've all heard about.</p>
<p>It allows you to easily create demos and tutorials for your own applications via invocation using javascript or data-attributes.</p>
</div>
<div class="col-sm-6">
<h3>Easy!</h3>
<p>Since it's a combination of some higlighting, Twitter Bootstrap popovers and cookies, you can use any of the default popover functionality.</p>
<p><span class="label label-warning">bootstrap-demo.js</span> also manages demo display through the use of cookies: all you need to do is provide an ID for a demo and you're set!</p>
</div>
</div>
</div>
<hr>
<div id="download">
<h2>Getting it</h2>
<p>Clone the repo, cd to the directory and copy the minified script to wherever you actually need it to be. Standard practice, really.</p>
<pre><code>git clone git://github.com/kalmanolah/bootstrap-demo.js.git
cp bootstrap-demo.js/src/bootstrap-demo.min.js /path/to/my/app/assets/js/</code></pre>
</div>
<hr>
<div id="usage">
<h2>Usage & Examples</h2>
<h3>Usage</h3>
<h4>Normal script:</h4>
<pre><code>$('#selector').demo({
id: 2,
placement: 'top',
content: 'This is a tip with <strong>html</strong>',
title: 'WARNING <i class="icon-warning-sign"></i>'
});</code></pre>
<h4>Data API:</h4>
<pre><code><div
data-provide="demo"
data-id="3"
data-html="false"
data-placement="bottom"
data-title="ProTip (tm)"
data-content="Click me!">
...
Content goes here.
...
</div>
</code></pre>
<h4>Modifying the global configuration:</h4>
<pre><code><script>
demo.options.persist = false;
demo.options.title = 'ProTip (tm)';
</script></code></pre>
<h3>Examples</h3>
<p>Here are some examples that demonstrate the capabilities of bootstrap-demo.js.</p>
<h4>Basic demo with multiple selections</h4>
<pre><code>$('#home .btn-default, #home .btn-success').demo({
id: '1-1',
content: 'This is the first demo!'
});</code></pre>
<a href="#" class="btn btn-success example-1">Run</a>
<br><br>
<h4>Demo chaining with callbacks</h4>
<pre><code>$('#home .btn-default').demo({
id: '1-1',
content: 'Are you ready for some chaining?',
callback: function() {
$('#home .btn-success').demo({
id: '1-2',
content: 'Here goes...',
callback: function() {
$('#about').demo({
id: '1-3',
content: 'Wham!'
});
}
});
}
});</code></pre>
<a href="#" class="btn btn-success example-2">Run</a>
<br><br>
<h4>Multiple simultaneous demos</h4>
<pre><code>$('#home .btn-default').demo({
id: '1-1',
content: 'This is an example demo!'
});
$('#home .btn-success').demo({
id: '1-2',
content: 'As is this one!'
});</code></pre>
<a href="#" class="btn btn-success example-3">Run</a>
</div>
<hr>
<div id="configuration">
<h2>Configuration</h2>
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>Option</th>
<th>Type</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>id</td>
<td>string | integer | false</td>
<td>false</td>
<td>Unique ID of the demo, used to determine whether it has been viewed. Only required in conjunction with the "persist" option.</td>
</tr>
<tr>
<td>persist</td>
<td>boolean</td>
<td>true</td>
<td>Whether to save the ID of a demo that has been viewed in a cookie, in order for it not to be shown again.
</tr>
<tr>
<td>cookie_name</td>
<td>string</td>
<td>'_demo'</td>
<td>Name of the cookie used to store the IDs of viewed demos.</td>
</tr>
<tr>
<td>cookie_days</td>
<td>integer</td>
<td>365</td>
<td>Lifetime of the cookie used to store the IDs of viewed demos, in days.</td>
</tr>
<tr>
<td>callback</td>
<td>function(e) | false</td>
<td>false</td>
<td>Callback to execute once a viewed demo is dismissed. This callback is passed the click event.</td>
</tr>
<tr>
<td>prevent_default</td>
<td>boolean</td>
<td>true</td>
<td>Whether to prevent the some default action from occurring until demos are dismissed. These actions include scrolling, clicking and submitting.</td>
</tr>
<tr>
<td>html</td>
<td>boolean</td>
<td>true</td>
<td>Whether to allow HTML inside the created popover.</td>
</tr>
<tr>
<td>placement</td>
<td>'top' | 'left' | 'right' | 'bottom' | 'auto'</td>
<td>'auto'</td>
<td>Placement of the created popover.</td>
</tr>
<tr>
<td>title</td>
<td>string</td>
<td>'<i class="glyphicon glyphicon-bell"></i> TIP'</td>
<td>Title of the created popover.</td>
</tr>
<tr>
<td>content</td>
<td>string</td>
<td>'Click anywhere inside of the <span class="text-danger">highlighted</span> area to dismiss this popup.</td>
<td>Content of the created popover.</td>
</tr>
<tr>
<td>styles</td>
<td>string</td>
<td>
<pre><code>.demo-highlight {
cursor: pointer;
outline: 3px solid #FBB829;
}</code></pre>
</td>
<td>Styles to append to the head of the page. You can use this option to override the highlighting styles.</td>
</tr>
</tbody>
</table>
</div>
<hr>
<div id="license">
<h2>License</h2>
<p>bootstrap-demo.js is released under the MIT license:</p>
<pre class="pre-scrollable"><code>Copyright (c) 2013-2014 Kalman Olah
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
</code></pre>
</div>
<hr>
<footer>
<p class="text-right">© Kalman Olah 2013 - 2014 — <a href="http://kalmanolah.net"><i class="glyphicon glyphicon-globe"></i></a></p>
</footer>
</div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
<script src="src/bootstrap-demo.min.js"></script>
<script>
demo.options.persist = false;
$(function() {
$('.example-1').click(function(e) {
$('#home .btn-default, #home .btn-success').demo({
id: '1-1',
content: 'This is the first demo!'
});
});
$('.example-2').click(function(e) {
$('#home .btn-default').demo({
id: '1-1',
content: 'Are you ready for some chaining?',
callback: function() {
$('#home .btn-success').demo({
id: '1-2',
content: 'Here goes...',
callback: function() {
$('#about').demo({
id: '1-3',
content: 'Wham!'
});
}
});
}
});
});
$('.example-3').click(function(e) {
$('#home .btn-default').demo({
id: '1-1',
content: 'This is an example demo!'
});
$('#home .btn-success').demo({
id: '1-2',
content: 'As is this one!'
});
});
});
</script>
</body>
</html>