Skip to content

Commit 157d28c

Browse files
global scope pollution fixed
ucfirst written as jquery plugin to fix global scope pollution
1 parent 5a243fc commit 157d28c

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

js/jquery.nyroModal.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ jQuery(function($, undefined) {
329329
.append(this._filterScripts(html))
330330
.prepend(this.header)
331331
.append(this.footer)
332-
.wrapInner($('<div />', {'class': 'nyroModal'+ucfirst(this.loadFilter)}));
332+
.wrapInner($('<div />', {'class': 'nyroModal'+$.ucfirst(this.loadFilter)}));
333333

334334
// Store the size of the element
335335
this.sizes.initW = this.sizes.w = this.elts.hidden.width();
@@ -427,7 +427,7 @@ jQuery(function($, undefined) {
427427
// - clb: Callback once the animation is done
428428
_callAnim: function(fct, clb) {
429429
this.getInternal()._debug(fct);
430-
this._callFilters('before'+ucfirst(fct));
430+
this._callFilters('before'+$.ucfirst(fct));
431431
if (!this._animated) {
432432
this._animated = true;
433433
if (!$.isFunction(clb)) clb = $.noop;
@@ -441,7 +441,7 @@ jQuery(function($, undefined) {
441441
}
442442
curFct(this, $.proxy(function() {
443443
this._animated = false;
444-
this._callFilters('after'+ucfirst(fct));
444+
this._callFilters('after'+$.ucfirst(fct));
445445
clb();
446446
}, this));
447447
}
@@ -934,7 +934,9 @@ jQuery(function($, undefined) {
934934

935935
})(jQuery,'smartresize');
936936
// ucFirst
937-
function ucfirst(str) {
937+
// jquery plugin by: Baris Aydinoglu (http://baris.aydinoglu.info)
938+
(function($) {
939+
$.ucfirst = function(str) {
938940
// http://kevin.vanzonneveld.net
939941
// + original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
940942
// + bugfixed by: Onno Marsman
@@ -944,4 +946,5 @@ function ucfirst(str) {
944946
str += '';
945947
var f = str.charAt(0).toUpperCase();
946948
return f + str.substr(1);
947-
}
949+
};
950+
})(jQuery);

0 commit comments

Comments
 (0)