123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- /*
- * jQuery UI Progressbar 1.7.2
- *
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
- *
- * http://docs.jquery.com/UI/Progressbar
- *
- * Depends:
- * ui.core.js
- */
- (function($) {
- $.widget("ui.progressbar", {
- _init: 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-valuenow": this._value()
- });
- 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");
- this.valueDiv.remove();
- $.widget.prototype.destroy.apply(this, arguments);
- },
- value: function(newValue) {
- if (newValue === undefined) {
- return this._value();
- }
-
- this._setData('value', newValue);
- return this;
- },
- _setData: function(key, value) {
- switch (key) {
- case 'value':
- this.options.value = value;
- this._refreshValue();
- this._trigger('change', null, {});
- break;
- }
- $.widget.prototype._setData.apply(this, arguments);
- },
- _value: function() {
- var val = this.options.value;
- if (val < this._valueMin()) val = this._valueMin();
- if (val > this._valueMax()) val = this._valueMax();
- return val;
- },
- _valueMin: function() {
- var valueMin = 0;
- return valueMin;
- },
- _valueMax: function() {
- var valueMax = 100;
- return valueMax;
- },
- _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);
- }
- });
- $.extend($.ui.progressbar, {
- version: "1.7.2",
- defaults: {
- value: 0
- }
- });
- })(jQuery);
|