Skip to content

Commit 41322c9

Browse files
committed
Fixed module imports in Webpack. UMD modules now don't require ".default". Improved source rendering on demo page.
1 parent 6a01abf commit 41322c9

File tree

19 files changed

+6023
-3044
lines changed

19 files changed

+6023
-3044
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ var PNotify = require('pnotify/dist/umd/PNotify');
192192
var PNotifyButtons = require('pnotify/dist/umd/PNotifyButtons');
193193

194194
angular.module('WhateverModule', [])
195-
.value('PNotify', PNotify.default)
195+
.value('PNotify', PNotify)
196196
.controller('WhateverController', ['PNotify', function(PNotify) {
197197
PNotify.alert('Notice me, senpai!');
198198
}]);

demo/compat-iife.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ <h1>PNotify Backward Compatibility Module (IIFE)</h1>
114114
});">Desktop - Notice</button>
115115
<button onclick="new PNotifyCompat({
116116
title: 'Regular Notice',
117-
text: 'Check me out! I\'m a notice. With buttons'
117+
text: 'Check me out! I\'m a notice. With buttons.'
118118
});">Buttons</button>
119119
<button onclick="new PNotifyCompat({
120120
title: 'Custom Icon Button Notice',

demo/compat-umd.html

Lines changed: 1 addition & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -50,63 +50,43 @@ <h1>PNotify Backward Compatibility Module (UMD)</h1>
5050
<hr />
5151
Some simple demos:<br />
5252
<button onclick="requirejs(['PNotifyCompat'], function(PNotify){
53-
PNotify = PNotify && PNotify.__esModule ? PNotify['default'] : PNotify;
54-
5553
new PNotify({
5654
title: 'Regular Notice',
5755
text: 'Check me out! I\'m a notice.'
5856
});
59-
6057
});">Notice</button>
6158
<button onclick="requirejs(['PNotifyCompat'], function(PNotify){
62-
PNotify = PNotify && PNotify.__esModule ? PNotify['default'] : PNotify;
63-
6459
new PNotify({
6560
title: 'New Thing',
6661
text: 'Just to let you know, something happened.',
6762
type: 'info'
6863
});
69-
7064
});">Info Message</button>
7165
<button onclick="requirejs(['PNotifyCompat'], function(PNotify){
72-
PNotify = PNotify && PNotify.__esModule ? PNotify['default'] : PNotify;
73-
7466
new PNotify({
7567
title: 'Success!',
7668
text: 'That thing that you were trying to do worked.',
7769
type: 'success'
7870
});
79-
8071
});">Success Message</button>
8172
<button onclick="requirejs(['PNotifyCompat'], function(PNotify){
82-
PNotify = PNotify && PNotify.__esModule ? PNotify['default'] : PNotify;
83-
8473
new PNotify({
8574
title: 'Oh No!',
8675
text: 'Something terrible happened.',
8776
type: 'error'
8877
});
89-
9078
});">Error Message</button>
9179
<button onclick="requirejs(['PNotifyCompat'], function(PNotify){
92-
PNotify = PNotify && PNotify.__esModule ? PNotify['default'] : PNotify;
93-
9480
new PNotify('Check me out! I\'m a notice.');
95-
9681
});">Simple</button>
9782
<button onclick="requirejs(['PNotifyCompat'], function(PNotify){
98-
PNotify = PNotify && PNotify.__esModule ? PNotify['default'] : PNotify;
99-
10083
new PNotify({
10184
title: 'No Mouse Reset Notice',
10285
text: 'I don\'t care if you move your mouse over me, I\'ll disappear when I want.',
10386
mouse_reset: false
10487
});
105-
10688
});">No Mouse Reset</button>
10789
<button onclick="requirejs(['PNotifyCompat'], function(PNotify){
108-
PNotify = PNotify && PNotify.__esModule ? PNotify['default'] : PNotify;
109-
11090
var notice = new PNotify({
11191
title: 'Click Notice',
11292
text: 'I wish someone would click me.'
@@ -118,27 +98,20 @@ <h1>PNotify Backward Compatibility Module (UMD)</h1>
11898
text: 'Yay, you clicked me!&lt;div style=&quot;text-align: center;&quot;&gt;&lt;img src=&quot;https://upload.wikimedia.org/wikipedia/commons/thumb/e/ec/Happy_smiley_face.png/240px-Happy_smiley_face.png&quot; /&gt;&lt;/div&gt;'
11999
});
120100
});
121-
122101
});">Click on It</button>
123102
<button onclick="requirejs(['PNotifyCompat'], function(PNotify){
124-
PNotify = PNotify && PNotify.__esModule ? PNotify['default'] : PNotify;
125-
126103
new PNotify({
127104
title: '&lt;span style=&quot;color: green;&quot;&gt;Rich Content Notice&lt;/span&gt;',
128105
text: '&lt;span style=&quot;color: blue;&quot;&gt;Look at my beautiful &lt;strong&gt;strong&lt;/strong&gt;, &lt;em&gt;emphasized&lt;/em&gt;, and &lt;span style=&quot;font-size: 1.5em;&quot;&gt;large&lt;/span&gt; text.&lt;/span&gt;'
129106
});
130-
131107
});">Rich Text</button>
132108
<button onclick="requirejs(['PNotifyCompat'], function(PNotify){
133-
PNotify = PNotify && PNotify.__esModule ? PNotify['default'] : PNotify;
134-
135109
new PNotify({
136110
title: '&lt;em&gt;Escaped Notice&lt;/em&gt;',
137111
title_escape: true,
138112
text: $('#evil_html').html(),
139113
text_escape: true
140114
});
141-
142115
});">Or Keep it Safe</button>
143116
<span id="evil_html" style="display: none;">
144117
<span>As you can see, I don't allow HTML in my content.</span>
@@ -152,8 +125,6 @@ <h1>PNotify Backward Compatibility Module (UMD)</h1>
152125
<hr />
153126
Some module demos<br />
154127
<button onclick="requirejs(['PNotifyCompat', 'PNotifyDesktop'], function(PNotify){
155-
PNotify = PNotify && PNotify.__esModule ? PNotify['default'] : PNotify;
156-
157128
PNotify.desktop.permission();
158129
(new PNotify({
159130
title: 'Desktop Notice',
@@ -165,20 +136,14 @@ <h1>PNotify Backward Compatibility Module (UMD)</h1>
165136
if ($('.ui-pnotify-closer, .ui-pnotify-sticker, .ui-pnotify-closer *, .ui-pnotify-sticker *').is(e.target)) return;
166137
alert('Hey! You clicked the desktop notification!');
167138
});
168-
169139
});">Desktop - Notice</button>
170140
<button onclick="requirejs(['PNotifyCompat', 'PNotifyButtons'], function(PNotify){
171-
PNotify = PNotify && PNotify.__esModule ? PNotify['default'] : PNotify;
172-
173141
new PNotify({
174142
title: 'Regular Notice',
175-
text: 'Check me out! I\'m a notice. With buttons'
143+
text: 'Check me out! I\'m a notice. With buttons.'
176144
});
177-
178145
});">Buttons</button>
179146
<button onclick="requirejs(['PNotifyCompat', 'PNotifyButtons'], function(PNotify){
180-
PNotify = PNotify && PNotify.__esModule ? PNotify['default'] : PNotify;
181-
182147
new PNotify({
183148
title: 'Custom Icon Button Notice',
184149
text: 'Check me out! My sticker and close buttons have custom icons!',
@@ -191,35 +156,26 @@ <h1>PNotify Backward Compatibility Module (UMD)</h1>
191156
}
192157
}
193158
});
194-
195159
});">Buttons - Custom Icons</button>
196160
<button onclick="requirejs(['PNotifyCompat', 'PNotifyNonBlock'], function(PNotify){
197-
PNotify = PNotify && PNotify.__esModule ? PNotify['default'] : PNotify;
198-
199161
new PNotify({
200162
title: 'Non-Blocking Notice',
201163
text: 'I\'m a special kind of notice called &quot;non-blocking&quot;. 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.',
202164
nonblock: {
203165
nonblock: true
204166
}
205167
});
206-
207168
});">NonBlock</button>
208169
<button onclick="requirejs(['PNotifyCompat', 'PNotifyMobile'], function(PNotify){
209-
PNotify = PNotify && PNotify.__esModule ? PNotify['default'] : PNotify;
210-
211170
new PNotify({
212171
title: 'No Mobile Support Notice',
213172
text: 'If you\'re on a mobile device, I won\'t respond to your swipes.',
214173
mobile: {
215174
swipe_dismiss: false
216175
}
217176
});
218-
219177
});">Mobile - No Mobile Support</button>
220178
<button onclick="requirejs(['PNotifyCompat', 'PNotifyAnimate'], function(PNotify){
221-
PNotify = PNotify && PNotify.__esModule ? PNotify['default'] : PNotify;
222-
223179
new PNotify({
224180
title: 'Animate.css Effect',
225181
text: 'I use effects from Animate.css. Such smooth CSS3 transitions make me feel like butter.',
@@ -229,11 +185,8 @@ <h1>PNotify Backward Compatibility Module (UMD)</h1>
229185
out_class: 'rotateOutUpRight'
230186
}
231187
});
232-
233188
});">Animate</button>
234189
<button onclick="requirejs(['PNotifyCompat', 'PNotifyConfirm'], function(PNotify){
235-
PNotify = PNotify && PNotify.__esModule ? PNotify['default'] : PNotify;
236-
237190
(new PNotify({
238191
title: 'Confirmation Needed',
239192
text: 'Are you sure?',
@@ -253,11 +206,8 @@ <h1>PNotify Backward Compatibility Module (UMD)</h1>
253206
}).on('pnotify.cancel', function() {
254207
alert('Oh ok. Chicken, I see.');
255208
});
256-
257209
});">Confirm - Confirm Dialog</button>
258210
<button onclick="requirejs(['PNotifyCompat', 'PNotifyConfirm'], function(PNotify){
259-
PNotify = PNotify && PNotify.__esModule ? PNotify['default'] : PNotify;
260-
261211
(new PNotify({
262212
title: 'Input Needed',
263213
text: 'What side would you like?',
@@ -301,11 +251,8 @@ <h1>PNotify Backward Compatibility Module (UMD)</h1>
301251
}
302252
});
303253
});
304-
305254
});">Confirm - Prompt Dialog</button>
306255
<button onclick="requirejs(['PNotifyCompat', 'PNotifyCallbacks'], function(PNotify){
307-
PNotify = PNotify && PNotify.__esModule ? PNotify['default'] : PNotify;
308-
309256
var dont_alert = function() {};
310257
new PNotify({
311258
title: 'I\'m Here',
@@ -334,12 +281,9 @@ <h1>PNotify Backward Compatibility Module (UMD)</h1>
334281
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);
335282
}
336283
});
337-
338284
});">Callbacks</button>
339285
<button onclick="$(this).trigger('pnotify.history-last');">History - Show Last</button>
340286
<button onclick="requirejs(['PNotifyCompat', 'PNotifyReference'], function(PNotify){
341-
PNotify = PNotify && PNotify.__esModule ? PNotify['default'] : PNotify;
342-
343287
new PNotify({
344288
title: 'Reference Module',
345289
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).',
@@ -348,7 +292,6 @@ <h1>PNotify Backward Compatibility Module (UMD)</h1>
348292
put_thing: true
349293
}
350294
});
351-
352295
});">Reference</button>
353296
<hr />
354297
</p>

demo/styling.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
bootstrapCss.href = 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css';
7575
output.innerText += ' Loaded Bootstrap 3.';
7676
} else if (bootstrap === '4') {
77-
bootstrapCss.href = 'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css';
77+
bootstrapCss.href = 'https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css';
7878
output.innerText += ' Loaded Bootstrap 4.';
7979
} else {
8080
bootstrapCss.href = '';
@@ -84,7 +84,7 @@
8484
fontAwesomeCss.href = 'https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css';
8585
output.innerText += ' Loaded Font Awesome 4.';
8686
} else if (fontAwesome === '5') {
87-
fontAwesomeCss.href = 'https://use.fontawesome.com/releases/v5.0.4/css/all.css';
87+
fontAwesomeCss.href = 'https://use.fontawesome.com/releases/v5.0.13/css/all.css';
8888
output.innerText += ' Loaded Font Awesome 5.';
8989
} else {
9090
fontAwesomeCss.href = '';

0 commit comments

Comments
 (0)