Skip to content

Commit cb2af4a

Browse files
committed
JSHint fixes
1 parent 4ecc275 commit cb2af4a

File tree

3 files changed

+44
-43
lines changed

3 files changed

+44
-43
lines changed

jquery.jgrowl.js

Lines changed: 41 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@
135135
/** jGrowl Wrapper - Establish a base jGrowl Container for compatibility with older releases. **/
136136
$.jGrowl = function( m , o ) {
137137
// To maintain compatibility with older version that only supported one instance we'll create the base container.
138-
if ( $('#jGrowl').size() == 0 )
138+
if ( $('#jGrowl').size() === 0 )
139139
$('<div id="jGrowl"></div>').addClass( (o && o.position) ? o.position : $.jGrowl.defaults.position ).appendTo('body');
140140

141141
// Create a notification on the container.
@@ -150,7 +150,7 @@
150150

151151
return this.each(function() {
152152
/** Create a jGrowl Instance on the Container if it does not exist **/
153-
if ( $(this).data('jGrowl.instance') == undefined ) {
153+
if ( $(this).data('jGrowl.instance') === undefined ) {
154154
$(this).data('jGrowl.instance', $.extend( new $.fn.jGrowl(), { notifications: [], element: null, interval: null } ));
155155
$(this).data('jGrowl.instance').startup( this );
156156
}
@@ -162,7 +162,7 @@
162162
$(this).data('jGrowl.instance').create( m , o );
163163
}
164164
});
165-
};
165+
}
166166
};
167167

