aladdin 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. data/LICENSE +22 -0
  2. data/README.md +43 -0
  3. data/assets/images/foundation/orbit/bullets.jpg +0 -0
  4. data/assets/images/foundation/orbit/left-arrow-small.png +0 -0
  5. data/assets/images/foundation/orbit/left-arrow.png +0 -0
  6. data/assets/images/foundation/orbit/loading.gif +0 -0
  7. data/assets/images/foundation/orbit/mask-black.png +0 -0
  8. data/assets/images/foundation/orbit/pause-black.png +0 -0
  9. data/assets/images/foundation/orbit/right-arrow-small.png +0 -0
  10. data/assets/images/foundation/orbit/right-arrow.png +0 -0
  11. data/assets/images/foundation/orbit/rotator-black.png +0 -0
  12. data/assets/images/foundation/orbit/timer-black.png +0 -0
  13. data/assets/javascripts/foundation/app.js +38 -0
  14. data/assets/javascripts/foundation/jquery.cookie.js +72 -0
  15. data/assets/javascripts/foundation/jquery.event.move.js +580 -0
  16. data/assets/javascripts/foundation/jquery.event.swipe.js +130 -0
  17. data/assets/javascripts/foundation/jquery.foundation.accordion.js +34 -0
  18. data/assets/javascripts/foundation/jquery.foundation.alerts.js +20 -0
  19. data/assets/javascripts/foundation/jquery.foundation.buttons.js +74 -0
  20. data/assets/javascripts/foundation/jquery.foundation.clearing.js +468 -0
  21. data/assets/javascripts/foundation/jquery.foundation.forms.js +486 -0
  22. data/assets/javascripts/foundation/jquery.foundation.joyride.js +639 -0
  23. data/assets/javascripts/foundation/jquery.foundation.magellan.js +85 -0
  24. data/assets/javascripts/foundation/jquery.foundation.mediaQueryToggle.js +27 -0
  25. data/assets/javascripts/foundation/jquery.foundation.navigation.js +55 -0
  26. data/assets/javascripts/foundation/jquery.foundation.orbit.js +897 -0
  27. data/assets/javascripts/foundation/jquery.foundation.reveal.js +794 -0
  28. data/assets/javascripts/foundation/jquery.foundation.tabs.js +43 -0
  29. data/assets/javascripts/foundation/jquery.foundation.tooltips.js +193 -0
  30. data/assets/javascripts/foundation/jquery.foundation.topbar.js +152 -0
  31. data/assets/javascripts/foundation/jquery.js +9440 -0
  32. data/assets/javascripts/foundation/jquery.offcanvas.js +50 -0
  33. data/assets/javascripts/foundation/jquery.placeholder.js +157 -0
  34. data/assets/javascripts/foundation/modernizr.foundation.js +4 -0
  35. data/bin/aladdin +20 -0
  36. data/lib/aladdin.rb +43 -0
  37. data/lib/aladdin/app.rb +89 -0
  38. data/lib/aladdin/render/markdown.rb +40 -0
  39. data/lib/aladdin/render/sanitize.rb +84 -0
  40. data/lib/aladdin/version.rb +4 -0
  41. data/views/haml/index.haml +43 -0
  42. data/views/haml/layout.haml +51 -0
  43. data/views/scss/_settings.scss +242 -0
  44. data/views/scss/app.scss +47 -0
  45. data/views/scss/github.scss +65 -0
  46. data/views/scss/pygment.scss +12 -0
  47. metadata +307 -0
