diff options
author | Alvin Li <liweitianux@gmail.com> | 2013-08-22 15:18:58 +0800 |
---|---|---|
committer | Alvin Li <liweitianux@gmail.com> | 2013-08-22 15:18:58 +0800 |
commit | 3f1d09f3b5b86157ccf9f47eef69a065be6153a4 (patch) | |
tree | 84d424db169cea7daff7dc2ed7e045de15ec86eb /97suifangqa/apps/indicator/static/plugins/jquery-ui/ui/jquery.ui.progressbar.js | |
parent | 3ef1e03e4273544cce177ce7fa0e0ab75eded990 (diff) | |
download | 97dev-3f1d09f3b5b86157ccf9f47eef69a065be6153a4.tar.bz2 |
* added latest full package of 'jquery-ui' plugin, v1.10.3;
* improved 'thickbox' plugin to use 'jquery-1.9.x';
* upgraded 'SheetDefault.html', 'NewDeleteIndex.html' and other pages
to use 'jquery-1.9.x';
* improved 'IndexDesc.html' to deal with the problem of no related
annotation found;
* 'indicator.tools.get_record()' added param 'number', and updated
the format of return data;
* added 'get_num_record()' and 'get_num_record_std()' to
'indicator.tools';
* improved 'indicator.views.ajax_get_card_data_chart()',
now can get data by 'num' or by 'date';
* improved 'indicator.views.ajax_get_card_data_table()',
to provide the needed data requested from 'detail_card';
* improved js function 'chart_getdata_draw()' in 'SheetDefault.html';
* 'card_chart.js': renamed 'redraw_chart()' to
'detail_chart_getdata_draw()', and updated to get data by type;
* updated 'table' of 'detail_card' in 'SheetDefault.html';
* improved js function 'get_card_data_table()' for providing and
displaying record data in 'detail_card' table.
TODO:
* add/delete/edit record data
Diffstat (limited to '97suifangqa/apps/indicator/static/plugins/jquery-ui/ui/jquery.ui.progressbar.js')
-rw-r--r-- | 97suifangqa/apps/indicator/static/plugins/jquery-ui/ui/jquery.ui.progressbar.js | 145 |
1 files changed, 145 insertions, 0 deletions
diff --git a/97suifangqa/apps/indicator/static/plugins/jquery-ui/ui/jquery.ui.progressbar.js b/97suifangqa/apps/indicator/static/plugins/jquery-ui/ui/jquery.ui.progressbar.js new file mode 100644 index 0000000..70d716e --- /dev/null +++ b/97suifangqa/apps/indicator/static/plugins/jquery-ui/ui/jquery.ui.progressbar.js @@ -0,0 +1,145 @@ +/*! + * jQuery UI Progressbar 1.10.3 + * http://jqueryui.com + * + * Copyright 2013 jQuery Foundation and other contributors + * Released under the MIT license. + * http://jquery.org/license + * + * http://api.jqueryui.com/progressbar/ + * + * Depends: + * jquery.ui.core.js + * jquery.ui.widget.js + */ +(function( $, undefined ) { + +$.widget( "ui.progressbar", { + version: "1.10.3", + options: { + max: 100, + value: 0, + + 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 + }); + + 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" ); + + this.valueDiv.remove(); + }, + + value: function( newValue ) { + if ( newValue === undefined ) { + return this.options.value; + } + + this.options.value = this._constrainedValue( newValue ); + this._refreshValue(); + }, + + _constrainedValue: function( newValue ) { + if ( newValue === undefined ) { + newValue = this.options.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 ) ); + }, + + _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 ); + } + + this._super( key, value ); + }, + + _percentage: function() { + return this.indeterminate ? 100 : 100 * ( this.options.value - this.min ) / ( this.options.max - this.min ); + }, + + _refreshValue: function() { + 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" ); + } + if ( value === this.options.max ) { + this._trigger( "complete" ); + } + } +}); + +})( jQuery ); |