forked from sciactive/pnotify
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
2511 lines (2475 loc) · 108 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
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" xmlns:og="http://ogp.me/ns#" xmlns:fb="https://www.facebook.com/2008/fbml">
<head>
<meta charset="utf-8"/>
<title>PNotify</title>
<meta name="HandheldFriendly" content="true" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="JavaScript notification plugin." />
<meta property="og:title" content="PNotify" />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://sciactive.com/pnotify/" />
<meta property="og:image" content="https://sciactive.com/pnotify/includes/github-icon.png" />
<meta property="og:site_name" content="PNotify" />
<meta property="fb:admins" content="508999194" />
<meta property="og:description" content="JavaScript notification plugin." />
<!-- Dev Notice -->
<link href="devnote.css" rel="stylesheet" type="text/css" />
<!-- Page Style -->
<link href="includes/style.css" rel="stylesheet" type="text/css" />
<!-- Animate.css -->
<link href="//cdnjs.cloudflare.com/ajax/libs/animate.css/3.4.0/animate.min.css" rel="stylesheet" type="text/css" />
<!-- jQuery -->
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<!-- Bootstrap -->
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" id="bootstrap-css" rel="stylesheet" type="text/css" />
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<!-- JavaScript Source Formatting -->
<link href="includes/google-code-prettify/prettify.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="includes/google-code-prettify/prettify.js"></script>
<script type="text/javascript" src="includes/beautify.js"></script>
<!-- PNotify -->
<script type="text/javascript" src="src/pnotify.js"></script>
<link href="src/pnotify.css" rel="stylesheet" type="text/css" />
<link href="src/pnotify.brighttheme.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="src/pnotify.animate.js"></script>
<script type="text/javascript" src="src/pnotify.buttons.js"></script>
<link href="src/pnotify.buttons.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="src/pnotify.confirm.js"></script>
<link href="src/pnotify.nonblock.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="src/pnotify.nonblock.js"></script>
<script type="text/javascript" src="src/pnotify.mobile.js"></script>
<link href="src/pnotify.mobile.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="src/pnotify.desktop.js"></script>
<script type="text/javascript" src="src/pnotify.history.js"></script>
<link href="src/pnotify.history.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="src/pnotify.callbacks.js"></script>
<script type="text/javascript" src="src/pnotify.reference.js"></script>
<!-- PForm (For the form notice.) -->
<link href="//sciactive.com/pform/css/pform.css" media="all" rel="stylesheet" type="text/css" />
<link href="//sciactive.com/pform/css/pform-bootstrap.css" media="all" rel="stylesheet" type="text/css" />
<!--[if lt IE 8]>
<link href="//sciactive.com/pform/css/pform-ie-lt-8.css" media="all" rel="stylesheet" type="text/css" />
<![endif]-->
<style type="text/css">
.pform_custom div.pf-element .pf-label, .pform_custom div.pf-element .pf-note {
width: 130px; /* Width of labels. */
font-weight: normal;
}
.pform_custom div.pf-element .pf-group {
margin-left: 130px; /* Same as width of labels. */
}
.pform_custom div.pf-buttons {
padding-left: 115px; /* Width of labels + margin to inputs - button spacing. */
}
</style>
<!--[if lt IE 7]>
<style type="text/css">
.pform_custom div.pf-buttons {
width: 225px; /* Custom form width - custom button div left padding - 20px (for IE's default padding.) */
}
</style>
<![endif]-->
<!-- Custom Styling -->
<style type="text/css">
/* Not PNotify specific, just make this page a little more presentable. */
#switcher-container {
position: fixed;
top: 60px;
right: 5px;
z-index: 100;
}
@media (max-width: 980px) {
#switcher-container {
position: absolute;
top: 55px;
}
}
.ui-widget {
font-size: 75% !important;
}
.btn-toolbar {
line-height: 28px;
}
.btn-toolbar h4 {
margin: 1em 0 .3em;
}
.btn-toolbar .btn-group {
vertical-align: middle;
}
.panel .btn {
margin-top: 5px;
}
/* Translucent notice CSS */
.ui-pnotify.translucent.ui-pnotify-fade-in {
opacity: 0.8;
}
/* Custom styled notice CSS */
.ui-pnotify.custom .ui-pnotify-container {
background-color: #404040 !important;
background-image: none !important;
border: none !important;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
border-radius: 10px;
}
.ui-pnotify.custom .ui-pnotify-title, .ui-pnotify.custom .ui-pnotify-text {
font-family: Arial, Helvetica, sans-serif !important;
text-shadow: 2px 2px 3px black !important;
font-size: 10pt !important;
color: #FFF !important;
padding-left: 50px !important;
line-height: 1 !important;
text-rendering: geometricPrecision !important;
}
.ui-pnotify.custom .ui-pnotify-title {
font-weight: bold;
}
.ui-pnotify.custom .ui-pnotify-icon {
float: left;
}
.ui-pnotify.custom .fa {
margin: 3px;
width: 33px;
height: 33px;
font-size: 33px;
color: #FF0;
}
/* Alternate stack initial positioning. This one is done through code,
to show how it is done. Look down at the stack_bottomright variable
in the JavaScript below. */
.ui-pnotify.stack-bottomright {
/* These are just CSS default values to reset the PNotify CSS. */
right: auto;
top: auto;
left: auto;
bottom: auto;
}
.ui-pnotify.stack-custom {
/* Custom values have to be in pixels, because the code parses them. */
top: 200px;
left: 200px;
right: auto;
}
.ui-pnotify.stack-custom2 {
top: auto;
left: auto;
bottom: 200px;
right: 200px;
}
/* This one is totally different. It stacks at the top and looks
like a Microsoft-esque browser notice bar. */
.ui-pnotify.stack-bar-top {
right: 0;
top: 0;
}
.ui-pnotify.stack-bar-bottom {
margin-left: 15%;
right: auto;
bottom: 0;
top: auto;
left: auto;
}
</style>
<!-- Demo Code -->
<script type="text/javascript">
var permanotice, tooltip, _alert;
$(function(){
// ---
// Notice that opens when the page opens.
// ---
new PNotify({
title: "PNotify",
text: "Welcome. Try hovering over me. You can click things behind me, because I'm non-blocking.",
delay: 12000,
nonblock: {
nonblock: true
},
before_close: function(notice){
// You can access the notice's options with this. It is read only.
//notice.options.text;
// You can change the notice's options after the timer like this:
//notice.update({
// title: notice.options.title+" - Enjoy your Stay",
// before_close: null
//});
//notice.queueRemove();
//return false;
}
});
// ---
// This notice is the tooltip demo.
// ---
var make_tooltip = function(){
tooltip = new PNotify({
title: "Tooltip",
text: "I'm not in a stack. I'm positioned like a tooltip with JavaScript.",
hide: false,
buttons: {
closer: false,
sticker: false
},
history: {
history: false
},
animate_speed: "fast",
icon: "fa fa-commenting",
// Setting stack to false causes PNotify to ignore this notice when positioning.
stack: false,
auto_display: false
});
// Remove the notice if the user mouses over it.
tooltip.get().mouseout(function(){
tooltip.remove();
});
};
// I put it in a function so I could show the source easily.
make_tooltip();
// ---
// This creates all those source code view buttons.
// ---
$("body").on("mouseenter click", ".source", function(){
var button = $(this);
button.addClass("dropdown-toggle").attr("data-toggle", "dropdown");
// Wrap the button in a container.
var contain = $('<div class="btn-group" />');
contain = button.wrap(contain).parent();
// Add a source button.
$('<ul class="dropdown-menu"><li><a href="javascript:void(0)">See the source</a></li></ul>').on("click", "a", function(){
$(this).blur();
var text = button.attr("onclick");
if (!text && button.attr("onmouseover"))
text = "// Mouse Over:\n"+button.attr("onmouseover")+"\n\n// Mouse Move:\n"+button.attr("onmousemove")+"\n\n// Mouse Out:\n"+button.attr("onmouseout");
// IE needs this.
if (text.toString) {
text = text.toString();
if (text.match(/^function (onclick|anonymous)[\n ]*\([^\)]*\)[\n ]*\{[\n\t ]*/))
text = text.replace(/^function (onclick|anonymous)[\n ]*\([^\)]*\)[\n ]*\{[\n\t ]*/, "").replace(/[\n\t ]*}[\n\t ]*$/, "");
}
// Is there a better way to do this?
var dialog = $('<div class="modal fade"><div class="modal-dialog modal-lg"><div class="modal-content"><div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button><h4 class="modal-title">'+button.text()+' - Source</h4></div><div class="modal-body"></div><div class="modal-footer"><button type="button" class="btn btn-default" data-dismiss="modal">Ok, got it.</button></div></div></div></div>');
$("<pre class=\"prettyprint\" />").text(js_beautify(text)).appendTo(dialog.find(".modal-body"));
// Check if the code is just calling a function. Include that function.
if (text.match(/^\w*\([^\)]*\);$/)) {
var f_name = text.replace(/\(.*/g, "");
text = window[f_name].toString();
$("<pre class=\"prettyprint\" />").text(js_beautify(text)).appendTo(dialog.find(".modal-body"));
}
// Check if this is the tooltip button. Include the tooltip function.
if (text.match(/tooltip\.open\(\);/)) {
$("<pre class=\"prettyprint\" />").text(js_beautify(make_tooltip.toString())).appendTo(dialog.find(".modal-body"));
}
dialog.on("shown.bs.modal", function(){
prettyPrint();
}).on("hidden.bs.modal", function(){
dialog.remove();
}).modal();
}).appendTo(contain);
button.removeClass("source");
});
prettyPrint(); // Format source in help.
// Navbar scrollspy.
$('#navbar').scrollspy();
});
function show_rich() {
new PNotify({
title: '<span style="color: green;">Rich Content Notice</span>',
text: '<span style="color: blue;">Look at my beautiful <strong>strong</strong>, <em>emphasized</em>, and <span style="font-size: 1.5em;">large</span> text.</span>'
});
}
function consume_alert() {
if (_alert) return;
_alert = window.alert;
window.alert = function(message) {
new PNotify({
title: 'Alert',
text: message
});
};
}
function release_alert() {
if (!_alert) return;
window.alert = _alert;
_alert = null;
}
function fake_load() {
var cur_value = 1,
progress;
// Make a loader.
var loader = new PNotify({
title: "Creating series of tubes",
text: '<div class="progress progress-striped active" style="margin:0">\
<div class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0">\
<span class="sr-only">0%</span>\
</div>\
</div>',
//icon: 'fa fa-moon-o fa-spin',
icon: 'fa fa-cog fa-spin',
hide: false,
buttons: {
closer: false,
sticker: false
},
history: {
history: false
},
before_open: function(notice){
progress = notice.get().find("div.progress-bar");
progress.width(cur_value+"%").attr("aria-valuenow", cur_value).find("span").html(cur_value+"%");
// Pretend to do something.
var timer = setInterval(function(){
if (cur_value == 70) {
loader.update({title: "Aligning discrete worms", icon: "fa fa-circle-o-notch fa-spin"});
}
if (cur_value == 80) {
loader.update({title: "Connecting end points", icon: "fa fa-refresh fa-spin"});
}
if (cur_value == 90) {
loader.update({title: "Dividing and conquering", icon: "fa fa-spinner fa-spin"});
}
if (cur_value >= 100) {
// Remove the interval.
window.clearInterval(timer);
loader.remove();
return;
}
cur_value += 1;
progress.width(cur_value+"%").attr("aria-valuenow", cur_value).find("span").html(cur_value+"%");
}, 65);
}
});
}
function dyn_notice() {
var percent = 0;
var notice = new PNotify({
text: "Please Wait",
type: 'info',
icon: 'fa fa-spinner fa-spin',
hide: false,
buttons: {
closer: false,
sticker: false
},
shadow: false,
width: "170px"
});
setTimeout(function(){
notice.update({title: false});
var interval = setInterval(function(){
percent += 2;
var options = {
text: percent+"% complete."
};
if (percent == 80)
options.title = "Almost There";
if (percent >= 100) {
window.clearInterval(interval);
options.title = "Done!";
options.type = "success";
options.hide = true;
options.buttons = {
closer: true,
sticker: true
};
options.icon = 'fa fa-check';
options.shadow = true;
options.width = PNotify.prototype.options.width;
}
notice.update(options);
}, 120);
}, 2000);
}
/*********** Custom Stacks ***********
* A stack is an object which PNotify uses to determine where
* to position notices. A stack has two mandatory variables, dir1
* and dir2. dir1 is the first direction in which the notices are
* stacked. When the notices run out of room in the window, they
* will move over in the direction specified by dir2. The directions
* can be "up", "down", "right", or "left". Stacks are independent
* of each other, so a stack doesn't know and doesn't care if it
* overlaps (and blocks) another stack. The default stack, which can
* be changed like any other default, goes down, then left. Stack
* objects are used and manipulated by PNotify, and therefore,
* should be a variable when passed. So, calling something like
*
* new PNotify({stack: {"dir1": "down", "dir2": "left"}});
*
* will **NOT** work. It will create a notice, but that notice will
* be in its own stack and may overlap other notices.
*/
var stack_topleft = {"dir1": "down", "dir2": "right", "push": "top"};
var stack_bottomleft = {"dir1": "right", "dir2": "up", "push": "top"};
var stack_custom = {"dir1": "right", "dir2": "down"};
var stack_custom2 = {"dir1": "left", "dir2": "up", "push": "top"};
var stack_modal = {"dir1": "down", "dir2": "right", "push": "top", "modal": true, "overlay_close": true};
var stack_bar_top = {"dir1": "down", "dir2": "right", "push": "top", "spacing1": 0, "spacing2": 0};
var stack_bar_bottom = {"dir1": "up", "dir2": "right", "spacing1": 0, "spacing2": 0};
/*********** Positioned Stack ***********
* This stack is initially positioned through code instead of CSS.
* This is done through two extra variables. firstpos1 and firstpos2
* are pixel values, relative to a viewport edge. dir1 and dir2,
* respectively, determine which edge. It is calculated as follows:
*
* - dir = "up" - firstpos is relative to the bottom of viewport.
* - dir = "down" - firstpos is relative to the top of viewport.
* - dir = "right" - firstpos is relative to the left of viewport.
* - dir = "left" - firstpos is relative to the right of viewport.
*/
var stack_bottomright = {"dir1": "up", "dir2": "left", "firstpos1": 25, "firstpos2": 25};
function show_stack_topleft(type) {
var opts = {
title: "Over Here",
text: "Check me out. I'm in a different stack.",
addclass: "stack-topleft",
stack: stack_topleft
};
switch (type) {
case 'error':
opts.title = "Oh No";
opts.text = "Watch out for that water tower!";
opts.type = "error";
break;
case 'info':
opts.title = "Breaking News";
opts.text = "Have you met Ted?";
opts.type = "info";
break;
case 'success':
opts.title = "Good News Everyone";
opts.text = "I've invented a device that bites shiny metal asses.";
opts.type = "success";
break;
}
new PNotify(opts);
};
function show_stack_bottomleft(type) {
var opts = {
title: "Over Here",
text: "Check me out. I'm in a different stack.",
addclass: "stack-bottomleft",
stack: stack_bottomleft
};
switch (type) {
case 'error':
opts.title = "Oh No";
opts.text = "Watch out for that water tower!";
opts.type = "error";
break;
case 'info':
opts.title = "Breaking News";
opts.text = "Have you met Ted?";
opts.type = "info";
break;
case 'success':
opts.title = "Good News Everyone";
opts.text = "I've invented a device that bites shiny metal asses.";
opts.type = "success";
break;
}
new PNotify(opts);
};
function show_stack_bottomright(type) {
var opts = {
title: "Over Here",
text: "Check me out. I'm in a different stack.",
addclass: "stack-bottomright",
stack: stack_bottomright
};
switch (type) {
case 'error':
opts.title = "Oh No";
opts.text = "Watch out for that water tower!";
opts.type = "error";
break;
case 'info':
opts.title = "Breaking News";
opts.text = "Have you met Ted?";
opts.type = "info";
break;
case 'success':
opts.title = "Good News Everyone";
opts.text = "I've invented a device that bites shiny metal asses.";
opts.type = "success";
break;
}
new PNotify(opts);
};
function show_stack_custom(type) {
var opts = {
title: "Over Here",
text: "Check me out. I'm in a different stack.",
addclass: "stack-custom",
stack: stack_custom
};
switch (type) {
case 'error':
opts.title = "Oh No";
opts.text = "Watch out for that water tower!";
opts.type = "error";
break;
case 'info':
opts.title = "Breaking News";
opts.text = "Have you met Ted?";
opts.type = "info";
break;
case 'success':
opts.title = "Good News Everyone";
opts.text = "I've invented a device that bites shiny metal asses.";
opts.type = "success";
break;
}
new PNotify(opts);
};
function show_stack_custom2(type) {
var opts = {
title: "Over Here",
text: "Check me out. I'm in a different stack.",
addclass: "stack-custom2",
stack: stack_custom2
};
switch (type) {
case 'error':
opts.title = "Oh No";
opts.text = "Watch out for that water tower!";
opts.type = "error";
break;
case 'info':
opts.title = "Breaking News";
opts.text = "Have you met Ted?";
opts.type = "info";
break;
case 'success':
opts.title = "Good News Everyone";
opts.text = "I've invented a device that bites shiny metal asses.";
opts.type = "success";
break;
}
new PNotify(opts);
};
function show_stack_modal(type) {
var opts = {
title: "Over Here",
text: "Check me out. I'm in a different stack.",
addclass: "stack-modal",
stack: stack_modal
};
switch (type) {
case 'error':
opts.title = "Oh No";
opts.text = "Watch out for that water tower!";
opts.type = "error";
break;
case 'info':
opts.title = "Breaking News";
opts.text = "Have you met Ted?";
opts.type = "info";
break;
case 'success':
opts.title = "Good News Everyone";
opts.text = "I've invented a device that bites shiny metal asses.";
opts.type = "success";
break;
}
new PNotify(opts);
};
function show_stack_bar_top(type) {
var opts = {
title: "Over Here",
text: "Check me out. I'm in a different stack.",
addclass: "stack-bar-top",
cornerclass: "",
width: "100%",
stack: stack_bar_top
};
switch (type) {
case 'error':
opts.title = "Oh No";
opts.text = "Watch out for that water tower!";
opts.type = "error";
break;
case 'info':
opts.title = "Breaking News";
opts.text = "Have you met Ted?";
opts.type = "info";
break;
case 'success':
opts.title = "Good News Everyone";
opts.text = "I've invented a device that bites shiny metal asses.";
opts.type = "success";
break;
}
new PNotify(opts);
};
function show_stack_bar_bottom(type) {
var opts = {
title: "Over Here",
text: "Check me out. I'm in a different stack.",
addclass: "stack-bar-bottom",
cornerclass: "",
width: "70%",
stack: stack_bar_bottom
};
switch (type) {
case 'error':
opts.title = "Oh No";
opts.text = "Watch out for that water tower!";
opts.type = "error";
break;
case 'info':
opts.title = "Breaking News";
opts.text = "Have you met Ted?";
opts.type = "info";
break;
case 'success':
opts.title = "Good News Everyone";
opts.text = "I've invented a device that bites shiny metal asses.";
opts.type = "success";
break;
}
new PNotify(opts);
};
function show_stack_context(type, modal) {
if (typeof stack_context === "undefined") {
stack_context = {"dir1": "down", "dir2": "left", "context": $("#stack-context")};
}
if (typeof stack_context_modal === "undefined") {
stack_context_modal = {"dir1": "down", "dir2": "left", "context": $("#stack-context"), "modal": true, "overlay_close": true};
}
var opts = {
title: "Over Here",
text: "Check me out. I'm in a different stack.",
stack: modal ? stack_context_modal : stack_context,
addclass: modal ? "stack-modal" : ""
};
switch (type) {
case 'error':
opts.title = "Oh No";
opts.text = "Watch out for that water tower!";
opts.type = "error";
break;
case 'info':
opts.title = "Breaking News";
opts.text = "Have you met Ted?";
opts.type = "info";
break;
case 'success':
opts.title = "Good News Everyone";
opts.text = "I've invented a device that bites shiny metal asses.";
opts.type = "success";
break;
}
new PNotify(opts);
};
function show_stack_info() {
new PNotify({
title: "PNotify Stacks",
text: "Stacks are used to position notices and determine where new notices will go when they're created. Each notice that's placed into a stack will be positioned related to the other notices in that stack. There is no limit to the number of stacks, and no limit to the number of notices in each stack.",
type: "info",
icon: "fa fa-bars",
hide: false,
history: {
history: false
},
addclass: "stack-modal",
stack: {"dir1": "down", "dir2": "right", "modal": true, "overlay_close": true}
});
};
</script>
</head>
<body id="page" data-spy="scroll" data-target=".navbar">
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="https://sciactive.com/pnotify/">PNotify</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="navbar-collapse-1">
<ul class="nav navbar-nav">
<li class="active"><a href="#page">Overview</a></li>
<li><a href="#demos-simple">Simple Demos</a></li>
<li><a href="#demos-modules">Module Demos</a></li>
<li><a href="#stacks">Stacks</a></li>
<li><a href="#customization">Customization</a></li>
<li><a href="#comments">Comments</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Beyond PNotify <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="https://github.com/sciactive/" target="_blank">SciActive</a></li>
<li><a href="http://nymph.io/" target="_blank">Nymph</a></li>
<li class="divider"></li>
<li><a href="https://sciactive.com/pform/" target="_blank">PForm</a></li>
<li><a href="http://hookphp.org/" target="_blank">HookPHP</a></li>
<li><a href="http://requirephp.org/" target="_blank">RequirePHP</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<div id="switcher-container">
<div id="switcher-bootstrap" style="display: none;">
<div class="btn-group">
<a class="btn btn-default dropdown-toggle" data-toggle="dropdown" href="javascript:void(0);">
Theme: <span id="bootstrap-current">Normal</span>
<span class="caret"></span>
</a>
<ul class="dropdown-menu pull-right">
<li><a href="javascript:void(0);" data-theme="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">Normal</a></li>
<li class="divider"></li>
<li><a href="javascript:void(0);" data-theme="//maxcdn.bootstrapcdn.com/bootswatch/3.3.5/cerulean/bootstrap.min.css">Cerulean</a></li>
<li><a href="javascript:void(0);" data-theme="//maxcdn.bootstrapcdn.com/bootswatch/3.3.5/cosmo/bootstrap.min.css">Cosmo</a></li>
<li><a href="javascript:void(0);" data-theme="//maxcdn.bootstrapcdn.com/bootswatch/3.3.5/cyborg/bootstrap.min.css">Cyborg</a></li>
<li><a href="javascript:void(0);" data-theme="//maxcdn.bootstrapcdn.com/bootswatch/3.3.5/darkly/bootstrap.min.css">Darkly</a></li>
<li><a href="javascript:void(0);" data-theme="//maxcdn.bootstrapcdn.com/bootswatch/3.3.5/flatly/bootstrap.min.css">Flatly</a></li>
<li><a href="javascript:void(0);" data-theme="//maxcdn.bootstrapcdn.com/bootswatch/3.3.5/journal/bootstrap.min.css">Journal</a></li>
<li><a href="javascript:void(0);" data-theme="//maxcdn.bootstrapcdn.com/bootswatch/3.3.5/lumen/bootstrap.min.css">Lumen</a></li>
<li><a href="javascript:void(0);" data-theme="//maxcdn.bootstrapcdn.com/bootswatch/3.3.5/paper/bootstrap.min.css">Paper</a></li>
<li><a href="javascript:void(0);" data-theme="//maxcdn.bootstrapcdn.com/bootswatch/3.3.5/readable/bootstrap.min.css">Readable</a></li>
<li><a href="javascript:void(0);" data-theme="//maxcdn.bootstrapcdn.com/bootswatch/3.3.5/sandstone/bootstrap.min.css">Sandstone</a></li>
<li><a href="javascript:void(0);" data-theme="//maxcdn.bootstrapcdn.com/bootswatch/3.3.5/simplex/bootstrap.min.css">Simplex</a></li>
<li><a href="javascript:void(0);" data-theme="//maxcdn.bootstrapcdn.com/bootswatch/3.3.5/slate/bootstrap.min.css">Slate</a></li>
<li><a href="javascript:void(0);" data-theme="//maxcdn.bootstrapcdn.com/bootswatch/3.3.5/spacelab/bootstrap.min.css">Spacelab</a></li>
<li><a href="javascript:void(0);" data-theme="//maxcdn.bootstrapcdn.com/bootswatch/3.3.5/superhero/bootstrap.min.css">Superhero</a></li>
<li><a href="javascript:void(0);" data-theme="//maxcdn.bootstrapcdn.com/bootswatch/3.3.5/united/bootstrap.min.css">United</a></li>
<li><a href="javascript:void(0);" data-theme="//maxcdn.bootstrapcdn.com/bootswatch/3.3.5/yeti/bootstrap.min.css">Yeti</a></li>
<li class="divider"></li>
<li><a href="http://bootswatch.com/" target="_blank">Themes by Bootswatch</a></li>
</ul>
<script type="text/javascript">
$(function(){
var reset = function(){
setTimeout(function(){
var y = $(".navbar").height() + 10;
$("#switcher-container").css('top', y+'px');
}, 500);
};
reset();
$('#switcher-bootstrap').on('click', 'a[data-theme]', function(){
var $this = $(this);
$('#bootstrap-current').text($this.text()); $('#bootstrap-css').attr('href', $this.attr('data-theme'));
reset();
});
});
</script>
</div>
</div>
</div>
<section class="container page-banner">
<div class="intro-section">
<h1>PNotify</h1>
<p id="description">Beautiful JavaScript notifications.</p>
</div>
<div class="intro-section">
<a class="btn btn-primary btn-large" data-toggle="modal" href="#download">Download PNotify 3</a>
<a class="right-button btn btn-default btn-large" href="https://github.com/sciactive/pnotify" target="_blank" title="Fork me on GitHub">PNotify on GitHub <img src="includes/github-icon.png" alt="GitHub Icon" /></a>
</div>
<div class="intro-section">
<a style="margin: 0 8px;" data-toggle="modal" href="#using">Using PNotify</a>
<a style="margin: 0 8px;" href="https://github.com/sciactive/pnotify/issues/new" target="_blank">Bug Report/Feature Request</a>
</div>
</section>
<div class="modal fade" id="download" tabindex="-1" role="dialog" aria-labelledby="download-title" aria-hidden="true" style="max-height: inherit;">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="download-title">Download a PNotify Bundle</h4>
</div>
<div class="modal-body">
<p>
You can download a PNotify bundle, but it is not the recommended way of getting PNotify. It will break the source maps. You should use NPM to get PNotify in your project. In PNotify 4, this bundler is going away.
</p>
<div class="page-header">
<h3 style="margin-top: 0;">Optional Styling</h3>
</div>
<div><label><input type="checkbox" data-type="module" name="brighttheme" checked /> Bright Theme</label></div>
<div style="margin-bottom: 10px;"><small>Stand-alone theme. You can uncheck this if you're using Bootstrap or your own styling.</small></div>
<div class="page-header">
<h3 style="margin-top: 0;">Modules</h3>
</div>
<div><label><input type="checkbox" data-type="module" name="desktop" checked /> Desktop</label></div>
<div style="margin-bottom: 10px;"><small>Notifications that display even when the web page is not visible.</small></div>
<div><label><input type="checkbox" data-type="module" name="buttons" checked /> Buttons</label></div>
<div style="margin-bottom: 10px;"><small>Sticker and a closer buttons.</small></div>
<div><label><input type="checkbox" data-type="module" name="nonblock" /> NonBlock</label></div>
<div style="margin-bottom: 10px;"><small>Click through to things underneath the notice.</small></div>
<div><label><input type="checkbox" data-type="module" name="mobile" checked /> Mobile</label></div>
<div style="margin-bottom: 10px;"><small>Notices on mobile phones and tablets.</small></div>
<div><label><input type="checkbox" data-type="module" name="animate" /> Animate</label></div>
<div style="margin-bottom: 10px;"><small>Fluid CSS animations using Animate.css. (Requires <a href="https://daneden.github.io/animate.css/" target="_blank">Animate.css</a>.)</small></div>
<div><label><input type="checkbox" data-type="module" name="confirm" /> Confirm</label></div>
<div style="margin-bottom: 10px;"><small>Confirmation dialogs and prompts.</small></div>
<div><label><input type="checkbox" data-type="module" name="callbacks" /> Callbacks</label></div>
<div style="margin-bottom: 10px;"><small>Manipulate the notice during its lifecycle.</small></div>
<div><label><input type="checkbox" data-type="module" name="history" /> History</label></div>
<div style="margin-bottom: 10px;"><small>Redisplay old notices.</small></div>
<div class="page-header">
<h3>Minification</h3>
</div>
<div><label><input type="checkbox" data-type="minify" name="minify" checked /> Minify the Script and Stylesheet</label></div>
<div><small>It is a good idea to enable this on production services, so you get faster transfer times.</small></div>
</div>
<div class="modal-footer">
<a class="btn btn-primary" data-href="https://sciactive.com/pnotify/buildcustom.php?mode=js{min}&modules={modules}&cff=.js" href="#">Get the JavaScript!</a>
<a class="btn btn-primary" data-href="https://sciactive.com/pnotify/buildcustom.php?mode=css{min}&modules={modules}&cff=.css" href="#">Get the CSS!</a>
</div>
<script type="text/javascript">
$(function(){
var changeFunction = function(){
var modules = [];
form.find("[data-type=module]:checked").each(function(){
modules.push($(this).attr("name"));
});
modules = modules.join("-");
var minify = !!form.find("[data-type=minify]:checked").length;
form.find("a[data-href]").each(function(){
$(this).attr("href", $(this).attr("data-href").replace("{min}", minify ? "&min=true" : "").replace("{modules}", modules));
});
};
var form = $("#download").on("click change", "input", changeFunction);
changeFunction();
});
</script>
</div>
</div>
</div>
<div class="modal fade" id="using" tabindex="-1" role="dialog" aria-labelledby="using-title" aria-hidden="true" style="max-height: inherit;">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="using-title">Using PNotify</h4>
</div>
<div class="modal-body">
<p>
PNotify downloads come with the following files:<br />
<br />
<code>pnotify.custom.js</code> or <code>pnotify.custom.min.js</code> (Minified)
<br />
<code>pnotify.custom.css</code> or <code>pnotify.custom.min.css</code> (Minified)
</p>
<p>
So here's how you'd include them on your page:
</p>
<pre class="prettyprint"><script type="text/javascript" src="pnotify.custom<em>.min</em>.js"></script>
<link href="pnotify.custom<em>.min</em>.css" media="all" rel="stylesheet" type="text/css" /></pre>
<p>
You also need to include jQuery (1.6 or higher).
</p>
<p>
Now you can use PNotify like this:
</p>
<pre class="prettyprint"><script type="text/javascript">
$(function(){
new PNotify({
title: 'Regular Notice',
text: 'Check me out! I\'m a notice.'
});
});
</script></pre>
<p>
If you are not using any UI library, you can use the
included styling, called Bright Theme. It is the default.
</p>
<p>
If you are using Bootstrap version 3, include this line
somewhere before your first notice:
</p>
<pre class="prettyprint">PNotify.prototype.options.styling = "bootstrap3";</pre>
<p>
If you are using Bootstrap 3 with Font Awesome, include
this line somewhere before your first notice:
</p>
<pre class="prettyprint">PNotify.prototype.options.styling = "fontawesome";</pre>
<p>
All of the demos on this page provide source code with
the "See the source" dropdown,
<img style="margin-left: 3em;" src="includes/source-screen.png" alt="Source button screen shot." />
</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Ok, got it.</button>
</div>
</div>
</div>
</div>
<section class="container page-points">
<div class="container">
<div class="row">
<div class="col-sm-8">
<div class="alert-block">
<h3><i class="glyphicon glyphicon-book" style="position: relative; top: 3px;"></i> About</h3>
<p>
PNotify is a JavaScript notification system, developed
by <a href="https://github.com/sciactive/">SciActive</a>.
<br />
<br />
PNotify provides desktop notifications based on the
<a href="http://www.w3.org/TR/notifications/" target="_blank">Web Notifications spec</a>.
If desktop notifications are not available or not allowed,
PNotify will fall back to displaying the notice as a
regular, in-browser notice.
</p>
</div>
</div>
<div class="col-sm-4">
<div class="alert-block">
<h3><i class="glyphicon glyphicon-phone" style="position: relative; top: 3px;"></i> Mobile Ready</h3>
<p>
PNotify works on your phone and tablet. You can swipe
notices away to dismiss them.
</p>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-4">
<div class="alert-block">
<h3><i class="glyphicon glyphicon-asterisk" style="position: relative; top: 3px;"></i> Unobtrusive</h3>
<p>
PNotify can provide <strong>non-blocking</strong> notices
that allow the user to click elements behind the notice without
even having to dismiss it.
</p>
<p>
<a class="btn btn-default" data-toggle="modal" href="#feature-modal" >See All Features</a>
</p>
</div>
</div>
<div class="col-sm-4">
<div class="alert-block">
<h3><i class="glyphicon glyphicon-picture" style="position: relative; top: 3px;"></i> Themeable</h3>
<p>
PNotify can use Bootstrap themes. Try out some of the
readymade themes using the selector in the top right corner
of this page.
</p>
</div>
</div>
<div class="col-sm-4">
<div class="alert-block">
<h3><i class="glyphicon glyphicon-gift" style="position: relative; top: 3px;"></i> Completely Open</h3>
<p>
PNotify is distributed under the
<a href="http://www.apache.org/licenses/LICENSE-2.0" target="_blank">Apache License, Version 2.0</a>.
</p>
</div>
</div>
</div>