|
1 | 1 | <!DOCTYPE html> |
2 | 2 | <html> |
3 | 3 | <head> |
4 | | - <title>PNotify Test</title> |
| 4 | + <meta charset="utf-8"/> |
| 5 | + <title>PNotify Styling Demos</title> |
| 6 | + <meta name="HandheldFriendly" content="true" /> |
| 7 | + <meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
5 | 8 | <script type="text/javascript" src="lib/iife/PNotify.js"></script> |
6 | 9 | <script type="text/javascript" src="lib/iife/PNotifyStyleMaterial.js"></script> |
7 | 10 | <script type="text/javascript" src="lib/iife/PNotifyButtons.js"></script> |
| 11 | + <script type="text/javascript" src="lib/iife/PNotifyConfirm.js"></script> |
| 12 | + <script type="text/javascript" src="lib/iife/PNotifyMobile.js"></script> |
8 | 13 | <link href="src/PNotifyBrightTheme.css" rel="stylesheet" type="text/css" /> |
9 | 14 | <link href="" id="bootstrap-css" rel="stylesheet" type="text/css" /> |
10 | 15 | <link href="" id="fontawesome-css" rel="stylesheet" type="text/css" /> |
11 | 16 |
|
12 | 17 | <script type="text/javascript"> |
13 | | - function loadStylingDeps() { |
| 18 | + function setStyling() { |
14 | 19 | var styling = document.getElementById("styling").value; |
| 20 | + |
| 21 | + PNotify.defaults.styling = styling; |
| 22 | + |
| 23 | + if (styling === "bootstrap3") { |
| 24 | + document.forms.libraries.elements.libraryBootstrap.value = "3"; |
| 25 | + loadLibraries(); |
| 26 | + } else if (styling === "bootstrap4") { |
| 27 | + document.forms.libraries.elements.libraryBootstrap.value = "4"; |
| 28 | + loadLibraries(); |
| 29 | + } |
| 30 | + |
| 31 | + PNotify.removeAll(); |
| 32 | + } |
| 33 | + |
| 34 | + function setIcons() { |
15 | 35 | var icons = document.getElementById("icons").value; |
16 | | - var output = document.getElementById("output"); |
17 | | - output.innerText = ""; |
18 | 36 |
|
19 | | - if (styling === "bootstrap4" && icons === "bootstrap3") { |
20 | | - output.innerText = "You can't use both Bootstrap 3 and Bootstrap 4."; |
21 | | - return; |
| 37 | + PNotify.defaults.icons = icons; |
| 38 | + |
| 39 | + if (icons === "bootstrap3") { |
| 40 | + document.forms.libraries.elements.libraryBootstrap.value = "3"; |
| 41 | + loadLibraries(); |
| 42 | + } else if (icons === "fontawesome4") { |
| 43 | + document.forms.libraries.elements.libraryFontAwesome.value = "4"; |
| 44 | + loadLibraries(); |
| 45 | + } else if (icons === "fontawesome5") { |
| 46 | + document.forms.libraries.elements.libraryFontAwesome.value = "5"; |
| 47 | + loadLibraries(); |
22 | 48 | } |
23 | 49 |
|
24 | 50 | PNotify.removeAll(); |
| 51 | + } |
| 52 | + |
| 53 | + function setRtl() { |
| 54 | + var rtl = document.getElementById("rtl").checked; |
| 55 | + |
| 56 | + if (rtl) { |
| 57 | + document.body.dir = "rtl"; |
| 58 | + } else { |
| 59 | + document.body.dir = ""; |
| 60 | + } |
| 61 | + } |
25 | 62 |
|
26 | | - if (styling === "bootstrap3" || icons === "bootstrap3") { |
27 | | - document.getElementById("bootstrap-css").href = "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"; |
| 63 | + function loadLibraries() { |
| 64 | + var bootstrap = document.forms.libraries.elements.libraryBootstrap.value; |
| 65 | + var bootstrapCss = document.getElementById("bootstrap-css"); |
| 66 | + var fontAwesome = document.forms.libraries.elements.libraryFontAwesome.value; |
| 67 | + var fontAwesomeCss = document.getElementById("fontawesome-css"); |
| 68 | + var output = document.getElementById("output"); |
| 69 | + output.innerText = ""; |
| 70 | + |
| 71 | + if (bootstrap === "3") { |
| 72 | + bootstrapCss.href = "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"; |
28 | 73 | output.innerText += " Loaded Bootstrap 3."; |
29 | | - } else if (styling === "bootstrap4") { |
30 | | - document.getElementById("bootstrap-css").href = "https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"; |
| 74 | + } else if (bootstrap === "4") { |
| 75 | + bootstrapCss.href = "https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"; |
31 | 76 | output.innerText += " Loaded Bootstrap 4."; |
32 | 77 | } else { |
33 | | - document.getElementById("bootstrap-css").href = ""; |
| 78 | + bootstrapCss.href = ""; |
34 | 79 | } |
35 | 80 |
|
36 | | - if (icons === "fontawesome4") { |
37 | | - document.getElementById("fontawesome-css").href = "https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"; |
| 81 | + if (fontAwesome === "4") { |
| 82 | + fontAwesomeCss.href = "https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"; |
38 | 83 | output.innerText += " Loaded Font Awesome 4."; |
39 | | - } else if (icons === "fontawesome5") { |
40 | | - document.getElementById("fontawesome-css").href = "https://use.fontawesome.com/releases/v5.0.4/css/all.css"; |
| 84 | + } else if (fontAwesome === "5") { |
| 85 | + fontAwesomeCss.href = "https://use.fontawesome.com/releases/v5.0.4/css/all.css"; |
41 | 86 | output.innerText += " Loaded Font Awesome 5."; |
42 | 87 | } else { |
43 | | - document.getElementById("fontawesome-css").href = ""; |
| 88 | + fontAwesomeCss.href = ""; |
44 | 89 | } |
45 | 90 | } |
46 | 91 | </script> |
47 | 92 | </head> |
48 | 93 |
|
49 | 94 | <body> |
50 | | - <div style="padding: 30px;"> |
51 | | - Styling: <select id="styling" onchange="loadStylingDeps()"> |
52 | | - <option value="brighttheme">Bright Theme</option> |
53 | | - <option value="material">Material</option> |
54 | | - <option value="bootstrap3">Bootstrap 3</option> |
55 | | - <option value="bootstrap4">Bootstrap 4</option> |
56 | | - </select> |
57 | | - Icons: <select id="icons" onchange="loadStylingDeps()"> |
58 | | - <option value="brighttheme">Bright Theme</option> |
59 | | - <option value="material">Material</option> |
60 | | - <option value="bootstrap3">Bootstrap 3</option> |
61 | | - <option value="fontawesome4">Font Awesome 4</option> |
62 | | - <option value="fontawesome5">Font Awesome 5</option> |
63 | | - </select> |
64 | | - <span id="output"></span> |
| 95 | + <div style="padding: 0 30px; margin: 20px 0;"> |
| 96 | + <h1>Styling Demo</h1> |
| 97 | + <p> |
| 98 | + Use this page to check out various PNotify styling options. The Buttons, |
| 99 | + Confirm, and Mobile modules have been loaded. |
| 100 | + </p> |
| 101 | + |
| 102 | + <section> |
| 103 | + <h2>Choose PNotify's Styling Options</h2> |
| 104 | + <p> |
| 105 | + Styling: <select id="styling" onchange="setStyling()"> |
| 106 | + <option value="brighttheme">Bright Theme</option> |
| 107 | + <option value="material">Material</option> |
| 108 | + <option value="bootstrap3">Bootstrap 3</option> |
| 109 | + <option value="bootstrap4">Bootstrap 4</option> |
| 110 | + </select> |
| 111 | + Icons: <select id="icons" onchange="setIcons()"> |
| 112 | + <option value="brighttheme">Bright Theme</option> |
| 113 | + <option value="material">Material</option> |
| 114 | + <option value="bootstrap3">Bootstrap 3</option> |
| 115 | + <option value="fontawesome4">Font Awesome 4</option> |
| 116 | + <option value="fontawesome5">Font Awesome 5</option> |
| 117 | + </select> |
| 118 | + </p> |
| 119 | + <p> |
| 120 | + <label><input type="checkbox" id="rtl" onchange="setRtl()" /> Make page RTL (set dir="rtl" on <body>)</label> |
| 121 | + </p> |
| 122 | + <h2>Load CSS Libraries</h2> |
| 123 | + <form name="libraries"> |
| 124 | + <label><input type="radio" name="libraryBootstrap" value="" onchange="loadLibraries()" checked /> No Bootstrap</label> |
| 125 | + <label><input type="radio" name="libraryBootstrap" value="3" onchange="loadLibraries()" /> Bootstrap 3</label> |
| 126 | + <label><input type="radio" name="libraryBootstrap" value="4" onchange="loadLibraries()" /> Bootstrap 4</label> |
| 127 | + <br /> |
| 128 | + <label><input type="radio" name="libraryFontAwesome" value="" onchange="loadLibraries()" checked /> No Font Awesome</label> |
| 129 | + <label><input type="radio" name="libraryFontAwesome" value="4" onchange="loadLibraries()" /> Font Awesome 4</label> |
| 130 | + <label><input type="radio" name="libraryFontAwesome" value="5" onchange="loadLibraries()" /> Font Awesome 5</label> |
| 131 | + </form> |
| 132 | + <span id="output"></span> |
| 133 | + </section> |
65 | 134 | <hr /> |
66 | 135 | <h2>Test Notices</h2> |
67 | | - <button onclick="PNotify.notice({title: 'Test Notice', text: 'This is a test notice.', icons: document.getElementById('icons').value, styling: document.getElementById('styling').value})">Test Notice</button> |
68 | | - <button onclick="PNotify.info({title: 'Test Notice', text: 'This is a test notice.', icons: document.getElementById('icons').value, styling: document.getElementById('styling').value})">Test Info</button> |
69 | | - <button onclick="PNotify.success({title: 'Test Notice', text: 'This is a test notice.', icons: document.getElementById('icons').value, styling: document.getElementById('styling').value})">Test Success</button> |
70 | | - <button onclick="PNotify.error({title: 'Test Notice', text: 'This is a test notice.', icons: document.getElementById('icons').value, styling: document.getElementById('styling').value})">Test Danger</button> |
| 136 | + <button onclick="PNotify.notice({title: 'Test Notice', text: 'This is a test notice.'})">Test Notice</button> |
| 137 | + <button onclick="PNotify.info({title: 'Test Notice', text: 'This is a test notice.'})">Test Info</button> |
| 138 | + <button onclick="PNotify.success({title: 'Test Notice', text: 'This is a test notice.'})">Test Success</button> |
| 139 | + <button onclick="PNotify.error({title: 'Test Notice', text: 'This is a test notice.'})">Test Danger</button> |
| 140 | + <h3>Confirm Module</h3> |
| 141 | + <button onclick="PNotify.notice({ |
| 142 | + title: 'Confirmation Needed', |
| 143 | + text: 'Are you sure?', |
| 144 | + hide: false, |
| 145 | + modules: {Confirm: {confirm: true}, Buttons: {closer: false, sticker: false}} |
| 146 | + });">Confirm Notice</button> |
| 147 | + <button onclick="PNotify.info({ |
| 148 | + title: 'Confirmation Needed', |
| 149 | + text: 'Are you sure?', |
| 150 | + hide: false, |
| 151 | + modules: {Confirm: {confirm: true}, Buttons: {closer: false, sticker: false}} |
| 152 | + });">Confirm Info</button> |
| 153 | + <button onclick="PNotify.success({ |
| 154 | + title: 'Confirmation Needed', |
| 155 | + text: 'Are you sure?', |
| 156 | + hide: false, |
| 157 | + modules: {Confirm: {confirm: true}, Buttons: {closer: false, sticker: false}} |
| 158 | + });">Confirm Success</button> |
| 159 | + <button onclick="PNotify.error({ |
| 160 | + title: 'Confirmation Needed', |
| 161 | + text: 'Are you sure?', |
| 162 | + hide: false, |
| 163 | + modules: {Confirm: {confirm: true}, Buttons: {closer: false, sticker: false}} |
| 164 | + });">Confirm Error</button> |
| 165 | + <br /> |
| 166 | + <button onclick="PNotify.notice({ |
| 167 | + title: 'Input Needed', |
| 168 | + text: 'What side would you like?', |
| 169 | + hide: false, |
| 170 | + modules: {Confirm: {prompt: true}, Buttons: {closer: false, sticker: false}} |
| 171 | + });">Prompt Notice</button> |
| 172 | + <button onclick="PNotify.info({ |
| 173 | + title: 'Input Needed', |
| 174 | + text: 'What side would you like?', |
| 175 | + hide: false, |
| 176 | + modules: {Confirm: {prompt: true}, Buttons: {closer: false, sticker: false}} |
| 177 | + });">Prompt Info</button> |
| 178 | + <button onclick="PNotify.success({ |
| 179 | + title: 'Input Needed', |
| 180 | + text: 'What side would you like?', |
| 181 | + hide: false, |
| 182 | + modules: {Confirm: {prompt: true}, Buttons: {closer: false, sticker: false}} |
| 183 | + });">Prompt Success</button> |
| 184 | + <button onclick="PNotify.error({ |
| 185 | + title: 'Input Needed', |
| 186 | + text: 'What side would you like?', |
| 187 | + hide: false, |
| 188 | + modules: {Confirm: {prompt: true}, Buttons: {closer: false, sticker: false}} |
| 189 | + });">Prompt Error</button> |
| 190 | + <br /> |
| 191 | + <button onclick="PNotify.notice({ |
| 192 | + title: 'Input Needed', |
| 193 | + text: 'Describe the color blue.', |
| 194 | + hide: false, |
| 195 | + modules: {Confirm: {prompt: true, prompt_multi_line: true}, Buttons: {closer: false, sticker: false}} |
| 196 | + });">Multi Line Prompt Notice</button> |
| 197 | + <button onclick="PNotify.info({ |
| 198 | + title: 'Input Needed', |
| 199 | + text: 'Describe the color blue.', |
| 200 | + hide: false, |
| 201 | + modules: {Confirm: {prompt: true, prompt_multi_line: true}, Buttons: {closer: false, sticker: false}} |
| 202 | + });">Multi Line Prompt Info</button> |
| 203 | + <button onclick="PNotify.success({ |
| 204 | + title: 'Input Needed', |
| 205 | + text: 'Describe the color blue.', |
| 206 | + hide: false, |
| 207 | + modules: {Confirm: {prompt: true, prompt_multi_line: true}, Buttons: {closer: false, sticker: false}} |
| 208 | + });">Multi Line Prompt Success</button> |
| 209 | + <button onclick="PNotify.error({ |
| 210 | + title: 'Input Needed', |
| 211 | + text: 'Describe the color blue.', |
| 212 | + hide: false, |
| 213 | + modules: {Confirm: {prompt: true, prompt_multi_line: true}, Buttons: {closer: false, sticker: false}} |
| 214 | + });">Multi Line Prompt Error</button> |
71 | 215 | </div> |
72 | 216 | </body> |
73 | 217 | </html> |
0 commit comments