Bug 20489 Configure illegal file characters https://bugzilla.wikimedia.org/show_bug...
[mediawiki.git] / js2 / mwEmbed / jquery / jquery.ui / ui / ui.progressbar.js
blobe69b2256e47a7421303fc5b704998f21b72b7458
1 /*
2  * jQuery UI Progressbar 1.7.1
3  *
4  * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
5  * Dual licensed under the MIT (MIT-LICENSE.txt)
6  * and GPL (GPL-LICENSE.txt) licenses.
7  *
8  * http://docs.jquery.com/UI/Progressbar
9  *
10  * Depends:
11  *   ui.core.js
12  */
13 (function($) {
15 $.widget("ui.progressbar", {
17         _init: function() {
19                 this.element
20                         .addClass("ui-progressbar"
21                                 + " ui-widget"
22                                 + " ui-widget-content"
23                                 + " ui-corner-all")
24                         .attr({
25                                 role: "progressbar",
26                                 "aria-valuemin": this._valueMin(),
27                                 "aria-valuemax": this._valueMax(),
28                                 "aria-valuenow": this._value()
29                         });
31                 this.valueDiv = $('<div class="ui-progressbar-value ui-widget-header ui-corner-left"></div>').appendTo(this.element);
33                 this._refreshValue();
35         },
37         destroy: function() {
39                 this.element
40                         .removeClass("ui-progressbar"
41                                 + " ui-widget"
42                                 + " ui-widget-content"
43                                 + " ui-corner-all")
44                         .removeAttr("role")
45                         .removeAttr("aria-valuemin")
46                         .removeAttr("aria-valuemax")
47                         .removeAttr("aria-valuenow")
48                         .removeData("progressbar")
49                         .unbind(".progressbar");
51                 this.valueDiv.remove();
53                 $.widget.prototype.destroy.apply(this, arguments);
55         },
57         value: function(newValue) {
58                 arguments.length && this._setData("value", newValue);
59                 return this._value();
60         },
62         _setData: function(key, value) {
64                 switch (key) {
65                         case 'value':
66                                 this.options.value = value;
67                                 this._refreshValue();
68                                 this._trigger('change', null, {});
69                                 break;
70                 }
72                 $.widget.prototype._setData.apply(this, arguments);
74         },
76         _value: function() {
78                 var val = this.options.value;
79                 if (val < this._valueMin()) val = this._valueMin();
80                 if (val > this._valueMax()) val = this._valueMax();
82                 return val;
84         },
86         _valueMin: function() {
87                 var valueMin = 0;
88                 return valueMin;
89         },
91         _valueMax: function() {
92                 var valueMax = 100;
93                 return valueMax;
94         },
96         _refreshValue: function() {
97                 var value = this.value();
98                 this.valueDiv[value == this._valueMax() ? 'addClass' : 'removeClass']("ui-corner-right");
99                 this.valueDiv.width(value + '%');
100                 this.element.attr("aria-valuenow", value);
101         }
105 $.extend($.ui.progressbar, {
106         version: "1.7.1",
107         defaults: {
108                 value: 0
109         }
112 })(jQuery);