-
-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathdemo.html
More file actions
1820 lines (1713 loc) · 81.4 KB
/
demo.html
File metadata and controls
1820 lines (1713 loc) · 81.4 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
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>jAlert Comprehensive Demo</title>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="src/jAlert.js"></script>
<script src="src/jAlert-functions.js"></script>
<link rel="stylesheet" href="src/jAlert.css">
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
line-height: 1.6;
margin: 0;
padding: 20px;
background: #f5f5f5;
}
.container {
max-width: 1200px;
margin: 0 auto;
background: white;
padding: 30px;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
h1 {
color: #333;
text-align: center;
margin-bottom: 40px;
}
h2 {
color: #444;
border-bottom: 2px solid #eee;
padding-bottom: 10px;
margin-top: 40px;
margin-bottom: 20px;
}
h3 {
color: #555;
margin-top: 30px;
margin-bottom: 15px;
}
.demo-section {
margin-bottom: 30px;
}
.demo-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 10px;
margin-bottom: 20px;
}
.demo-button {
padding: 10px 16px;
background: #007bff;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 14px;
transition: background 0.2s;
}
.demo-button:hover {
background: #0056b3;
}
.demo-button.red { background: #dc3545; }
.demo-button.red:hover { background: #c82333; }
.demo-button.green { background: #28a745; }
.demo-button.green:hover { background: #1e7e34; }
.demo-button.yellow { background: #ffc107; color: #333; }
.demo-button.yellow:hover { background: #e0a800; }
.demo-button.gray { background: #6c757d; }
.demo-button.gray:hover { background: #545b62; }
.note {
background: #f8f9fa;
border-left: 4px solid #007bff;
padding: 10px 15px;
margin: 10px 0;
font-style: italic;
color: #666;
}
</style>
</head>
<body>
<div class="container">
<h1>jAlert Comprehensive Demo</h1>
<p>A complete test suite for all jAlert features, variations, and edge cases.</p>
<!-- Basic Alerts -->
<h2>1. Basic Alerts</h2>
<div class="demo-section">
<h3>Simple Content</h3>
<div class="demo-grid">
<button class="demo-button" onclick="basicAlert()">Basic Alert</button>
<button class="demo-button" onclick="titleAlert()">With Title</button>
<button class="demo-button" onclick="noTitleAlert()">No Title</button>
<button class="demo-button" onclick="longContentAlert()">Long Content</button>
<button class="demo-button" onclick="htmlContentAlert()">HTML Content</button>
<button class="demo-button" onclick="emptyAlert()">Empty Alert</button>
</div>
</div>
<!-- Sizes -->
<h2>2. Sizes</h2>
<div class="demo-section">
<h3>Predefined Sizes</h3>
<div class="demo-grid">
<button class="demo-button" onclick="sizeAlert('xsm')">XSM</button>
<button class="demo-button" onclick="sizeAlert('sm')">SM</button>
<button class="demo-button" onclick="sizeAlert('md')">MD</button>
<button class="demo-button" onclick="sizeAlert('lg')">LG</button>
<button class="demo-button" onclick="sizeAlert('xlg')">XLG</button>
<button class="demo-button" onclick="sizeAlert('full')">Full Screen</button>
<button class="demo-button" onclick="sizeAlert('auto')">Auto</button>
</div>
<h3>Custom Sizes</h3>
<div class="demo-grid">
<button class="demo-button" onclick="customSizeAlert('300px')">300px</button>
<button class="demo-button" onclick="customSizeAlert('50%')">50%</button>
<button class="demo-button" onclick="customSizeAlert('600px')">600px</button>
<button class="demo-button" onclick="customSizeAlert({width:'400px', height:'300px'})">Custom W/H</button>
</div>
</div>
<!-- Themes -->
<h2>3. Themes</h2>
<div class="demo-section">
<div class="demo-grid">
<button class="demo-button" onclick="themeAlert('default')">Default</button>
<button class="demo-button red" onclick="themeAlert('red')">Red</button>
<button class="demo-button" style="background:#A20000;color:#fff" onclick="themeAlert('dark_red')">Dark Red</button>
<button class="demo-button green" onclick="themeAlert('green')">Green</button>
<button class="demo-button" style="background:#006D00;color:#fff" onclick="themeAlert('dark_green')">Dark Green</button>
<button class="demo-button" onclick="themeAlert('blue')">Blue</button>
<button class="demo-button" style="background:#024986;color:#fff" onclick="themeAlert('dark_blue')">Dark Blue</button>
<button class="demo-button yellow" onclick="themeAlert('yellow')">Yellow</button>
<button class="demo-button" style="background:#ffc107;color:#2f2f2f" onclick="themeAlert('orange')">Orange</button>
<button class="demo-button" style="background:#b85c00;color:#fff" onclick="themeAlert('dark_orange')">Dark Orange</button>
<button class="demo-button gray" onclick="themeAlert('gray')">Gray</button>
<button class="demo-button" style="background:#424242;color:#fff" onclick="themeAlert('dark_gray')">Dark Gray</button>
<button class="demo-button" onclick="themeAlert('black')">Black</button>
<button class="demo-button" onclick="themeAlert('brown')">Brown</button>
</div>
</div>
<!-- Close Button Variations -->
<h2>4. Close Button Variations</h2>
<div class="demo-section">
<div class="demo-grid">
<button class="demo-button" onclick="closeBtnAlert('default')">Default Close</button>
<button class="demo-button" onclick="closeBtnAlert('round')">Round Close</button>
<button class="demo-button" onclick="closeBtnAlert('round_white')">Round White</button>
<button class="demo-button" onclick="closeBtnAlert('alt')">Alt Close</button>
<button class="demo-button" onclick="closeBtnAlert('none')">No Close Button</button>
</div>
</div>
<!-- Close Options -->
<h2>5. Close Options</h2>
<div class="demo-section">
<div class="demo-grid">
<button class="demo-button" onclick="closeOptionAlert('click')">Close on Click</button>
<button class="demo-button" onclick="closeOptionAlert('esc')">Close on ESC</button>
<button class="demo-button" onclick="closeOptionAlert('both')">Both</button>
<button class="demo-button" onclick="closeOptionAlert('none')">Neither</button>
<button class="demo-button" onclick="autoCloseAlert(3000)">Auto Close (3s)</button>
<button class="demo-button" onclick="autoCloseAlert(1000)">Auto Close (1s)</button>
</div>
</div>
<!-- Background Colors -->
<h2>6. Background Colors</h2>
<div class="demo-section">
<div class="demo-grid">
<button class="demo-button" onclick="backgroundColorAlert('black')">Black Background</button>
<button class="demo-button" onclick="backgroundColorAlert('white')">White Background</button>
</div>
</div>
<!-- Animations -->
<h2>7. Animations</h2>
<div class="demo-section">
<h3>Show Animations</h3>
<div class="demo-grid">
<button class="demo-button" onclick="animationAlert('fadeInUp', 'fadeOutDown')">Fade Up/Down</button>
<button class="demo-button" onclick="animationAlert('bounceIn', 'bounceOut')">Bounce In/Out</button>
<button class="demo-button" onclick="animationAlert('slideInDown', 'slideOutUp')">Slide Down/Up</button>
<button class="demo-button" onclick="animationAlert('zoomIn', 'zoomOut')">Zoom In/Out</button>
<button class="demo-button" onclick="animationAlert('flipInX', 'flipOutX')">Flip X</button>
<button class="demo-button" onclick="animationAlert('rotateIn', 'rotateOut')">Rotate</button>
</div>
</div>
<!-- Buttons -->
<h2>8. Buttons</h2>
<div class="demo-section">
<h3>Single Buttons</h3>
<div class="demo-grid">
<button class="demo-button" onclick="singleBtnAlert()">Single Button</button>
<button class="demo-button" onclick="btnThemeAlert()">Button Themes</button>
<button class="demo-button" onclick="btnCallbackAlert()">Button Callbacks</button>
</div>
<h3>Multiple Buttons</h3>
<div class="demo-grid">
<button class="demo-button" onclick="multipleBtnsAlert()">Multiple Buttons</button>
<button class="demo-button" onclick="confirmAlert()">Confirm Dialog</button>
<button class="demo-button" onclick="customConfirmAlert()">Custom Confirm</button>
</div>
<h3>Button Options</h3>
<div class="demo-grid">
<button class="demo-button" onclick="btnBackgroundAlert()">Button Background</button>
<button class="demo-button" onclick="btnNoBackgroundAlert()">No Button Background</button>
<button class="demo-button" onclick="btnNoPadAlert()">No Pad + Buttons</button>
<button class="demo-button" onclick="customClassBtnAlert()">Custom Classes</button>
</div>
</div>
<!-- Images -->
<h2>9. Images</h2>
<div class="demo-section">
<h3>Basic Images</h3>
<div class="demo-grid">
<button class="demo-button" onclick="imageAlert('normal')">Normal Image</button>
<button class="demo-button" onclick="imageAlert('auto')">Auto Size</button>
<button class="demo-button" onclick="imageAlert('custom_width')">Custom Width</button>
</div>
<h3>Edge Cases</h3>
<div class="demo-grid">
<button class="demo-button red" onclick="imageAlert('broken')">Broken Image</button>
<button class="demo-button" onclick="imageAlert('tall')">Ultra Tall</button>
<button class="demo-button" onclick="imageAlert('wide')">Ultra Wide</button>
<button class="demo-button" onclick="imageAlert('tiny')">Tiny Image</button>
</div>
<h3>With Options</h3>
<div class="demo-grid">
<button class="demo-button" onclick="imageAlert('with_pad')">With Padding</button>
<button class="demo-button" onclick="imageAlert('with_title')">With Title</button>
</div>
</div>
<!-- Videos -->
<h2>10. Videos</h2>
<div class="demo-section">
<h3>Basic Videos</h3>
<div class="demo-grid">
<button class="demo-button" onclick="videoAlert('mp4')">MP4 Video</button>
<button class="demo-button" onclick="videoAlert('webm')">WebM Video</button>
<button class="demo-button" onclick="videoAlert('ogg')">OGV Video</button>
</div>
<h3>Video Options</h3>
<div class="demo-grid">
<button class="demo-button" onclick="videoAlert('no_controls')">Without Controls</button>
<button class="demo-button" onclick="videoAlert('autoplay')">Auto Play</button>
<button class="demo-button" onclick="videoAlert('muted')">Muted</button>
<button class="demo-button" onclick="videoAlert('loop')">Looping</button>
</div>
<h3>Video Sizing</h3>
<div class="demo-grid">
<button class="demo-button green" onclick="videoAlert('max_size')">Max Size (Responsive)</button>
<button class="demo-button" onclick="videoAlert('responsive')">Responsive</button>
<button class="demo-button" onclick="videoAlert('portrait')">Portrait Video</button>
</div>
<h3>YouTube & Vimeo</h3>
<div class="demo-grid">
<button class="demo-button" onclick="videoAlert('youtube')">YouTube Video</button>
<button class="demo-button" onclick="videoAlert('vimeo')">Vimeo Video</button>
<button class="demo-button" onclick="videoAlert('youtube_playlist')">YouTube Playlist</button>
<button class="demo-button green" onclick="videoAlert('youtube_responsive')">YouTube Responsive</button>
</div>
<h3>Edge Cases</h3>
<div class="demo-grid">
<button class="demo-button red" onclick="videoAlert('broken')">Broken Video</button>
<button class="demo-button" onclick="videoAlert('with_pad')">With Padding</button>
<button class="demo-button" onclick="videoAlert('no_title')">No Title</button>
</div>
</div>
<!-- Iframes -->
<h2>11. Iframes</h2>
<div class="demo-section">
<h3>Basic Iframes</h3>
<div class="demo-grid">
<button class="demo-button" onclick="iframeAlert('basic')">Basic Iframe</button>
<button class="demo-button" onclick="iframeAlert('custom_height')">Custom Height</button>
<button class="demo-button" onclick="iframeAlert('stretch')">Auto Height</button>
</div>
<h3>Auto-sizing</h3>
<div class="demo-grid">
<button class="demo-button green" onclick="iframeAlert('auto_local')">Auto (Local)</button>
<button class="demo-button" onclick="iframeAlert('auto_cross')">Auto (Cross-Origin)</button>
<button class="demo-button red" onclick="iframeAlert('auto_blocked')">Auto (Blocked)</button>
</div>
<h3>With Sizes</h3>
<div class="demo-grid">
<button class="demo-button" onclick="iframeAlert('full')">Full Screen</button>
<button class="demo-button" onclick="iframeAlert('large')">Large</button>
<button class="demo-button" onclick="iframeAlert('small')">Small</button>
</div>
<h3>Padding Options</h3>
<div class="demo-grid">
<button class="demo-button" onclick="iframeAlert('no_pad')">No Padding (Default)</button>
<button class="demo-button" onclick="iframeAlert('with_pad')">With Padding</button>
</div>
</div>
<!-- Slideshows -->
<h2>12. Slideshows</h2>
<div class="demo-section">
<h3>Basic Slideshows</h3>
<div class="demo-grid">
<button class="demo-button" onclick="slideshowAlert('basic')">Basic (3 images)</button>
<button class="demo-button" onclick="slideshowAlert('single')">Single Image</button>
<button class="demo-button" onclick="slideshowAlert('many')">Many Images (8)</button>
</div>
<h3>Controls</h3>
<div class="demo-grid">
<button class="demo-button" onclick="slideshowAlert('arrows_only')">Arrows Only</button>
<button class="demo-button" onclick="slideshowAlert('dots_only')">Dots Only</button>
<button class="demo-button" onclick="slideshowAlert('counter_only')">Counter Only</button>
<button class="demo-button" onclick="slideshowAlert('no_controls')">No Controls</button>
</div>
<h3>Thumbnails</h3>
<div class="demo-grid">
<button class="demo-button" onclick="slideshowAlert('thumbs_bottom')">Thumbnails Bottom</button>
<button class="demo-button" onclick="slideshowAlert('thumbs_top')">Thumbnails Top</button>
<button class="demo-button red" onclick="slideshowAlert('thumbs_error')">Thumbnail Errors</button>
<button class="demo-button green" onclick="thumbnailSlideshowAlert()">Advanced Thumbnails</button>
</div>
<h3>Image Modes</h3>
<div class="demo-grid">
<button class="demo-button" onclick="slideshowAlert('contain')">Contain Mode</button>
<button class="demo-button" onclick="slideshowAlert('cover')">Cover Mode</button>
<button class="demo-button green" onclick="coverModeSlideshowAlert()">Cover Mode + Large Size</button>
</div>
<h3>Auto-advance</h3>
<div class="demo-grid">
<button class="demo-button" onclick="slideshowAlert('auto_fast')">Auto Fast (1s)</button>
<button class="demo-button" onclick="slideshowAlert('auto_slow')">Auto Slow (3s)</button>
<button class="demo-button" onclick="slideshowAlert('loop')">Loop</button>
<button class="demo-button" onclick="slideshowAlert('no_loop')">No Loop</button>
</div>
<h3>Performance</h3>
<div class="demo-grid">
<button class="demo-button green" onclick="slideshowAlert('preload')">Preload Images (Default)</button>
<button class="demo-button red" onclick="slideshowAlert('no_preload')">No Preload (Disabled)</button>
</div>
<h3>Padding Options</h3>
<div class="demo-grid">
<button class="demo-button" onclick="slideshowAlert('no_pad')">No Padding (Default)</button>
<button class="demo-button" onclick="slideshowAlert('with_pad')">With Padding</button>
</div>
<h3>Edge Cases</h3>
<div class="demo-grid">
<button class="demo-button red" onclick="slideshowAlert('broken_images')">Broken Images</button>
<button class="demo-button" onclick="slideshowAlert('mixed_sizes')">Mixed Sizes</button>
<button class="demo-button" onclick="slideshowAlert('captions')">With Captions</button>
</div>
<h3>Callbacks</h3>
<div class="demo-grid">
<button class="demo-button green" onclick="slideshowCallbacksDemo()">All Callbacks (Check Console)</button>
<button class="demo-button yellow" onclick="slideshowCallbacksNoLoopDemo()">Callbacks (No Loop) - Check Console</button>
</div>
<h3>Video Slideshows</h3>
<div class="demo-grid">
<button class="demo-button" onclick="videoSlideshowAlert('single_youtube')">Single YouTube Video</button>
<button class="demo-button" onclick="videoSlideshowAlert('single_html5')">Single HTML5 Video</button>
<button class="demo-button" onclick="videoSlideshowAlert('with_thumbnail')">Video with Thumbnail</button>
<button class="demo-button" onclick="videoSlideshowAlert('no_thumbnail')">Video without Thumbnail</button>
<button class="demo-button" onclick="videoSlideshowAlert('images_before_video')">Images + Video</button>
<button class="demo-button" onclick="videoSlideshowAlert('video_between_images')">Video Between Images</button>
<button class="demo-button" onclick="videoSlideshowAlert('mixed_video_types')">Mixed Video Types</button>
</div>
</div>
<!-- Ajax -->
<h2>13. Ajax</h2>
<div class="demo-section">
<div class="demo-grid">
<button class="demo-button" onclick="ajaxAlert('json')">JSON Content</button>
<button class="demo-button" onclick="ajaxAlert('html')">HTML Content</button>
<button class="demo-button red" onclick="ajaxAlert('error')">Ajax Error</button>
</div>
</div>
<!-- Special Options -->
<h2>14. Special Options</h2>
<div class="demo-section">
<h3>Content Options</h3>
<div class="demo-grid">
<button class="demo-button" onclick="specialAlert('no_pad')">No Padding</button>
<button class="demo-button" onclick="specialAlert('blur_bg')">Blur Background</button>
<button class="demo-button" onclick="specialAlert('custom_class')">Custom Classes</button>
</div>
<h3>Behavior Options</h3>
<div class="demo-grid">
<button class="demo-button" onclick="specialAlert('replace_others')">Replace Others</button>
<button class="demo-button" onclick="specialAlert('autofocus')">Auto Focus</button>
<button class="demo-button" onclick="specialAlert('callbacks')">Event Callbacks</button>
</div>
</div>
<!-- Multiple Alerts -->
<h2>15. Multiple Alerts</h2>
<div class="demo-section">
<div class="demo-grid">
<button class="demo-button" onclick="multipleAlert('stack')">Stack Alerts</button>
<button class="demo-button" onclick="multipleAlert('replace')">Replace Alerts</button>
<button class="demo-button" onclick="multipleAlert('rapid')">Rapid Fire</button>
</div>
</div>
<!-- Error Cases -->
<h2>16. Error Cases & Edge Tests</h2>
<div class="demo-section">
<div class="demo-grid">
<button class="demo-button red" onclick="errorAlert('no_content')">No Content</button>
<button class="demo-button red" onclick="errorAlert('invalid_theme')">Invalid Theme</button>
<button class="demo-button red" onclick="errorAlert('invalid_size')">Invalid Size</button>
<button class="demo-button red" onclick="errorAlert('circular_callbacks')">Circular Callbacks</button>
</div>
</div>
<!-- Event Handler Cleanup Tests -->
<h2>17. Event Handler Cleanup Tests</h2>
<div class="demo-section">
<div class="demo-grid">
<button class="demo-button red" onclick="eventCleanupTest('rapid_open_close')">Rapid Open/Close</button>
<button class="demo-button red" onclick="eventCleanupTest('keyboard_after_close')">Keyboard After Close</button>
<button class="demo-button red" onclick="eventCleanupTest('multiple_slideshows')">Multiple Slideshows</button>
</div>
<p><strong>Test Instructions:</strong> These tests verify that event handlers are properly cleaned up. Watch the console for any error messages about handlers firing after modal closure.</p>
</div>
<div class="note">
<strong>Note:</strong> This demo tests all jAlert features systematically. Check the browser console for detailed logs during iframe auto-sizing and other operations.
</div>
</div>
<script>
// Basic Alerts
function basicAlert() {
$.jAlert({
content: 'This is a basic alert with minimal configuration.'
});
}
function titleAlert() {
$.jAlert({
title: 'Alert Title',
content: 'This alert has a title at the top.'
});
}
function noTitleAlert() {
$.jAlert({
content: 'This alert has no title, just content.'
});
}
function longContentAlert() {
$.jAlert({
title: 'Long Content Test',
content: 'This is a test of long content to see how the alert handles wrapping and sizing. '.repeat(20)
});
}
function htmlContentAlert() {
$.jAlert({
title: 'HTML Content',
content: '<h3>HTML is supported!</h3><p>You can use <strong>bold</strong>, <em>italic</em>, and <a href="#">links</a>.</p><ul><li>Lists work too</li><li>Second item</li></ul>'
});
}
function emptyAlert() {
$.jAlert({
title: 'Empty Alert',
content: ''
});
}
// Sizes
function sizeAlert(size) {
$.jAlert({
title: `Size: ${size}`,
content: `This alert uses size="${size}". The modal should be sized accordingly.`,
size: size
});
}
function customSizeAlert(size) {
$.jAlert({
title: `Custom Size: ${JSON.stringify(size)}`,
content: `This alert uses a custom size configuration.`,
size: size
});
}
// Themes
function themeAlert(theme) {
$.jAlert({
title: `${theme.charAt(0).toUpperCase() + theme.slice(1)} Theme`,
content: `This alert uses the "${theme}" theme.`,
theme: theme
});
}
// Close Button Variations
function closeBtnAlert(type) {
const config = {
title: `Close Button: ${type}`,
content: `Testing ${type} close button style.`
};
switch(type) {
case 'default':
config.closeBtn = true;
break;
case 'round':
config.closeBtn = true;
config.closeBtnRound = true;
break;
case 'round_white':
config.closeBtn = true;
config.closeBtnRoundWhite = true;
break;
case 'alt':
config.closeBtn = true;
config.closeBtnAlt = true;
break;
case 'none':
config.closeBtn = false;
config.closeOnClick = true; // Enable click to close since no button
config.content += ' (Click outside to close)';
break;
}
$.jAlert(config);
}
// Close Options
function closeOptionAlert(type) {
const config = {
title: `Close Option: ${type}`
};
switch(type) {
case 'click':
config.content = 'Click outside this modal to close it.';
config.closeOnClick = true;
config.closeOnEsc = false;
break;
case 'esc':
config.content = 'Press ESC to close this modal.';
config.closeOnClick = false;
config.closeOnEsc = true;
break;
case 'both':
config.content = 'Click outside OR press ESC to close.';
config.closeOnClick = true;
config.closeOnEsc = true;
break;
case 'none':
config.content = 'Only the close button will work.';
config.closeOnClick = false;
config.closeOnEsc = false;
break;
}
$.jAlert(config);
}
function autoCloseAlert(delay) {
$.jAlert({
title: `Auto Close (${delay/1000}s)`,
content: `This alert will automatically close in ${delay/1000} seconds.`,
autoClose: delay
});
}
// Background Colors
function backgroundColorAlert(backgroundColor) {
$.jAlert({
title: `Background Color: ${backgroundColor}`,
content: `This alert uses backgroundColor="${backgroundColor}". Notice how the overlay behind the modal changes color.`,
backgroundColor: backgroundColor,
size: 'md'
});
}
// Animations
function animationAlert(showAnim, hideAnim) {
$.jAlert({
title: `Animation: ${showAnim}/${hideAnim}`,
content: `Show: ${showAnim}, Hide: ${hideAnim}`,
showAnimation: showAnim,
hideAnimation: hideAnim
});
}
// Buttons
function singleBtnAlert() {
$.jAlert({
title: 'Single Button',
content: 'This alert has a single custom button.',
btns: {
text: 'Got it!',
theme: 'blue',
onClick: function() {
alert('Button clicked!');
}
}
});
}
function btnThemeAlert() {
$.jAlert({
title: 'Button Themes',
content: 'Different button theme colors.',
btns: [
{ text: 'Default', theme: 'default' },
{ text: 'Green', theme: 'green' },
{ text: 'Red', theme: 'red' },
{ text: 'Blue', theme: 'blue' }
]
});
}
function btnCallbackAlert() {
$.jAlert({
title: 'Button Callbacks',
content: 'Each button has a different callback.',
btns: [
{ text: 'Alert', onClick: () => alert('Alert button!') },
{ text: 'Console', onClick: () => console.log('Console button!') },
{ text: 'Close', closeAlert: true }
],
closeBtn: false
});
}
function multipleBtnsAlert() {
$.jAlert({
title: 'Multiple Buttons',
content: 'This alert has several buttons.',
btns: [
{ text: 'First', theme: 'green' },
{ text: 'Second', theme: 'blue' },
{ text: 'Third', theme: 'red' },
{ text: 'Fourth', theme: 'default' }
]
});
}
function confirmAlert() {
$.jAlert({
type: 'confirm',
confirmQuestion: 'Are you sure you want to proceed?',
onConfirm: function() {
alert('Confirmed!');
},
onDeny: function() {
alert('Cancelled!');
}
});
}
function customConfirmAlert() {
$.jAlert({
title: 'Custom Confirm',
content: 'Choose your action:',
btns: [
{ text: 'Yes, do it!', theme: 'green', onClick: () => alert('Yes!') },
{ text: 'Maybe later', theme: 'yellow', onClick: () => alert('Maybe!') },
{ text: 'No way', theme: 'red', onClick: () => alert('No!') }
]
});
}
function btnBackgroundAlert() {
$.jAlert({
title: 'Button Background',
content: 'Buttons have a background panel.',
btns: [
{ text: 'Save', theme: 'green' },
{ text: 'Cancel', theme: 'red' }
],
btnBackground: true
});
}
function btnNoBackgroundAlert() {
$.jAlert({
title: 'No Button Background',
content: 'Buttons without a background panel - they appear directly in the content area.',
btns: [
{ text: 'Save', theme: 'green' },
{ text: 'Cancel', theme: 'red' }
],
btnBackground: false
});
}
function btnNoPadAlert() {
$.jAlert({
title: 'No Padding + Buttons',
content: 'Content with no padding and button background.',
btns: [
{ text: 'Action', theme: 'blue' },
{ text: 'Close' }
],
noPadContent: true,
btnBackground: true
});
}
function customClassBtnAlert() {
$.jAlert({
title: 'Custom Button Classes',
content: 'These buttons use custom CSS classes instead of jAlert\'s default styling.',
btns: [
{ text: 'Primary Action', class: 'btn btn-primary' },
{ text: 'Secondary Action', class: 'btn btn-secondary' }
]
});
}
// Images
function imageAlert(type) {
const configs = {
normal: {
image: 'https://picsum.photos/600/400?random=1'
},
auto: {
title: 'Auto Size Image',
image: 'https://picsum.photos/500/300?random=2',
size: 'auto'
},
custom_width: {
title: 'Custom Width Image',
image: 'https://picsum.photos/800/600?random=3',
imageWidth: '400px'
},
broken: {
title: 'Broken Image',
image: 'https://invalid-url.com/broken.jpg'
},
tall: {
title: 'Ultra Tall Image',
image: 'https://picsum.photos/300/1200?random=4'
},
wide: {
title: 'Ultra Wide Image',
image: 'https://picsum.photos/1200/300?random=5'
},
tiny: {
title: 'Tiny Image',
image: 'https://picsum.photos/100/100?random=6'
},
with_pad: {
image: 'https://picsum.photos/600/400?random=7',
noPadContent: false
},
with_title: {
title: 'Image with Title',
image: 'https://picsum.photos/600/400?random=8'
}
};
$.jAlert(configs[type]);
}
// Videos
function videoAlert(type) {
const configs = {
mp4: {
title: 'MP4 Video',
video: {src: 'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4'}
},
webm: {
title: 'WebM Video',
video: {src: 'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.webm'}
},
ogg: {
title: 'OGV Video',
video: {src: 'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.ogv'}
},
no_controls: {
title: 'Video without Controls',
video: {src: 'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4', controls: false}
},
autoplay: {
title: 'Auto Play Video (Muted)',
video: {src: 'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerBlazes.mp4', autoplay: true, muted: true}
},
muted: {
title: 'Muted Video',
video: {src: 'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerEscapes.mp4', muted: true}
},
loop: {
title: 'Looping Video',
video: {src: 'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerFun.mp4', loop: true}
},
html5_loop_autoplay: {
title: 'HTML5 Video with Loop & Autoplay',
video: {src: 'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerFun.mp4', loop: true, autoplay: true, muted: true, controls: true}
},
max_size: {
title: 'Max Size Video (Responsive)',
video: {src: 'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/WhatCarCanYouGetForAGrand.mp4'}
},
responsive: {
title: 'Responsive Video',
video: {src: 'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerMeltdowns.mp4'}
},
portrait: {
title: 'Portrait Video (9:16)',
video: {src: 'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/Sintel.mp4', maxHeight: '960px', maxWidth: '540px'}
},
youtube: {
title: 'YouTube Video (Enhanced URL Processing)',
video: {src: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', autoplay: true, muted: true, modestbranding: true, rel: false}
},
vimeo: {
title: 'Vimeo Video (Enhanced URL Processing)',
video: {src: 'https://vimeo.com/56974716', autoplay: true, muted: true, controls: true}
},
youtube_playlist: {
title: 'YouTube Playlist',
video: {src: 'https://www.youtube.com/embed/videoseries?list=PLrAXtmRdnEQy6nuLMHjMZpZcjuMn93R5', autoplay: true, muted: true}
},
youtube_responsive: {
title: 'YouTube Responsive (Enhanced URL Processing)',
video: {src: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', autoplay: true, muted: true, controls: true, loop: true}
},
broken: {
title: 'Broken Video URL',
video: {src: 'https://invalid-url.com/broken-video.mp4'}
},
with_pad: {
title: 'Video with Padding (Explicit)',
content: '<p>This video explicitly overrides the default no-padding behavior.</p>',
noPadContent: false,
video: {src: 'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/TearsOfSteel.mp4'}
},
no_pad_default: {
title: 'Video with No Padding (Default)',
content: '<p>This video uses the default no-padding behavior for videos.</p>',
video: {src: 'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/TearsOfSteel.mp4'}
},
no_title: {
content: '<p>This video has no title - just the video content in the modal.</p>',
video: {src: 'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/VolkswagenGTISportVision.mp4'}
}
};
$.jAlert(configs[type]);
}
// Iframes
function iframeAlert(type) {
const configs = {
basic: {
iframe: 'https://httpbin.org/html'
},
custom_height: {
title: 'Custom Height Iframe',
iframe: 'https://httpbin.org/html',
iframeHeight: '400px'
},
stretch: {
title: 'Auto Height Iframe',
iframe: 'https://httpbin.org/html'
},
auto_local: {
title: 'Auto-sizing Iframe (Same-Origin)',
content: '<p><strong>Same-origin iframe:</strong> Content dimensions detected, iframe sized to fit content.</p>',
iframe: '<html><body style="margin:20px;font-family:Arial;background:#f9f9f9"><h1 style="color:#333;margin:0 0 20px 0">Fixed Size Test Content</h1><div style="width:300px;height:200px;background:linear-gradient(45deg,#007bff,#0056b3);color:white;display:flex;align-items:center;justify-content:center;margin:20px 0;border-radius:8px;font-weight:bold;font-size:18px">Fixed Box: 300x200px</div><p style="line-height:1.6;margin:20px 0">This content has predictable dimensions for testing iframe auto-sizing. The blue box above is exactly 300x200px.</p><div style="background:#e9ecef;padding:15px;border-radius:4px;margin:20px 0"><strong>Test Info:</strong> This iframe should size to fit this content exactly, not use the full viewport height.</div></body></html>',
size: 'auto'
},
auto_cross: {
title: 'Auto-sizing Iframe (Cross-Origin)',
content: '<p><strong>Cross-origin iframe:</strong> Uses viewport-based sizing since content cannot be accessed.</p>',
iframe: 'https://www.wikipedia.org/',
size: 'auto'
},
auto_blocked: {
title: 'Auto-sizing Iframe (Blocked)',
content: '<p><strong>X-Frame-Options blocked:</strong> This site blocks iframe embedding entirely.</p>',
iframe: 'https://www.google.com',
size: 'auto'
},
full: {
title: 'Full Screen Iframe',
iframe: 'https://httpbin.org/html',
size: 'full'
},
large: {
title: 'Large Iframe',
iframe: 'https://httpbin.org/html',
size: 'xlg'
},
small: {
title: 'Small Iframe',
iframe: 'https://httpbin.org/html',
size: 'sm'
},
no_pad: {
title: 'Iframe with No Padding (Default)',
content: '<p>This iframe uses the default no-padding behavior for iframes.</p>',
iframe: 'https://httpbin.org/html'
},
with_pad: {
title: 'Iframe with Padding (Explicit)',
content: '<p>This iframe explicitly overrides the default no-padding behavior to show padding around the iframe content.</p>',
noPadContent: false,
iframe: 'https://httpbin.org/html'
}
};
$.jAlert(configs[type]);
}
// Slideshows
function slideshowAlert(type) {
const basicImages = [
'https://picsum.photos/600/400?random=10',
'https://picsum.photos/600/400?random=11',
'https://picsum.photos/600/400?random=12'
];
const manyImages = [
'https://picsum.photos/600/400?random=20',
'https://picsum.photos/600/400?random=21',
'https://picsum.photos/600/400?random=22',
'https://picsum.photos/600/400?random=23',
'https://picsum.photos/600/400?random=24',
'https://picsum.photos/600/400?random=25',
'https://picsum.photos/600/400?random=26',
'https://picsum.photos/600/400?random=27'
];
const mixedSizes = [
'https://picsum.photos/800/600?random=30', // Landscape
'https://picsum.photos/400/800?random=31', // Portrait
'https://picsum.photos/1000/400?random=32', // Wide
'https://picsum.photos/300/300?random=33' // Square
];
const brokenImages = [
'https://picsum.photos/600/400?random=40',
'https://invalid-url.com/broken1.jpg',
'https://picsum.photos/600/400?random=41',
'https://invalid-url.com/broken2.jpg'
];
const captionImages = [
{ src: 'https://picsum.photos/600/400?random=50', caption: 'First image with a caption' },
{ src: 'https://picsum.photos/600/400?random=51', caption: 'This is a much longer caption that should definitely wrap to multiple lines even in wide modals, demonstrating how the caption text flows naturally and handles longer descriptions gracefully across different viewport sizes and modal widths' },
{ src: 'https://picsum.photos/600/400?random=52', caption: 'Third image caption' }
];
const configs = {
basic: {
slideshow: basicImages
},
single: {
title: 'Single Image Slideshow',
slideshow: ['https://picsum.photos/600/400?random=100']
},
many: {
title: 'Many Images Slideshow (8)',
slideshow: manyImages
},
arrows_only: {
title: 'Arrows Only',
slideshow: basicImages,
slideshowOptions: {
showArrows: true,
showCounter: false
}
},
dots_only: {
title: 'Dots Only',
slideshow: basicImages,
slideshowOptions: {
showArrows: false,
showCounter: 'dots'
}
},
counter_only: {
title: 'Counter Only',
slideshow: basicImages,
slideshowOptions: {
showArrows: false,
showCounter: 'numbers'
}
},
no_controls: {
title: 'No Controls',