This repository was archived by the owner on Jan 31, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy pathindex.html
More file actions
798 lines (742 loc) · 37.1 KB
/
index.html
File metadata and controls
798 lines (742 loc) · 37.1 KB
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
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
<!DOCTYPE html>
<html>
<head>
<title>jquery bootstrap scripting; some nice scripts to for building jquery/bootstrap web applications</title>
<script type="text/javascript" src="js/jquery.1.6.2.min.js"></script>
<script type="text/javascript" src="js/jquery.controls.js"></script>
<script type="text/javascript" src="js/jquery.form.js"></script>
<script type="text/javascript" src="js/jquery.query.js"></script>
<script type="text/javascript" src="../lib/jquery.dialog2.js"></script>
<script type="text/javascript" src="../lib/jquery.dialog2.helpers.js"></script>
<script type="text/javascript" src="../lib/jquery.dialog2.iframe.js"></script>
<script type="text/javascript" src="js/prettify.js"></script>
<style type="text/css">
@import url('../css/bootstrap.css');
@import url('css/prettify.css');
@import url('../css/jquery-dialog2/jquery.dialog2.css');
@import url('css/docs.css');
</style>
<script type="text/javascript">
$(document).ready(function() {
prettyPrint();
$(document).controls();
$(".show-source-link").click(function(event) {
event.preventDefault();
var link = $(this);
var source = link.parents(".activity").nextAll(".source").eq(0);
source.toggleClass("open");
if (source.is(".open")) {
link.text("(Hide source)");
} else {
link.text("(View source)");
}
});
});
</script>
</head>
<body>
<a href="http://github.com/nikku">
<img style="position: absolute; top: 0; right: 0; border: 0;"
src="http://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"
alt="Fork me on GitHub">
</a>
<div class="container">
<header>
<h1>Dialog 2 and friends <small>for JQuery/Bootstrap</small></h1>
<p>
Some nice scripts to for building <a href="http://jquery.com">jQuery</a>
and <a href="http://twitter.github.com/bootstrap">bootstrap</a> based web applications.
</p>
<div class="subnav">
<ul class="nav nav-pills">
<li class="active">
<a href="#">Dialog 2</a>
</li>
<li style="float: right">
<a href="https://github.com/Nikku/jquery-bootstrap-scripting/">Documentation</a>
</li>
<li style="float: right">
<a href="https://github.com/Nikku/jquery-bootstrap-scripting/zipball/master">Download</a>
</li>
</ul>
</div>
</header>
<div class="row">
<div class="span16 columns">
<div class="page-header">
<h1>The modal dialog plugin <small>jquery.dialog2.js</small></h1>
</div>
<p>
A jQuery modal dialog plugin based on the bootstrap CSS blue print.
Has some nice features such as ajax forms / links,
page load indicators and other nice gimmics. Can create in-page modal boxes too, but is
basically made for navigation within chains of dialog windows.
</p>
<div class="alert alert-block">
<strong>Compatibility Note</strong>
This version of the plugin requires bootstrap >= 2.0.
If you still want to use bootstrap 1.x check out <a href="https://github.com/Nikku/jquery-bootstrap-scripting/tree/1.2">the old version</a> of the plugin.
</div>
<div class="sample">
<h3>A simple in page alert</h3>
<p>
Dialogs can be created both <a href="#create-using-javascript">using JavaScript</a>
and via <a href="#create-using-jquery-controls">special links</a> on a page.
</p>
<div class="activity">
<p>
Display a <a class="open-dialog" closeOnEscape="false" closeOnOverlayClick="false" showCloseHandle="false" rel="sample1-dialog">simple alert</a>.
<a class="show-source-link" href="#">(View source)</a>
</p>
</div>
<div id="sample1-dialog" style="display: none">
<h1>Simple alert</h1>
<p>
It is always beneficial to acknowledge alerts of any kind.
You can close this alert if you agree.
(Note: Normally a dialog box is not that penetrating)
</p>
<div class="form-actions">
<button class="btn-primary close-dialog">Understood</button>
<button class="btn-danger" onclick="alert('You might reconsider your click behaviour!')">I don't care</button>
</div>
</div>
<div class="source">
<h5>Source</h5>
<p>Embedding the dialog in the (see <a href="#automatic-links">automatic links</a>)</p>
<pre class="prettyprint lang-html">
<a class="open-dialog" closeOnEscape="false" closeOnOverlayClick="false" showCloseHandle="false" rel="sample1-dialog">simple alert</a>
<!-- which is equivalent to the following JavaScript snippet -->
<script type="text/javascript">
$(function() {
$("#sample1-dialog").dialog2({
showCloseHandle: false,
removeOnClose: false,
autoOpen: false,
closeOnEscape: false,
closeOnOverlayClick: false
});
$(".open-dialog").click(function(event) {
event.preventDefault();
$("#sample1-dialog").dialog2("open");
});
});
</script></pre>
<p>The dialogs contents (read more about it <a href="#let-markup-rule">here</a>)</p>
<pre class="prettyprint lang-html">
<div id="sample1-dialog" style="display: none">
<h1>Simple alert</h1>
<p>
It is always beneficial to acknowledge alerts of any kind.
You can close this alert if you agree.
(Note: Normally a dialog box is not that penetrating)
</p>
<div class="form-actions">
<button class="btn-primary close-dialog">Understood</button>
<button class="btn-danger" onclick="alert('You might reconsider your click behaviour!')">I don't care</button>
</div>
</div></pre>
</div>
</div>
<div class="sample">
<h3>Dialog page flow</h3>
<p>
A dialogs content can be loaded via ajax. Inside a dialog, the user can navigate
via links as well as form submissions.
Additionally navigation can be programmatically controlled via JavaScript.
In most cases however there is barely any JavaScript needed to set up
page flow within a dialog (see <a href="#let-markup-rule">how html markup
impacts the dialog</a>).
</p>
<div class="activity">
<p>
Check out <a class="open-dialog" rel="sample2-dialog" href="pages/dialog1.html">running example</a>.
<a class="show-source-link" href="#">(View source)</a>
</p>
</div>
<div class="source">
<h5>Source</h5>
<p>Embedding the dialog in the (see <a href="#automatic-links">automatic links</a>)</p>
<pre class="prettyprint lang-html">
<a class="open-dialog" rel="sample2-dialog" href="pages/dialog1.html">running example</a></pre>
<p>Contents of first dialog page</p>
<pre class="prettyprint lang-html">
<!DOCTYPE html>
<html>
<head>
<title>jQuery dialog2 plugin</title>
</head>
<body>
<h1>My Dialog</h1>
<p>
This is some fine body.
<a class="ajax" href="pages/dialog2.html">Click this link</a> (will stay in dialog).
</p>
<div class="form-actions">
<a class="btn close-dialog" href="#">Cancel</a>
</div>
</body>
</html></pre>
<p>Contents of second dialog page</p>
<pre class="prettyprint lang-html">
<!DOCTYPE html>
<html>
<head>
<title>jQuery dialog2 plugin</title>
</head>
<body>
<h1>Thanks :-)</h1>
<p>
Thanks for clicking the previous link. May you tell me your name?
</p>
<form class="ajax" method="get" action="pages/finish.html">
<fieldset>
<div class="clearfix">
<label for="name">Your name</label>
<div class="input">
<input type="text" name="name" id="name" />
</div>
</div>
</fieldset>
<div class="form-actions">
<input type="submit" value="Send" class="btn btn-primary" />
<a class="btn close-dialog" href="#">Cancel</a>
</div>
</form>
</body>
</html></pre>
<p>Contents of final dialog page</p>
<pre class="prettyprint lang-html">
<!DOCTYPE html>
<html>
<head>
<title>jQuery dialog2 plugin</title>
</head>
<body>
<h1>That's really it</h1>
<p>
All right, so much about this short demo.
</p>
<script type="text/javascript">
$("#sample2-dialog").dialog2({
buttons: {
"Close": function() {
$(this).dialog2("close");
}
}
});
</script>
</body>
</html></pre>
</div>
</div>
<h2>
Controlling a dialog via JavaScript
</h2>
<p>
The dialog plugin exposes a jquery interface which can be invoked via JavaScript.
The jquery method <code>dialog2</code> is both the constructor for new
dialogs and the provider of the API.
The constructor accepts an options argument like <code>$(".selector").dialog2(options)</code>
and the invocation of an API method starts with the method name and the list of method
arguments like <code>$(".selector").dialog2("removeButton", "Close")</code>.
See <a href="https://github.com/nikku/jquery-bootstrap-scripting#readme">detailed notes on that</a>.
</p>
<div class="sample">
<h3>Loading server content (programmatic way)</h3>
<p>
It is possible to pass a <code>content</code> attribute to the dialog via its constructor options
to make the dialog display a certain web page.
</p>
<div class="activity">
<p>
Load and <a href="#" id="show-server-notice-link">show me some server content!</a>
<a class="show-source-link" href="#">(View source)</a>
</p>
</div>
<script type="text/javascript">
$(function() {
$("#show-server-notice-link").click(function(event) {
$('<div/>').dialog2({
title: "Server notice",
initialLoadText: "Loading contents...",
content: "pages/notice.html",
id: "server-notice"
});
event.preventDefault();
});
});
</script>
<div class="source">
<h5>Source</h5>
<pre class="prettyprint lang-html">
<a href="#" id="show-server-notice-link">show me some server content!</a>
<script type="text/javascript">
$(function() {
$("#show-server-notice-link").click(function(event) {
$('<div/>').dialog2({
title: "Server notice",
content: "pages/notice.html",
id: "server-notice"
});
event.preventDefault();
});
});
</script></pre>
</div>
</div>
<div class="sample">
<h3>Creating in page dialogs</h3>
<p>
Dialogs can be created using an existing element as a body or
by aggregating a number of elements in it.
</p>
<div class="activity">
<p>
<a href="#" onclick="$('#alert').dialog2('open'); return false">Create and open dialog</a>
from single <code>div</code>. <em>No AJAX is needed here</em>
<a class="show-source-link" href="#">(View source)</a>
</p>
</div>
<div id="alert">
<p>This is an alert! Just want to inform you about that.</p>
</div>
<script type="text/javascript">
$(function() {
$("#alert").dialog2({
title: "Alert",
autoOpen: false,
buttons: {
Close: {
primary: true,
click: function() {
$(this).dialog2("close");
}
}
},
removeOnClose: false
});
});
</script>
<div class="source">
<h5>Source</h5>
<pre class="prettyprint lang-html">
<div id="alert">
<p>This is an alert! Just want to inform you about that.</p>
</div>
<script type="text/javascript">
$(function() {
$("#alert").dialog2({
title: "Alert",
autoOpen: false,
buttons: {
Close: {
primary: true,
click: function() {
$(this).dialog2("close");
}
}
},
removeOnClose: false
});
});
</script></pre>
</div>
<div class="activity">
<p>
<a href="#" onclick="$('#alert2').dialog2('open'); return false">Open dialog</a> which aggregates a number of elements.
<em>No AJAX is needed here</em>
<a class="show-source-link" href="#">(View source)</a>
</p>
</div>
<p class="custom-dialog-content">
foo
</p>
<p class="custom-dialog-content">
and
</p>
<p class="custom-dialog-content">
bar
</p>
<p class="custom-dialog-content">
makes
</p>
<p class="custom-dialog-content">
foobar
</p>
<script type="text/javascript">
$(function() {
$(".custom-dialog-content").dialog2({
title: "Alert",
id: "alert2",
autoOpen: false,
buttons: {
Close: {
primary: true,
click: function() {
$(this).dialog2("close");
}
}
},
removeOnClose: false
});
});
</script>
<div class="source">
<h5>Source</h5>
<pre class="prettyprint lang-html">
<p class="custom-dialog-content">
foo
</p>
<p class="custom-dialog-content">
and
</p>
<p class="custom-dialog-content">
bar
</p>
<p class="custom-dialog-content">
makes
</p>
<p class="custom-dialog-content">
foobar
</p>
<script type="text/javascript">
$(function() {
$(".custom-dialog-content").dialog2({
title: "Alert",
id: "alert2",
autoOpen: false,
buttons: {
Close: {
primary: true,
click: function() {
$(this).dialog2("close");
}
}
},
removeOnClose: false
});
});
</script></pre>
</div>
</div>
<h2 id="let-markup-rule">Let the markup rule</h2>
<h3>Default behaviour</h3>
<p>
Dialog will show load indicator every time an ajax request is done to load
new dialog pages from somewhere. If response body contains a <code>h1</code>
the contents of this heading will be the new dialog title.
</p>
<p>
If response html contains a submitable <code>form.ajax</code> a submit handler
will be bound the dialog and a submit button will be added to the dialog while
the original submit button (if any) will be hidden.
</p>
<p>
<code>a.ajax</code> links within the dialog content will trigger loading of a new
dialog page <em>inside</em> the dialog.
</p>
<h3 id="automatic-links">Automatically ajaxifying links on a web page</h3>
<p>
In conjunction with the <code>jquery.controls</code> plugin, the dialog will register
dialog open for all <code>a.open-dialog</code> within a document. The title will be
via the links <code>title</code> attribute and the id is determined via the links <code>rel</code>
attribute (see previous examples on that).
</p>
<h3>Dialog customizations based on its content</h3>
<p>
The dialog will change its apperance and behaviour based on its contents:
</p>
<ul style="margin-left: 50px;">
<li>
The first <code>h1</code> text content is used as the dialogs <code>title</code>.
</li>
<li>
<code>a.ajax</code> elements in the dialogs content
navigate to new pages within the dialog.
</li>
<li>
<code>form.ajax</code> elements are ajax-submitted
and the response is displayed as the new content
of the dialog.
</li>
<li>
All elements (<code>input[type=submit], input[type=reset], input[type=button], button, .btn</code>)
within a <code>.form-actions</code> element inside the dialog body are
treated as buttons and <em>override</em> the dialogs current buttons.
Buttons added to the dialog will inherit the original buttons class,
click behaviour and text (e.g. a button mapping to a
<code>input[type=submit]</code>
will submit the form the original input was attached to).
</li>
</ul>
<div class="sample">
<div class="activity">
<p>
<a href="#" rel="alert3" class="open-dialog">Demonstrate that!</a>
<a class="show-source-link" href="#">(View source)</a>
</p>
</div>
<div id="alert3">
<h1>This is a special alert</h1>
<p>Submit this dialog to go to heaven!</p>
<form class="ajax" method="get" action="pages/heaven.html">
<input type="hidden" name="nothing" value="to-see" />
<div class="form-actions">
<input type="submit" class="primary" />
<a class="btn close-dialog" href="#">Close</a>
</div>
</form>
</div>
<div class="source">
<h5>Source</h5>
<pre class="prettyprint lang-html">
<a href="#" rel="alert3" class="open-dialog">Demonstrate that!</a>
<div id="alert3">
<h1>This is a special alert</h1>
<p>Submit this dialog to go to heaven!</p>
<form class="ajax" method="get" action="pages/heaven.html">
<input type="hidden" name="nothing" value="to-see" />
<div class="form-actions">
<input type="submit" class="primary" />
<a class="btn close-dialog" href="#">Close</a>
</div>
</form>
</div></pre>
</div>
<div class="activity">
<p>
Or let me at least
<a href="#" rel="alert4" class="open-dialog">
decide on my favourite button color!
</a>
<a class="show-source-link" href="#">(View source)</a>
</p>
</div>
<div id="alert4">
<h1>Decision</h1>
<p>Decide on an option</p>
<div class="form-actions">
<a class="btn btn-info" href="#">Info</a>
<a class="btn btn-success" href="#">Success</a>
<button class="btn btn-danger">Danger</button>
<button class="btn close-dialog">Close</button>
</div>
</div>
<script type="text/javascript">
$(function() {
$("#alert4 .form-actions > *").click(function() {
alert("You chose " + $(this).text());
});
});
</script>
<div class="source">
<h5>Source</h5>
<!-- https://gist.github.com/1201643 -->
<pre class="prettyprint lang-html">
<a href="#" rel="alert4" class="open-dialog">decide on my favourite button color!</a>
<div id="alert4">
<h1>Decision</h1>
<p>Decide on an option</p>
<div class="form-actions">
<a class="btn btn-info" href="#">Info</a>
<a class="btn btn-success" href="#">Success</a>
<button class="btn btn-danger">Danger</button>
<button class="btn dialog-close">Close</button>
</div>
</div>
<script type="text/javascript">
$(function() {
$("#alert4 .form-actions > *").click(function() {
alert("You chose " + $(this).text());
});
});
</script></pre>
</div>
</div>
<h2>Using <code>alert</code>, <code>confirm</code> and <code>prompt</code> helpers</h2>
<p>
The script file <code>jquery.dialog2.helpers.js</code> provides unobstrusive
counterparts to the window functions <code>alert</code>, <code>confirm</code> and <code>prompt</code>.
They are available as function in the namespace <code>$.fn.dialog2.helpers.*</code>.
</p>
<div class="activity">
<p>
Check out
<a href="#" id="show-alert">alert</a>,
<a href="#" id="show-confirm">confirm</a>,
<a href="#" id="show-prompt">prompt</a>
<a class="show-source-link" href="#">(View source)</a>
</p>
</div>
<script type="text/javascript">
$("#show-alert").click(function(event) {
$.fn.dialog2.helpers.alert("This dialog is non intrusive", {
close: function() {
alert("This one is!");
}
});
event.preventDefault();
});
$("#show-prompt").click(function() {
$.fn.dialog2.helpers.prompt("What is your age?", {
ok: function(event, value) { alert("Your age is: " + value); },
cancel: function() { alert("Better tell me!"); }
});
event.preventDefault();
});
$("#show-confirm").click(function() {
$.fn.dialog2.helpers.confirm("Is this dialog non intrusive?", {
confirm: function() { alert("You said yes? Well... no"); },
decline: function() { alert("You said no? Right choice!") }
});
event.preventDefault();
});
</script>
<div class="source">
<h5>Source</h5>
<pre class="prettyprint lang-html">
<a href="#" id="show-alert">alert</a>,
<a href="#" id="show-confirm">confirm</a>,
<a href="#" id="show-prompt">prompt</a>
<script type="text/javascript">
$("#show-alert").click(function(event) {
$.fn.dialog2.helpers.alert("This dialog is non intrusive", {
close: function() {
alert("This one is!");
}
});
event.preventDefault();
});
$("#show-prompt").click(function() {
$.fn.dialog2.helpers.prompt("What is your age?", {
ok: function(event, value) { alert("Your age is: " + value); },
cancel: function() { alert("Better tell me!"); }
});
event.preventDefault();
});
$("#show-confirm").click(function() {
$.fn.dialog2.helpers.confirm("Is this dialog non intrusive?", {
confirm: function() { alert("You said yes? Well... no"); },
decline: function() { alert("You said no? Right choice!") }
});
event.preventDefault();
});
</script>
</pre>
</div>
<h2>Hook into the behaviour of the dialog using events</h2>
<p>
One can hook into the dialog by listening to events prefixed with <code>dialog2.</code>.
</p>
<div class="activity">
<p>
Open <a href="#" id="show-server-notice-verbose-link">a dialog</a> logging fired events.<br/>
<a href="#" id="show-logged-events-link">Show</a> the logged events.
<!--a class="show-source-link" href="#">(View source)</a-->
</p>
</div>
<p>
The events observed during the life cycle of a dialog are sumarized in the table below:
</p>
<table class="table table-bordered">
<thead>
<tr><th>event name</th><th>semantics</th></tr>
</thead>
<tbody>
<tr><td style="width: 220px"><code>dialog2.before-open</code></td><td>the dialog is about to open</td><tr>
<tr><td><code>dialog2.opened</code></td><td>the dialog was opened</td><tr>
<tr><td><code>dialog2.focussed</code></td><td>the dialog gains focus</td><tr>
<tr><td><code>dialog2.ajax-start</code></td><td>an ajax update is about to start</td><tr>
<tr><td><code>dialog2.before-send</code></td><td>the xhr request is about to be sent inside the dialog (on form submit or content load). <code>jqXhr, settings</code> is passed as additional arguments</td><tr>
<tr><td colspan="2">Updating the contents with the dialogs initial html</td></tr>
<tr><td><code>dialog2.content-update</code></td><td>update content</td><tr>
<tr><td><code>dialog2.before-ajaxify</code></td><td>before applying ajax controls to content</td><tr>
<tr><td><code>dialog2.after-ajaxify</code></td><td>after applying ajax controls to content</td><tr>
<tr><td><code>dialog2.before-update-markup</code></td><td>before updating the dialog markup from content HTML (e.g. update button bar)</td><tr>
<tr><td><code>dialog2.after-update-markup</code></td><td>after updating the dialog markup</td><tr>
<tr><td><code>dialog2.focussed</code></td><td>the dialog gains focus once more (selects first focusable element)</td><tr>
<tr><td><code>dialog2.ajax-complete</code></td><td>ajax operation is complete</td><tr>
<tr><td colspan="2">Updating the contents with the response received from the server (events have same semantics as explained above)</td><tr>
<tr><td><code>dialog2.content-update</code></td><td></td><tr>
<tr><td><code>dialog2.before-ajaxify</code></td><td></td><tr>
<tr><td><code>dialog2.after-ajaxify</code></td><td></td><tr>
<tr><td><code>dialog2.before-update-markup</code></td><td></td><tr>
<tr><td><code>dialog2.after-update-markup</code></td><td></td><tr>
<tr><td><code>dialog2.focussed</code></td><td></td><tr>
<tr><td><code>dialog2.closed</code></td><td>the dialog is closed</td><tr>
</tbody>
</table>
<script type="text/javascript">
$(function() {
var eventLog = [];
$("#show-logged-events-link").click(function(event) {
event.preventDefault();
if (console && console.log) {
console.log(eventLog);
}
alert("Logged events: \n" + eventLog);
});
$("#show-server-notice-verbose-link").click(function(event) {
var dialog = $('<div/>');
var events = [
"dialog2.ajax-start",
"dialog2.before-send",
"dialog2.ajax-complete",
"dialog2.content-update",
"dialog2.before-update-markup",
"dialog2.after-update-markup",
"dialog2.before-ajaxify",
"dialog2.after-ajaxify",
"dialog2.focussed",
"dialog2.closed",
"dialog2.before-open",
"dialog2.opened" ];
$.each(events, function(i, e) {
dialog.bind(e, function(event) {
eventLog.push(e);
});
});
dialog.dialog2({
title: "Server notice",
initialLoadText: "Loading contents...",
content: "pages/notice.html",
id: "server-notice"
});
event.preventDefault();
});
});
</script>
<h2>Open external websites within an iframe in your modal</h2>
<div class="activity">
<p>
Open <a href="pages/iframe.html" id="dialog-iframe" title="IFrame Title">a dialog</a> with an iframe inside.<br/>
<a class="show-source-link" href="#">(View source)</a>
</p>
</div>
<div class="source">
<h5>Source</h5>
<pre class="prettyprint lang-html">
<a href="pages/iframe.html" id="dialog-iframe" title="IFrame Title">open external url!</a>
<script type="text/javascript">
$(function() {
$("#dialog-iframe").dialog2IFrame({
height: 300,
appendParamUrl: false,
reloadOnClose: false
});
});
</script></pre>
</div>
<script type-"text/javascript">
$('#dialog-iframe').dialog2IFrame();
</script>
<h2>Clarification needed?</h2>
<p>
Check out the <a href="https://github.com/Nikku/jquery-bootstrap-scripting/#readme">plugin documentation</a>.
</p>
</div>
</div>
</div>
</body>
</html>