|
| 1 | +<!DOCTYPE html> |
| 2 | +<html> |
| 3 | +<head> |
| 4 | + <meta charset="utf-8"/> |
| 5 | + <title>PNotify</title> |
| 6 | + <meta name="HandheldFriendly" content="true" /> |
| 7 | + <meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
| 8 | + |
| 9 | + <!-- RequireJS --> |
| 10 | + <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/require.js/2.3.5/require.js"></script> |
| 11 | + |
| 12 | + <!-- jQuery --> |
| 13 | + <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> |
| 14 | + |
| 15 | + <!-- Animate.css --> |
| 16 | + <link href="//cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css" rel="stylesheet" type="text/css" /> |
| 17 | + |
| 18 | + <!-- Font Awesome --> |
| 19 | + <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" rel="stylesheet" type="text/css" /> |
| 20 | + |
| 21 | + <!-- PNotify --> |
| 22 | + <script type="text/javascript" src="../lib/iife/PNotify.js"></script> |
| 23 | + <link href="../src/PNotifyBrightTheme.css" rel="stylesheet" type="text/css" /> |
| 24 | + <script type="text/javascript" src="../lib/iife/PNotifyButtons.js"></script> |
| 25 | + <script type="text/javascript" src="../lib/iife/PNotifyAnimate.js"></script> |
| 26 | + <script type="text/javascript" src="../lib/iife/PNotifyCallbacks.js"></script> |
| 27 | + <script type="text/javascript" src="../lib/iife/PNotifyNonBlock.js"></script> |
| 28 | + <script type="text/javascript" src="../lib/iife/PNotifyMobile.js"></script> |
| 29 | + <script type="text/javascript" src="../lib/iife/PNotifyHistory.js"></script> |
| 30 | + <script type="text/javascript" src="../lib/iife/PNotifyDesktop.js"></script> |
| 31 | + <script type="text/javascript" src="../lib/iife/PNotifyConfirm.js"></script> |
| 32 | + <script type="text/javascript" src="../lib/iife/PNotifyStyleMaterial.js"></script> |
| 33 | + <script type="text/javascript" src="../lib/iife/PNotifyReference.js"></script> |
| 34 | + |
| 35 | + <script type="text/javascript" src="../lib/iife/PNotifyCompat.js"></script> |
| 36 | +</head> |
| 37 | +<body> |
| 38 | + <h1>PNotify Backward Compatibility Module (IIFE)</h1> |
| 39 | + |
| 40 | + <p> |
| 41 | + This page loads all modules + the special "PNotifyCompat" module. This module makes most code written for PNotify 3 work with PNotify 4. |
| 42 | + <hr /> |
| 43 | + Some simple demos:<br /> |
| 44 | + <button onclick="new PNotifyCompat({ |
| 45 | + title: 'Regular Notice', |
| 46 | + text: 'Check me out! I\'m a notice.' |
| 47 | + });">Notice</button> |
| 48 | + <button onclick="new PNotifyCompat({ |
| 49 | + title: 'New Thing', |
| 50 | + text: 'Just to let you know, something happened.', |
| 51 | + type: 'info' |
| 52 | + });">Info Message</button> |
| 53 | + <button onclick="new PNotifyCompat({ |
| 54 | + title: 'Success!', |
| 55 | + text: 'That thing that you were trying to do worked.', |
| 56 | + type: 'success' |
| 57 | + });">Success Message</button> |
| 58 | + <button onclick="new PNotifyCompat({ |
| 59 | + title: 'Oh No!', |
| 60 | + text: 'Something terrible happened.', |
| 61 | + type: 'error' |
| 62 | + });">Error Message</button> |
| 63 | + <button onclick="new PNotifyCompat('Check me out! I\'m a notice.');">Simple</button> |
| 64 | + <button onclick="new PNotifyCompat({ |
| 65 | + title: 'No Mouse Reset Notice', |
| 66 | + text: 'I don\'t care if you move your mouse over me, I\'ll disappear when I want.', |
| 67 | + mouse_reset: false |
| 68 | + });">No Mouse Reset</button> |
| 69 | + <button onclick="var notice = new PNotifyCompat({ |
| 70 | + title: 'Click Notice', |
| 71 | + text: 'I wish someone would click me.' |
| 72 | + }); |
| 73 | + notice.get().css('cursor', 'pointer').click(function(e) { |
| 74 | + if ($(e.target).is('.ui-pnotify-closer *, .ui-pnotify-sticker *')) return; |
| 75 | + notice.update({ |
| 76 | + type: 'success', |
| 77 | + text: 'Yay, you clicked me!<div style="text-align: center;"><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/e/ec/Happy_smiley_face.png/240px-Happy_smiley_face.png" /></div>' |
| 78 | + }); |
| 79 | + });">Click on It</button> |
| 80 | + <button onclick="new PNotifyCompat({ |
| 81 | + title: '<span style="color: green;">Rich Content Notice</span>', |
| 82 | + 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>' |
| 83 | + });">Rich Text</button> |
| 84 | + <button onclick="new PNotifyCompat({ |
| 85 | + title: '<em>Escaped Notice</em>', |
| 86 | + title_escape: true, |
| 87 | + text: $('#evil_html').html(), |
| 88 | + text_escape: true |
| 89 | + });">Or Keep it Safe</button> |
| 90 | + <span id="evil_html" style="display: none;"> |
| 91 | + <span>As you can see, I don't allow HTML in my content.</span> |
| 92 | + <span>This prevents things like cross site scripting attacks:</span> |
| 93 | + <script type="text/javascript"> |
| 94 | + (function(){ |
| 95 | + // Here would be the XSS attack. |
| 96 | + })() |
| 97 | + </script> |
| 98 | + </span> |
| 99 | + <hr /> |
| 100 | + Some module demos<br /> |
| 101 | + <button onclick="PNotifyCompat.desktop.permission(); |
| 102 | + (new PNotifyCompat({ |
| 103 | + title: 'Desktop Notice', |
| 104 | + text: 'If you\'ve given me permission, I\'ll appear as a desktop notification. If you haven\'t, I\'ll still appear as a regular PNotify notice.', |
| 105 | + desktop: { |
| 106 | + desktop: true |
| 107 | + } |
| 108 | + })).get().click(function(e) { |
| 109 | + if ($('.ui-pnotify-closer, .ui-pnotify-sticker, .ui-pnotify-closer *, .ui-pnotify-sticker *').is(e.target)) return; |
| 110 | + alert('Hey! You clicked the desktop notification!'); |
| 111 | + });">Desktop - Notice</button> |
| 112 | + <button onclick="new PNotifyCompat({ |
| 113 | + title: 'Regular Notice', |
| 114 | + text: 'Check me out! I\'m a notice. With buttons' |
| 115 | + });">Buttons</button> |
| 116 | + <button onclick="new PNotifyCompat({ |
| 117 | + title: 'Custom Icon Button Notice', |
| 118 | + text: 'Check me out! My sticker and close buttons have custom icons!', |
| 119 | + hide: false, |
| 120 | + buttons: { |
| 121 | + classes: { |
| 122 | + closer: 'fa fa-bomb', |
| 123 | + pin_up: 'fa fa-anchor', |
| 124 | + pin_down: 'fa fa-hourglass' |
| 125 | + } |
| 126 | + } |
| 127 | + });">Buttons - Custom Icons</button> |
| 128 | + <button onclick="new PNotifyCompat({ |
| 129 | + title: 'Non-Blocking Notice', |
| 130 | + text: 'I\'m a special kind of notice called "non-blocking". When you hover over me I\'ll fade to show the elements underneath. Feel free to click any of them just like I wasn\'t even here.\n\nNote: HTML links don\'t trigger in some browsers, due to security settings.', |
| 131 | + nonblock: { |
| 132 | + nonblock: true |
| 133 | + } |
| 134 | + });">NonBlock</button> |
| 135 | + <button onclick="new PNotifyCompat({ |
| 136 | + title: 'No Mobile Support Notice', |
| 137 | + text: 'If you\'re on a mobile device, I won\'t respond to your swipes.', |
| 138 | + mobile: { |
| 139 | + swipe_dismiss: false |
| 140 | + } |
| 141 | + });">Mobile - No Mobile Support</button> |
| 142 | + <button onclick="new PNotifyCompat({ |
| 143 | + title: 'Animate.css Effect', |
| 144 | + text: 'I use effects from Animate.css. Such smooth CSS3 transitions make me feel like butter.', |
| 145 | + animate: { |
| 146 | + animate: true, |
| 147 | + in_class: 'rotateInDownLeft', |
| 148 | + out_class: 'rotateOutUpRight' |
| 149 | + } |
| 150 | + });">Animate</button> |
| 151 | + <button onclick="(new PNotifyCompat({ |
| 152 | + title: 'Confirmation Needed', |
| 153 | + text: 'Are you sure?', |
| 154 | + hide: false, |
| 155 | + confirm: { |
| 156 | + confirm: true |
| 157 | + }, |
| 158 | + buttons: { |
| 159 | + closer: false, |
| 160 | + sticker: false |
| 161 | + }, |
| 162 | + history: { |
| 163 | + history: false |
| 164 | + } |
| 165 | + })).get().on('pnotify.confirm', function() { |
| 166 | + alert('Ok, cool.'); |
| 167 | + }).on('pnotify.cancel', function() { |
| 168 | + alert('Oh ok. Chicken, I see.'); |
| 169 | + });">Confirm - Confirm Dialog</button> |
| 170 | + <button onclick="(new PNotifyCompat({ |
| 171 | + title: 'Input Needed', |
| 172 | + text: 'What side would you like?', |
| 173 | + hide: false, |
| 174 | + confirm: { |
| 175 | + prompt: true |
| 176 | + }, |
| 177 | + buttons: { |
| 178 | + closer: false, |
| 179 | + sticker: false |
| 180 | + }, |
| 181 | + history: { |
| 182 | + history: false |
| 183 | + } |
| 184 | + })).get().on('pnotify.confirm', function(e, notice, val) { |
| 185 | + notice.cancelRemove().update({ |
| 186 | + title: 'You\'ve Chosen a Side', |
| 187 | + text: 'You want ' + $('<div/>').text(val).html() + '.', |
| 188 | + type: 'info', |
| 189 | + hide: true, |
| 190 | + confirm: { |
| 191 | + prompt: false |
| 192 | + }, |
| 193 | + buttons: { |
| 194 | + closer: true, |
| 195 | + sticker: true |
| 196 | + } |
| 197 | + }); |
| 198 | + }).on('pnotify.cancel', function(e, notice) { |
| 199 | + notice.cancelRemove().update({ |
| 200 | + title: 'You Don\'t Want a Side', |
| 201 | + text: 'No soup for you!', |
| 202 | + type: 'info', |
| 203 | + hide: true, |
| 204 | + confirm: { |
| 205 | + prompt: false |
| 206 | + }, |
| 207 | + buttons: { |
| 208 | + closer: true, |
| 209 | + sticker: true |
| 210 | + } |
| 211 | + }); |
| 212 | + });">Confirm - Prompt Dialog</button> |
| 213 | + <button onclick="var dont_alert = function() {}; |
| 214 | + new PNotifyCompat({ |
| 215 | + title: 'I\'m Here', |
| 216 | + text: 'I have a callback for each of my events. I\'ll call all my callbacks while I change states.', |
| 217 | + before_init: function(opts) { |
| 218 | + alert('I\'m called before the notice initializes. I\'m passed the options used to make the notice. I can modify them. Watch me replace the word callback with tire iron!'); |
| 219 | + opts.text = opts.text.replace(/callback/g, 'tire iron'); |
| 220 | + }, |
| 221 | + after_init: function(notice) { |
| 222 | + alert('I\'m called after the notice initializes. I\'m passed the PNotify object for the current notice: ' + notice + '\n\nThere are more callbacks you can assign, but this is the last notice you\'ll see. Check the code to see them all.'); |
| 223 | + }, |
| 224 | + before_open: function(notice) { |
| 225 | + var source_note = 'Return false to cancel opening.'; |
| 226 | + dont_alert('I\'m called before the notice opens. I\'m passed the PNotify object for the current notice: ' + notice); |
| 227 | + }, |
| 228 | + after_open: function(notice) { |
| 229 | + dont_alert('I\'m called after the notice opens. I\'m passed the PNotify object for the current notice: ' + notice); |
| 230 | + }, |
| 231 | + before_close: function(notice, timer_hide) { |
| 232 | + var source_note = 'Return false to cancel close. Use PNotifyCompat.queueRemove() to set the removal timer again.'; |
| 233 | + dont_alert('I\'m called before the notice closes. I\'m passed the PNotify object for the current notice: ' + notice); |
| 234 | + dont_alert('I also have an argument called timer_hide, which is true if the notice was closed because the timer ran down. Value: ' + timer_hide); |
| 235 | + }, |
| 236 | + after_close: function(notice, timer_hide) { |
| 237 | + dont_alert('I\'m called after the notice closes. I\'m passed the PNotify object for the current notice: ' + notice); |
| 238 | + dont_alert('I also have an argument called timer_hide, which is true if the notice was closed because the timer ran down. Value: ' + timer_hide); |
| 239 | + } |
| 240 | + });">Callbacks</button> |
| 241 | + <button onclick="$(this).trigger('pnotify.history-last');">History - Show Last</button> |
| 242 | + <button onclick="new PNotifyCompat({ |
| 243 | + title: 'Reference Module', |
| 244 | + text: 'The reference module is a basic module that demonstrates how to write a PNotify module by implementing many of its features. You can find it in pnotify.reference.js (in v3).', |
| 245 | + type: 'info', |
| 246 | + reference: { |
| 247 | + put_thing: true |
| 248 | + } |
| 249 | + });">Reference</button> |
| 250 | + <hr /> |
| 251 | + </p> |
| 252 | + |
| 253 | + <p id="copyright">© 2011-2018 Hunter Perrin. All Rights Reserved.</p> |
| 254 | +</body> |
| 255 | +</html> |
0 commit comments