Permalink
Browse files

global scope pollution fixed

ucfirst written as jquery plugin to fix global scope pollution
  • Loading branch information...
1 parent 5a243fc commit 157d28c3369559c3fa588acbab508d291b6cc7d7 @barisaydinoglu barisaydinoglu committed Jan 5, 2014
Showing with 8 additions and 5 deletions.
  1. +8 −5 js/jquery.nyroModal.js
@@ -329,7 +329,7 @@ jQuery(function($, undefined) {
.append(this._filterScripts(html))
.prepend(this.header)
.append(this.footer)
- .wrapInner($('<div />', {'class': 'nyroModal'+ucfirst(this.loadFilter)}));
+ .wrapInner($('<div />', {'class': 'nyroModal'+$.ucfirst(this.loadFilter)}));
// Store the size of the element
this.sizes.initW = this.sizes.w = this.elts.hidden.width();
@@ -427,7 +427,7 @@ jQuery(function($, undefined) {
// - clb: Callback once the animation is done
_callAnim: function(fct, clb) {
this.getInternal()._debug(fct);
- this._callFilters('before'+ucfirst(fct));
+ this._callFilters('before'+$.ucfirst(fct));
if (!this._animated) {
this._animated = true;
if (!$.isFunction(clb)) clb = $.noop;
@@ -441,7 +441,7 @@ jQuery(function($, undefined) {
}
curFct(this, $.proxy(function() {
this._animated = false;
- this._callFilters('after'+ucfirst(fct));
+ this._callFilters('after'+$.ucfirst(fct));
clb();
}, this));
}
@@ -934,7 +934,9 @@ jQuery(function($, undefined) {
})(jQuery,'smartresize');
// ucFirst
-function ucfirst(str) {
+// jquery plugin by: Baris Aydinoglu (http://baris.aydinoglu.info)
+(function($) {
+ $.ucfirst = function(str) {
// http://kevin.vanzonneveld.net
// + original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + bugfixed by: Onno Marsman
@@ -944,4 +946,5 @@ function ucfirst(str) {
str += '';
var f = str.charAt(0).toUpperCase();
return f + str.substr(1);
-}
+ };
+})(jQuery);

0 comments on commit 157d28c

Please sign in to comment.