aboutsummaryrefslogtreecommitdiffstats
path: root/themes/default/js/ui/jquery.ui.progressbar.js
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2013-02-18 21:18:40 +0000
committerrvelices <rv-github@modusoptimus.com>2013-02-18 21:18:40 +0000
commit74373ea7175bcf6be2732e6d59f037f79f88ca96 (patch)
treee8799eea7707f9aae6ba3ccb2aa7ce315f0be383 /themes/default/js/ui/jquery.ui.progressbar.js
parentf2da009c0f744c9197c652c5012323e69dd96308 (diff)
upgraded jquery ui from 1.9.0 to 1.10.1
git-svn-id: http://piwigo.org/svn/trunk@20824 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--themes/default/js/ui/jquery.ui.progressbar.js106
1 files changed, 73 insertions, 33 deletions
diff --git a/themes/default/js/ui/jquery.ui.progressbar.js b/themes/default/js/ui/jquery.ui.progressbar.js
index a9bd3f595..9c14cc4a6 100644
--- a/themes/default/js/ui/jquery.ui.progressbar.js
+++ b/themes/default/js/ui/jquery.ui.progressbar.js
@@ -1,8 +1,8 @@
/*!
- * jQuery UI Progressbar 1.9.0
+ * jQuery UI Progressbar 1.10.1
* http://jqueryui.com
*
- * Copyright 2012 jQuery Foundation and other contributors
+ * Copyright 2013 jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
@@ -15,28 +15,33 @@
(function( $, undefined ) {
$.widget( "ui.progressbar", {
- version: "1.9.0",
+ version: "1.10.1",
options: {
+ max: 100,
value: 0,
- max: 100
+
+ change: null,
+ complete: null
},
min: 0,
_create: function() {
+ // Constrain initial value
+ this.oldValue = this.options.value = this._constrainedValue();
+
this.element
.addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
.attr({
+ // Only set static values, aria-valuenow and aria-valuemax are
+ // set inside _refreshValue()
role: "progressbar",
- "aria-valuemin": this.min,
- "aria-valuemax": this.options.max,
- "aria-valuenow": this._value()
+ "aria-valuemin": this.min
});
this.valueDiv = $( "<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>" )
.appendTo( this.element );
- this.oldValue = this._value();
this._refreshValue();
},
@@ -53,52 +58,87 @@ $.widget( "ui.progressbar", {
value: function( newValue ) {
if ( newValue === undefined ) {
- return this._value();
+ return this.options.value;
}
- this._setOption( "value", newValue );
- return this;
+ this.options.value = this._constrainedValue( newValue );
+ this._refreshValue();
},
- _setOption: function( key, value ) {
- if ( key === "value" ) {
- this.options.value = value;
- this._refreshValue();
- if ( this._value() === this.options.max ) {
- this._trigger( "complete" );
- }
+ _constrainedValue: function( newValue ) {
+ if ( newValue === undefined ) {
+ newValue = this.options.value;
}
- this._super( key, value );
+ this.indeterminate = newValue === false;
+
+ // sanitize value
+ if ( typeof newValue !== "number" ) {
+ newValue = 0;
+ }
+
+ return this.indeterminate ? false :
+ Math.min( this.options.max, Math.max( this.min, newValue ) );
},
- _value: function() {
- var val = this.options.value;
- // normalize invalid value
- if ( typeof val !== "number" ) {
- val = 0;
+ _setOptions: function( options ) {
+ // Ensure "value" option is set after other values (like max)
+ var value = options.value;
+ delete options.value;
+
+ this._super( options );
+
+ this.options.value = this._constrainedValue( value );
+ this._refreshValue();
+ },
+
+ _setOption: function( key, value ) {
+ if ( key === "max" ) {
+ // Don't allow a max less than min
+ value = Math.max( this.min, value );
}
- return Math.min( this.options.max, Math.max( this.min, val ) );
+
+ this._super( key, value );
},
_percentage: function() {
- return 100 * this._value() / this.options.max;
+ return this.indeterminate ? 100 : 100 * ( this.options.value - this.min ) / ( this.options.max - this.min );
},
_refreshValue: function() {
- var value = this.value(),
+ var value = this.options.value,
percentage = this._percentage();
+ this.valueDiv
+ .toggle( this.indeterminate || value > this.min )
+ .toggleClass( "ui-corner-right", value === this.options.max )
+ .width( percentage.toFixed(0) + "%" );
+
+ this.element.toggleClass( "ui-progressbar-indeterminate", this.indeterminate );
+
+ if ( this.indeterminate ) {
+ this.element.removeAttr( "aria-valuenow" );
+ if ( !this.overlayDiv ) {
+ this.overlayDiv = $( "<div class='ui-progressbar-overlay'></div>" ).appendTo( this.valueDiv );
+ }
+ } else {
+ this.element.attr({
+ "aria-valuemax": this.options.max,
+ "aria-valuenow": value
+ });
+ if ( this.overlayDiv ) {
+ this.overlayDiv.remove();
+ this.overlayDiv = null;
+ }
+ }
+
if ( this.oldValue !== value ) {
this.oldValue = value;
this._trigger( "change" );
}
-
- this.valueDiv
- .toggle( value > this.min )
- .toggleClass( "ui-corner-right", value === this.options.max )
- .width( percentage.toFixed(0) + "%" );
- this.element.attr( "aria-valuenow", value );
+ if ( value === this.options.max ) {
+ this._trigger( "complete" );
+ }
}
});