168168
$.extend( $.fn.jGrowl.prototype , {
@@ -173,44 +173,44 @@
173173
header: '',
174174
group: '',
175175
sticky: false,
176-
position: 'top-right',
176+
position: 'top-right',
177177
glue: 'after',
178178
theme: 'default',
179179
themeState: 'highlight',
180180
corners: '10px',
181181
check: 250,
182182
life: 3000,
183-
closeDuration: 'normal',
184-
openDuration: 'normal',
185-
easing: 'swing',
186-
closer: true,
187-
closeTemplate: '&times;',
188-
closerTemplate: '<div>[ close all ]</div>',
183+
closeDuration: 'normal',
184+
openDuration: 'normal',
185+
easing: 'swing',
186+
closer: true,
187+
closeTemplate: '&times;',
188+
closerTemplate: '<div>[ close all ]</div>',
189189
log: function() {},
190190
beforeOpen: function() {},
191191
afterOpen: function() {},
192192
open: function() {},
193-
beforeClose: function() {},
193+
beforeClose: function() {},
194194
close: function() {},
195-
animateOpen: {
196-
opacity: 'show'
195+
animateOpen: {
196+
opacity: 'show'
197197
},
198-
animateClose: {
199-
opacity: 'hide'
198+
animateClose: {
199+
opacity: 'hide'
200200
}
201201
},
202202

203203
notifications: [],
204204

205205
/** jGrowl Container Node **/
206-
element: null,
206+
element: null,
207207

208208
/** Interval Function **/
209-
interval: null,
209+
interval: null,
210210

211211
/** Create a Notification **/
212-
create: function( message , o ) {
213-
var o = $.extend({}, this.defaults, o);
212+
create: function( message , options ) {
213+
var o = $.extend({}, this.defaults, options);
214214

215215
/* To keep backward compatibility with 1.24 and earlier, honor 'speed' if the user has set it */
216216
if (typeof o.speed !== 'undefined') {
@@ -223,16 +223,16 @@
223223
o.log.apply( this.element , [this.element,message,o] );
224224
},
225225

226-
render: function( notification ) {
226+
render: function( n ) {
227227
var self = this;
228-
var message = notification.message;
229-
var o = notification.options;
228+
var message = n.message;
229+
var o = n.options;
230230

231231
// Support for jQuery theme-states, if this is not used it displays a widget header
232-
o.themeState = (o.themeState == '') ? '' : 'ui-state-' + o.themeState;
232+
o.themeState = (o.themeState === '') ? '' : 'ui-state-' + o.themeState;
233233

234234
var notification = $('<div/>')
235-
.addClass('jGrowl-notification ' + o.themeState + ' ui-corner-all' + ((o.group != undefined && o.group != '') ? ' ' + o.group : ''))
235+
.addClass('jGrowl-notification ' + o.themeState + ' ui-corner-all' + ((o.group !== undefined && o.group !== '') ? ' ' + o.group : ''))
236236
.append($('<div/>').addClass('jGrowl-close').html(o.closeTemplate))
237237
.append($('<div/>').addClass('jGrowl-header').html(o.header))
238238
.append($('<div/>').addClass('jGrowl-message').html(message))
@@ -289,11 +289,11 @@
289289
}).trigger('jGrowl.beforeOpen');
290290

291291
/** Optional Corners Plugin **/
292-
if ( o.corners != '' && $.fn.corner != undefined ) $(notification).corner( o.corners );
292+
if ( o.corners !== '' && $.fn.corner !== undefined ) $(notification).corner( o.corners );
293293

294294
/** Add a Global Closer if more than one notification exists **/
295-
if ( $('div.jGrowl-notification:parent', self.element).size() > 1 &&
296-
$('div.jGrowl-closer', self.element).size() == 0 && this.defaults.closer !== false ) {
295+
if ($('div.jGrowl-notification:parent', self.element).size() > 1 &&
296+
$('div.jGrowl-closer', self.element).size() === 0 && this.defaults.closer !== false ) {
297297
$(this.defaults.closerTemplate).addClass('jGrowl-closer ' + this.defaults.themeState + ' ui-corner-all').addClass(this.defaults.theme)
298298
.appendTo(self.element).animate(this.defaults.animateOpen, this.defaults.speed, this.defaults.easing)
299299
.bind("click.jGrowl", function() {
@@ -303,55 +303,56 @@
303303
self.defaults.closer.apply( $(this).parent()[0] , [$(this).parent()[0]] );
304304
}
305305
});
306-
};
306+
}
307307
},
308308

309309
/** Update the jGrowl Container, removing old jGrowl notifications **/
310-
update: function() {
310+
update: function() {
311311
$(this.element).find('div.jGrowl-notification:parent').each( function() {
312-
if ( $(this).data("jGrowl") != undefined && $(this).data("jGrowl").created !== undefined &&
313-
($(this).data("jGrowl").created.getTime() + parseInt($(this).data("jGrowl").life)) < (new Date()).getTime() &&
314-
$(this).data("jGrowl").sticky !== true &&
315-
($(this).data("jGrowl.pause") == undefined || $(this).data("jGrowl.pause") !== true) ) {
312+
if ($(this).data("jGrowl") !== undefined && $(this).data("jGrowl").created !== undefined &&
313+
($(this).data("jGrowl").created.getTime() + parseInt($(this).data("jGrowl").life, 10)) < (new Date()).getTime() &&
314+
$(this).data("jGrowl").sticky !== true &&
315+
($(this).data("jGrowl.pause") === undefined || $(this).data("jGrowl.pause") !== true) ) {
316316

317317
// Pause the notification, lest during the course of animation another close event gets called.
318318
$(this).trigger('jGrowl.beforeClose');
319319
}
320320
});
321321

322-
if ( this.notifications.length > 0 &&
323-
(this.defaults.pool == 0 || $(this.element).find('div.jGrowl-notification:parent').size() < this.defaults.pool) )
322+
if (this.notifications.length > 0 &&
323+
(this.defaults.pool === 0 || $(this.element).find('div.jGrowl-notification:parent').size() < this.defaults.pool) )
324324
this.render( this.notifications.shift() );
325325

326-
if ( $(this.element).find('div.jGrowl-notification:parent').size() < 2 ) {
326+
if ($(this.element).find('div.jGrowl-notification:parent').size() < 2 ) {
327327
$(this.element).find('div.jGrowl-closer').animate(this.defaults.animateClose, this.defaults.speed, this.defaults.easing, function() {
328328
$(this).remove();
329329
});
330330
}
331331
},
332332

333333
/** Setup the jGrowl Notification Container **/
334-
startup: function(e) {
334+
startup: function(e) {
335335
this.element = $(e).addClass('jGrowl').append('<div class="jGrowl-notification"></div>');
336336
this.interval = setInterval( function() {
337337
$(e).data('jGrowl.instance').update();
338-
}, parseInt(this.defaults.check));
338+
}, parseInt(this.defaults.check, 10));
339339

340340
if ($ie6) {
341341
$(this.element).addClass('ie6');
342342
}
343343
},
344344

345345
/** Shutdown jGrowl, removing it and clearing the interval **/
346-
shutdown: function() {
346+
shutdown: function() {
347347
$(this.element).removeClass('jGrowl')
348348
.find('div.jGrowl-notification').trigger('jGrowl.close')
349349
.parent().empty()
350+
;
350351

351352
clearInterval(this.interval);
352353
},
353354

354-
close: function() {
355+
close: function() {
355356
$(this.element).find('div.jGrowl-notification').each(function(){
356357
$(this).trigger('jGrowl.beforeClose');
357358
});

jquery.jgrowl.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)