aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2010-02-07 03:40:13 +0000
committerScott González <scott.gonzalez@gmail.com>2010-02-07 03:40:13 +0000
commitf349f9080baf812a33faf742c54e7973c6411b89 (patch)
treeb34e36ad47e1b38ce78bd8e0a4574b542b1ffa35
parent573a402d05ace6c331314712ed3e1cc5e7ace0f1 (diff)
downloadjquery-ui-f349f9080baf812a33faf742c54e7973c6411b89.tar.gz
jquery-ui-f349f9080baf812a33faf742c54e7973c6411b89.zip
Progressbar: Conform to coding standards.
-rw-r--r--ui/jquery.ui.progressbar.js84
1 files changed, 36 insertions, 48 deletions
diff --git a/ui/jquery.ui.progressbar.js b/ui/jquery.ui.progressbar.js
index 08880aacf..b38d826f0 100644
--- a/ui/jquery.ui.progressbar.js
+++ b/ui/jquery.ui.progressbar.js
@@ -11,19 +11,15 @@
* jquery.ui.core.js
* jquery.ui.widget.js
*/
-(function($) {
+(function( $ ) {
-$.widget("ui.progressbar", {
+$.widget( "ui.progressbar", {
options: {
value: 0
},
_create: function() {
-
this.element
- .addClass("ui-progressbar"
- + " ui-widget"
- + " ui-widget-content"
- + " ui-corner-all")
+ .addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
.attr({
role: "progressbar",
"aria-valuemin": this._valueMin(),
@@ -31,89 +27,81 @@ $.widget("ui.progressbar", {
"aria-valuenow": this._value()
});
- this.valueDiv = $('<div class="ui-progressbar-value ui-widget-header ui-corner-left"></div>').appendTo(this.element);
+ this.valueDiv = $( "<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>" )
+ .appendTo( this.element );
this._refreshValue();
-
},
destroy: function() {
-
this.element
- .removeClass("ui-progressbar"
- + " ui-widget"
- + " ui-widget-content"
- + " ui-corner-all")
- .removeAttr("role")
- .removeAttr("aria-valuemin")
- .removeAttr("aria-valuemax")
- .removeAttr("aria-valuenow")
- .removeData("progressbar")
- .unbind(".progressbar");
+ .removeClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
+ .removeAttr( "role" )
+ .removeAttr( "aria-valuemin" )
+ .removeAttr( "aria-valuemax" )
+ .removeAttr( "aria-valuenow" );
this.valueDiv.remove();
- $.Widget.prototype.destroy.apply(this, arguments);
-
- return this;
+ $.Widget.prototype.destroy.apply( this, arguments );
},
- value: function(newValue) {
- if (newValue === undefined) {
+ value: function( newValue ) {
+ if ( newValue === undefined ) {
return this._value();
}
-
- this._setOption('value', newValue);
+
+ this._setOption( "value", newValue );
return this;
},
- _setOption: function(key, value) {
-
- switch (key) {
- case 'value':
+ _setOption: function( key, value ) {
+ switch ( key ) {
+ case "value":
this.options.value = value;
this._refreshValue();
- this._trigger('change', null, {});
+ this._trigger( "change" );
break;
}
- $.Widget.prototype._setOption.apply(this, arguments);
-
+ $.Widget.prototype._setOption.apply( this, arguments );
},
_value: function() {
var val = this.options.value;
// normalize invalid value
- if (typeof val != "number")
+ if ( typeof val !== "number" ) {
val = 0;
- if (val < this._valueMin()) val = this._valueMin();
- if (val > this._valueMax()) val = this._valueMax();
+ }
+ if ( val < this._valueMin() ) {
+ val = this._valueMin();
+ }
+ if ( val > this._valueMax() ) {
+ val = this._valueMax();
+ }
return val;
-
},
_valueMin: function() {
- var valueMin = 0;
- return valueMin;
+ return 0;
},
_valueMax: function() {
- var valueMax = 100;
- return valueMax;
+ return 100;
},
_refreshValue: function() {
var value = this.value();
- this.valueDiv[value == this._valueMax() ? 'addClass' : 'removeClass']("ui-corner-right");
- this.valueDiv.width(value + '%');
- this.element.attr("aria-valuenow", value);
+ this.valueDiv
+ [ value === this._valueMax() ? "addClass" : "removeClass"]( "ui-corner-right" )
+ .width( value + "%" );
+ this.element.attr( "aria-valuenow", value );
}
-
});
-$.extend($.ui.progressbar, {
+$.extend( $.ui.progressbar, {
version: "@VERSION"
});
-})(jQuery);
+})( jQuery );