@@ -0,0 +1,794 @@
1
+ /*
2
+ * jQuery Reveal Plugin 1.1
3
+ * www.ZURB.com
4
+ * Copyright 2010, ZURB
5
+ * Free to use under the MIT license.
6
+ * http://www.opensource.org/licenses/mit-license.php
7
+ */
8
+ /*globals jQuery */
9
+
10
+ (function ($) {
11
+ 'use strict';
12
+ //
13
+ // Global variable.
14
+ // Helps us determine if the current modal is being queued for display.
15
+ //
16
+ var modalQueued = false;
17
+
18
+ //
19
+ // Bind the live 'click' event to all anchor elemnets with the data-reveal-id attribute.
20
+ //
21
+ $(document).on('click', 'a[data-reveal-id]', function ( event ) {
22
+ //
23
+ // Prevent default action of the event.
24
+ //
25
+ event.preventDefault();
26
+ //
27
+ // Get the clicked anchor data-reveal-id attribute value.
28
+ //
29
+ var modalLocation = $( this ).attr( 'data-reveal-id' );
30
+ //
31
+ // Find the element with that modalLocation id and call the reveal plugin.
32
+ //
33
+ $( '#' + modalLocation ).reveal( $( this ).data() );
34
+
35
+ });
36
+
37
+ /**
38
+ * @module reveal
39
+ * @property {Object} [options] Reveal options
40
+ */
41
+ $.fn.reveal = function ( options ) {
42
+ /*
43
+ * Cache the document object.
44
+ */
45
+ var $doc = $( document ),
46
+ /*
47
+ * Default property values.
48
+ */
49
+ defaults = {
50
+ /**
51
+ * Possible options: fade, fadeAndPop, none
52
+ *
53
+ * @property animation
54
+ * @type {String}
55
+ * @default fadeAndPop
56
+ */
57
+ animation: 'fadeAndPop',
58
+ /**
59
+ * Speed at which the reveal should show. How fast animtions are.
60
+ *
61
+ * @property animationSpeed
62
+ * @type {Integer}
63
+ * @default 300
64
+ */
65
+ animationSpeed: 300,
66
+ /**
67
+ * Should the modal close when the background is clicked?
68
+ *
69
+ * @property closeOnBackgroundClick
70
+ * @type {Boolean}
71
+ * @default true
72
+ */
73
+ closeOnBackgroundClick: true,
74
+ /**
75
+ * Specify a class name for the 'close modal' element.
76
+ * This element will close an open modal.
77
+ *
78
+ @example
79
+ <a href='#close' class='close-reveal-modal'>Close Me</a>
80
+ *
81
+ * @property dismissModalClass
82
+ * @type {String}
83
+ * @default close-reveal-modal
84
+ */
85
+ dismissModalClass: 'close-reveal-modal',
86
+ /**
87
+ * Specify a callback function that triggers 'before' the modal opens.
88
+ *
89
+ * @property open
90
+ * @type {Function}
91
+ * @default function(){}
92
+ */
93
+ open: $.noop,
94
+ /**
95
+ * Specify a callback function that triggers 'after' the modal is opened.
96
+ *
97
+ * @property opened
98
+ * @type {Function}
99
+ * @default function(){}
100
+ */
101
+ opened: $.noop,
102
+ /**
103
+ * Specify a callback function that triggers 'before' the modal prepares to close.
104
+ *
105
+ * @property close
106
+ * @type {Function}
107
+ * @default function(){}
108
+ */
109
+ close: $.noop,
110
+ /**
111
+ * Specify a callback function that triggers 'after' the modal is closed.
112
+ *
113
+ * @property closed
114
+ * @type {Function}
115
+ * @default function(){}
116
+ */
117
+ closed: $.noop
118
+ }
119
+ ;
120
+ //
121
+ // Extend the default options.
122
+ // This replaces the passed in option (options) values with default values.
123
+ //
124
+ options = $.extend( {}, defaults, options );
125
+
126
+ //
127
+ // Apply the plugin functionality to each element in the jQuery collection.
128
+ //
129
+ return this.not('.reveal-modal.open').each( function () {
130
+ //
131
+ // Cache the modal element
132
+ //
133
+ var modal = $( this ),
134
+ //
135
+ // Get the current css 'top' property value in decimal format.
136
+ //
137
+ topMeasure = parseInt( modal.css( 'top' ), 10 ),
138
+ //
139
+ // Calculate the top offset.
140
+ //
141
+ topOffset = modal.height() + topMeasure,
142
+ //
143
+ // Helps determine if the modal is locked.
144
+ // This way we keep the modal from triggering while it's in the middle of animating.
145
+ //
146
+ locked = false,
147
+ //
148
+ // Get the modal background element.
149
+ //
150
+ modalBg = $( '.reveal-modal-bg' ),
151
+ //
152
+ // Show modal properties
153
+ //
154
+ cssOpts = {
155
+ //
156
+ // Used, when we show the modal.
157
+ //
158
+ open : {
159
+ //
160
+ // Set the 'top' property to the document scroll minus the calculated top offset.
161
+ //
162
+ 'top': 0,
163
+ //
164
+ // Opacity gets set to 0.
165
+ //
166
+ 'opacity': 0,
167
+ //
168
+ // Show the modal
169
+ //
170
+ 'visibility': 'visible',
171
+ //
172
+ // Ensure it's displayed as a block element.
173
+ //
174
+ 'display': 'block'
175
+ },
176
+ //
177
+ // Used, when we hide the modal.
178
+ //
179
+ close : {
180
+ //
181
+ // Set the default 'top' property value.
182
+ //
183
+ 'top': topMeasure,
184
+ //
185
+ // Has full opacity.
186
+ //
187
+ 'opacity': 1,
188
+ //
189
+ // Hide the modal
190
+ //
191
+ 'visibility': 'hidden',
192
+ //
193
+ // Ensure the elment is hidden.
194
+ //
195
+ 'display': 'none'
196
+ }
197
+
198
+ },
199
+ //
200
+ // Initial closeButton variable.
201
+ //
202
+ $closeButton
203
+ ;
204
+
205
+ //
206
+ // Do we have a modal background element?
207
+ //
208
+ if ( modalBg.length === 0 ) {
209
+ //
210
+ // No we don't. So, let's create one.
211
+ //
212
+ modalBg = $( '<div />', { 'class' : 'reveal-modal-bg' } )
213
+ //
214
+ // Then insert it after the modal element.
215
+ //
216
+ .insertAfter( modal );
217
+ //
218
+ // Now, fade it out a bit.
219
+ //
220
+ modalBg.fadeTo( 'fast', 0.8 );
221
+ }
222
+
223
+ //
224
+ // Helper Methods
225
+ //
226
+
227
+ /**
228
+ * Unlock the modal for animation.
229
+ *
230
+ * @method unlockModal
231
+ */
232
+ function unlockModal() {
233
+ locked = false;
234
+ }
235
+
236
+ /**
237
+ * Lock the modal to prevent further animation.
238
+ *
239
+ * @method lockModal
240
+ */
241
+ function lockModal() {
242
+ locked = true;
243
+ }
244
+
245
+ /**
246
+ * Closes all open modals.
247
+ *
248
+ * @method closeOpenModal
249
+ */
250
+ function closeOpenModals() {
251
+ //
252
+ // Get all reveal-modal elements with the .open class.
253
+ //
254
+ var $openModals = $( ".reveal-modal.open" );
255
+ //
256
+ // Do we have modals to close?
257
+ //
258
+ if ( $openModals.length === 1 ) {
259
+ //
260
+ // Set the modals for animation queuing.
261
+ //
262
+ modalQueued = true;
263
+ //
264
+ // Trigger the modal close event.
265
+ //
266
+ $openModals.trigger( "reveal:close" );
267
+ }
268
+
269
+ }
270
+ /**
271
+ * Animates the modal opening.
272
+ * Handles the modal 'open' event.
273
+ *
274
+ * @method openAnimation
275
+ */
276
+ function openAnimation() {
277
+ //
278
+ // First, determine if we're in the middle of animation.
279
+ //
280
+ if ( !locked ) {
281
+ //
282
+ // We're not animating, let's lock the modal for animation.
283
+ //
284
+ lockModal();
285
+ //
286
+ // Close any opened modals.
287
+ //
288
+ closeOpenModals();
289
+ //
290
+ // Now, add the open class to this modal.
291
+ //
292
+ modal.addClass( "open" );
293
+
294
+ //
295
+ // Are we executing the 'fadeAndPop' animation?
296
+ //
297
+ if ( options.animation === "fadeAndPop" ) {
298
+ //
299
+ // Yes, we're doing the 'fadeAndPop' animation.
300
+ // Okay, set the modal css properties.
301
+ //
302
+ //
303
+ // Set the 'top' property to the document scroll minus the calculated top offset.
304
+ //
305
+ cssOpts.open.top = $doc.scrollTop() - topOffset;
306
+ //
307
+ // Flip the opacity to 0.
308
+ //
309
+ cssOpts.open.opacity = 0;
310
+ //
311
+ // Set the css options.
312
+ //
313
+ modal.css( cssOpts.open );
314
+ //
315
+ // Fade in the background element, at half the speed of the modal element.
316
+ // So, faster than the modal element.
317
+ //
318
+ modalBg.fadeIn( options.animationSpeed / 2 );
319
+
320
+ //
321
+ // Let's delay the next animation queue.
322
+ // We'll wait until the background element is faded in.
323
+ //
324
+ modal.delay( options.animationSpeed / 2 )
325
+ //
326
+ // Animate the following css properties.
327
+ //
328
+ .animate( {
329
+ //
330
+ // Set the 'top' property to the document scroll plus the calculated top measure.
331
+ //
332
+ "top": $doc.scrollTop() + topMeasure + 'px',
333
+ //
334
+ // Set it to full opacity.
335
+ //
336
+ "opacity": 1
337
+
338
+ },
339
+ /*
340
+ * Fade speed.
341
+ */
342
+ options.animationSpeed,
343
+ /*
344
+ * End of animation callback.
345
+ */
346
+ function () {
347
+ //
348
+ // Trigger the modal reveal:opened event.
349
+ // This should trigger the functions set in the options.opened property.
350
+ //
351
+ modal.trigger( 'reveal:opened' );
352
+
353
+ }); // end of animate.
354
+
355
+ } // end if 'fadeAndPop'
356
+
357
+ //
358
+ // Are executing the 'fade' animation?
359
+ //
360
+ if ( options.animation === "fade" ) {
361
+ //
362
+ // Yes, were executing 'fade'.
363
+ // Okay, let's set the modal properties.
364
+ //
365
+ cssOpts.open.top = $doc.scrollTop() + topMeasure;
366
+ //
367
+ // Flip the opacity to 0.
368
+ //
369
+ cssOpts.open.opacity = 0;
370
+ //
371
+ // Set the css options.
372
+ //
373
+ modal.css( cssOpts.open );
374
+ //
375
+ // Fade in the modal background at half the speed of the modal.
376
+ // So, faster than modal.
377
+ //
378
+ modalBg.fadeIn( options.animationSpeed / 2 );
379
+
380
+ //
381
+ // Delay the modal animation.
382
+ // Wait till the modal background is done animating.
383
+ //
384
+ modal.delay( options.animationSpeed / 2 )
385
+ //
386
+ // Now animate the modal.
387
+ //
388
+ .animate( {
389
+ //
390
+ // Set to full opacity.
391
+ //
392
+ "opacity": 1
393
+ },
394
+
395
+ /*
396
+ * Animation speed.
397
+ */
398
+ options.animationSpeed,
399
+
400
+ /*
401
+ * End of animation callback.
402
+ */
403
+ function () {
404
+ //
405
+ // Trigger the modal reveal:opened event.
406
+ // This should trigger the functions set in the options.opened property.
407
+ //
408
+ modal.trigger( 'reveal:opened' );
409
+
410
+ });
411
+
412
+ } // end if 'fade'
413
+
414
+ //
415
+ // Are we not animating?
416
+ //
417
+ if ( options.animation === "none" ) {
418
+ //
419
+ // We're not animating.
420
+ // Okay, let's set the modal css properties.
421
+ //
422
+ //
423
+ // Set the top property.
424
+ //
425
+ cssOpts.open.top = $doc.scrollTop() + topMeasure;
426
+ //
427
+ // Set the opacity property to full opacity, since we're not fading (animating).
428
+ //
429
+ cssOpts.open.opacity = 1;
430
+ //
431
+ // Set the css property.
432
+ //
433
+ modal.css( cssOpts.open );
434
+ //
435
+ // Show the modal Background.
436
+ //
437
+ modalBg.css( { "display": "block" } );
438
+ //
439
+ // Trigger the modal opened event.
440
+ //
441
+ modal.trigger( 'reveal:opened' );
442
+
443
+ } // end if animating 'none'
444
+
445
+ }// end if !locked
446
+
447
+ }// end openAnimation
448
+
449
+
450
+ function openVideos() {
451
+ var video = modal.find('.flex-video'),
452
+ iframe = video.find('iframe');
453
+ if (iframe.length > 0) {
454
+ iframe.attr("src", iframe.data("src"));
455
+ video.fadeIn(100);
456
+ }
457
+ }
458
+
459
+ //
460
+ // Bind the reveal 'open' event.
461
+ // When the event is triggered, openAnimation is called
462
+ // along with any function set in the options.open property.
463
+ //
464
+ modal.bind( 'reveal:open.reveal', openAnimation );
465
+ modal.bind( 'reveal:open.reveal', openVideos);
466
+
467
+ /**
468
+ * Closes the modal element(s)
469
+ * Handles the modal 'close' event.
470
+ *
471
+ * @method closeAnimation
472
+ */
473
+ function closeAnimation() {
474
+ //
475
+ // First, determine if we're in the middle of animation.
476
+ //
477
+ if ( !locked ) {
478
+ //
479
+ // We're not animating, let's lock the modal for animation.
480
+ //
481
+ lockModal();
482
+ //
483
+ // Clear the modal of the open class.
484
+ //
485
+ modal.removeClass( "open" );
486
+
487
+ //
488
+ // Are we using the 'fadeAndPop' animation?
489
+ //
490
+ if ( options.animation === "fadeAndPop" ) {
491
+ //
492
+ // Yes, okay, let's set the animation properties.
493
+ //
494
+ modal.animate( {
495
+ //
496
+ // Set the top property to the document scrollTop minus calculated topOffset.
497
+ //
498
+ "top": $doc.scrollTop() - topOffset + 'px',
499
+ //
500
+ // Fade the modal out, by using the opacity property.
501
+ //
502
+ "opacity": 0
503
+
504
+ },
505
+ /*
506
+ * Fade speed.
507
+ */
508
+ options.animationSpeed / 2,
509
+ /*
510
+ * End of animation callback.
511
+ */
512
+ function () {
513
+ //
514
+ // Set the css hidden options.
515
+ //
516
+ modal.css( cssOpts.close );
517
+
518
+ });
519
+ //
520
+ // Is the modal animation queued?
521
+ //
522
+ if ( !modalQueued ) {
523
+ //
524
+ // Oh, the modal(s) are mid animating.
525
+ // Let's delay the animation queue.
526
+ //
527
+ modalBg.delay( options.animationSpeed )
528
+ //
529
+ // Fade out the modal background.
530
+ //
531
+ .fadeOut(
532
+ /*
533
+ * Animation speed.
534
+ */
535
+ options.animationSpeed,
536
+ /*
537
+ * End of animation callback.
538
+ */
539
+ function () {
540
+ //
541
+ // Trigger the modal 'closed' event.
542
+ // This should trigger any method set in the options.closed property.
543
+ //
544
+ modal.trigger( 'reveal:closed' );
545
+
546
+ });
547
+
548
+ } else {
549
+ //
550
+ // We're not mid queue.
551
+ // Trigger the modal 'closed' event.
552
+ // This should trigger any method set in the options.closed propety.
553
+ //
554
+ modal.trigger( 'reveal:closed' );
555
+
556
+ } // end if !modalQueued
557
+
558
+ } // end if animation 'fadeAndPop'
559
+
560
+ //
561
+ // Are we using the 'fade' animation.
562
+ //
563
+ if ( options.animation === "fade" ) {
564
+ //
565
+ // Yes, we're using the 'fade' animation.
566
+ //
567
+ modal.animate( { "opacity" : 0 },
568
+ /*
569
+ * Animation speed.
570
+ */
571
+ options.animationSpeed,
572
+ /*
573
+ * End of animation callback.
574
+ */
575
+ function () {
576
+ //
577
+ // Set the css close options.
578
+ //
579
+ modal.css( cssOpts.close );
580
+
581
+ }); // end animate
582
+
583
+ //
584
+ // Are we mid animating the modal(s)?
585
+ //
586
+ if ( !modalQueued ) {
587
+ //
588
+ // Oh, the modal(s) are mid animating.
589
+ // Let's delay the animation queue.
590
+ //
591
+ modalBg.delay( options.animationSpeed )
592
+ //
593
+ // Let's fade out the modal background element.
594
+ //
595
+ .fadeOut(
596
+ /*
597
+ * Animation speed.
598
+ */
599
+ options.animationSpeed,
600
+ /*
601
+ * End of animation callback.
602
+ */
603
+ function () {
604
+ //
605
+ // Trigger the modal 'closed' event.
606
+ // This should trigger any method set in the options.closed propety.
607
+ //
608
+ modal.trigger( 'reveal:closed' );
609
+
610
+ }); // end fadeOut
611
+
612
+ } else {
613
+ //
614
+ // We're not mid queue.
615
+ // Trigger the modal 'closed' event.
616
+ // This should trigger any method set in the options.closed propety.
617
+ //
618
+ modal.trigger( 'reveal:closed' );
619
+
620
+ } // end if !modalQueued
621
+
622
+ } // end if animation 'fade'
623
+
624
+ //
625
+ // Are we not animating?
626
+ //
627
+ if ( options.animation === "none" ) {
628
+ //
629
+ // We're not animating.
630
+ // Set the modal close css options.
631
+ //
632
+ modal.css( cssOpts.close );
633
+ //
634
+ // Is the modal in the middle of an animation queue?
635
+ //
636
+ if ( !modalQueued ) {
637
+ //
638
+ // It's not mid queueu. Just hide it.
639
+ //
640
+ modalBg.css( { 'display': 'none' } );
641
+ }
642
+ //
643
+ // Trigger the modal 'closed' event.
644
+ // This should trigger any method set in the options.closed propety.
645
+ //
646
+ modal.trigger( 'reveal:closed' );
647
+
648
+ } // end if not animating
649
+ //
650
+ // Reset the modalQueued variable.
651
+ //
652
+ modalQueued = false;
653
+ } // end if !locked
654
+
655
+ } // end closeAnimation
656
+
657
+ /**
658
+ * Destroys the modal and it's events.
659
+ *
660
+ * @method destroy
661
+ */
662
+ function destroy() {
663
+ //
664
+ // Unbind all .reveal events from the modal.
665
+ //
666
+ modal.unbind( '.reveal' );
667
+ //
668
+ // Unbind all .reveal events from the modal background.
669
+ //
670
+ modalBg.unbind( '.reveal' );
671
+ //
672
+ // Unbind all .reveal events from the modal 'close' button.
673
+ //
674
+ $closeButton.unbind( '.reveal' );
675
+ //
676
+ // Unbind all .reveal events from the body.
677
+ //
678
+ $( 'body' ).unbind( '.reveal' );
679
+
680
+ }
681
+
682
+ function closeVideos() {
683
+ var video = modal.find('.flex-video'),
684
+ iframe = video.find('iframe');
685
+ if (iframe.length > 0) {
686
+ iframe.data("src", iframe.attr("src"));
687
+ iframe.attr("src", "");
688
+ video.fadeOut(100);
689
+ }
690
+ }
691
+
692
+ //
693
+ // Bind the modal 'close' event
694
+ //
695
+ modal.bind( 'reveal:close.reveal', closeAnimation );
696
+ modal.bind( 'reveal:closed.reveal', closeVideos );
697
+ //
698
+ // Bind the modal 'opened' + 'closed' event
699
+ // Calls the unlockModal method.
700
+ //
701
+ modal.bind( 'reveal:opened.reveal reveal:closed.reveal', unlockModal );
702
+ //
703
+ // Bind the modal 'closed' event.
704
+ // Calls the destroy method.
705
+ //
706
+ modal.bind( 'reveal:closed.reveal', destroy );
707
+ //
708
+ // Bind the modal 'open' event
709
+ // Handled by the options.open property function.
710
+ //
711
+ modal.bind( 'reveal:open.reveal', options.open );
712
+ //
713
+ // Bind the modal 'opened' event.
714
+ // Handled by the options.opened property function.
715
+ //
716
+ modal.bind( 'reveal:opened.reveal', options.opened );
717
+ //
718
+ // Bind the modal 'close' event.
719
+ // Handled by the options.close property function.
720
+ //
721
+ modal.bind( 'reveal:close.reveal', options.close );
722
+ //
723
+ // Bind the modal 'closed' event.
724
+ // Handled by the options.closed property function.
725
+ //
726
+ modal.bind( 'reveal:closed.reveal', options.closed );
727
+
728
+ //
729
+ // We're running this for the first time.
730
+ // Trigger the modal 'open' event.
731
+ //
732
+ modal.trigger( 'reveal:open' );
733
+
734
+ //
735
+ // Get the closeButton variable element(s).
736
+ //
737
+ $closeButton = $( '.' + options.dismissModalClass )
738
+ //
739
+ // Bind the element 'click' event and handler.
740
+ //
741
+ .bind( 'click.reveal', function () {
742
+ //
743
+ // Trigger the modal 'close' event.
744
+ //
745
+ modal.trigger( 'reveal:close' );
746
+
747
+ });
748
+
749
+ //
750
+ // Should we close the modal background on click?
751
+ //
752
+ if ( options.closeOnBackgroundClick ) {
753
+ //
754
+ // Yes, close the modal background on 'click'
755
+ // Set the modal background css 'cursor' propety to pointer.
756
+ // Adds a pointer symbol when you mouse over the modal background.
757
+ //
758
+ modalBg.css( { "cursor": "pointer" } );
759
+ //
760
+ // Bind a 'click' event handler to the modal background.
761
+ //
762
+ modalBg.bind( 'click.reveal', function () {
763
+ //
764
+ // Trigger the modal 'close' event.
765
+ //
766
+ modal.trigger( 'reveal:close' );
767
+
768
+ });
769
+
770
+ }
771
+
772
+ //
773
+ // Bind keyup functions on the body element.
774
+ // We'll want to close the modal when the 'escape' key is hit.
775
+ //
776
+ $( 'body' ).bind( 'keyup.reveal', function ( event ) {
777
+ //
778
+ // Did the escape key get triggered?
779
+ //
780
+ if ( event.which === 27 ) { // 27 is the keycode for the Escape key
781
+ //
782
+ // Escape key was triggered.
783
+ // Trigger the modal 'close' event.
784
+ //
785
+ modal.trigger( 'reveal:close' );
786
+ }
787
+
788
+ }); // end $(body)
789
+
790
+ }); // end this.each
791
+
792
+ }; // end $.fn
793
+
794
+ } ( jQuery ) );