summaryrefslogtreecommitdiff
path: root/resources/jquery.ui/jquery.ui.progressbar.js
diff options
context:
space:
mode:
Diffstat (limited to 'resources/jquery.ui/jquery.ui.progressbar.js')
-rw-r--r--resources/jquery.ui/jquery.ui.progressbar.js63
1 files changed, 32 insertions, 31 deletions
diff --git a/resources/jquery.ui/jquery.ui.progressbar.js b/resources/jquery.ui/jquery.ui.progressbar.js
index 4bc092d1..c432132a 100644
--- a/resources/jquery.ui/jquery.ui.progressbar.js
+++ b/resources/jquery.ui/jquery.ui.progressbar.js
@@ -1,9 +1,9 @@
/*
- * jQuery UI Progressbar 1.8.2
+ * jQuery UI Progressbar 1.8.11
*
- * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
*
* http://docs.jquery.com/UI/Progressbar
*
@@ -11,25 +11,30 @@
* jquery.ui.core.js
* jquery.ui.widget.js
*/
-(function( $ ) {
+(function( $, undefined ) {
$.widget( "ui.progressbar", {
options: {
- value: 0
+ value: 0,
+ max: 100
},
+
+ min: 0,
+
_create: function() {
this.element
.addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
.attr({
role: "progressbar",
- "aria-valuemin": this._valueMin(),
- "aria-valuemax": this._valueMax(),
+ "aria-valuemin": this.min,
+ "aria-valuemax": this.options.max,
"aria-valuenow": this._value()
});
this.valueDiv = $( "<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>" )
.appendTo( this.element );
+ this.oldValue = this._value();
this._refreshValue();
},
@@ -56,12 +61,12 @@ $.widget( "ui.progressbar", {
},
_setOption: function( key, value ) {
- switch ( key ) {
- case "value":
- this.options.value = value;
- this._refreshValue();
- this._trigger( "change" );
- break;
+ if ( key === "value" ) {
+ this.options.value = value;
+ this._refreshValue();
+ if ( this._value() === this.options.max ) {
+ this._trigger( "complete" );
+ }
}
$.Widget.prototype._setOption.apply( this, arguments );
@@ -73,35 +78,31 @@ $.widget( "ui.progressbar", {
if ( typeof val !== "number" ) {
val = 0;
}
- if ( val < this._valueMin() ) {
- val = this._valueMin();
- }
- if ( val > this._valueMax() ) {
- val = this._valueMax();
- }
-
- return val;
+ return Math.min( this.options.max, Math.max( this.min, val ) );
},
- _valueMin: function() {
- return 0;
- },
-
- _valueMax: function() {
- return 100;
+ _percentage: function() {
+ return 100 * this._value() / this.options.max;
},
_refreshValue: function() {
var value = this.value();
+ var percentage = this._percentage();
+
+ if ( this.oldValue !== value ) {
+ this.oldValue = value;
+ this._trigger( "change" );
+ }
+
this.valueDiv
- [ value === this._valueMax() ? "addClass" : "removeClass"]( "ui-corner-right" )
- .width( value + "%" );
+ .toggleClass( "ui-corner-right", value === this.options.max )
+ .width( percentage.toFixed(0) + "%" );
this.element.attr( "aria-valuenow", value );
}
});
$.extend( $.ui.progressbar, {
- version: "1.8.2"
+ version: "1.8.11"
});
})( jQuery );