diff options
Diffstat (limited to 'static/development-bundle/ui/ui.progressbar.js')
-rw-r--r-- | static/development-bundle/ui/ui.progressbar.js | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/static/development-bundle/ui/ui.progressbar.js b/static/development-bundle/ui/ui.progressbar.js new file mode 100644 index 0000000..30aac98 --- /dev/null +++ b/static/development-bundle/ui/ui.progressbar.js | |||
@@ -0,0 +1,116 @@ | |||
1 | /* | ||
2 | * jQuery UI Progressbar 1.7.2 | ||
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($) { | ||
14 | |||
15 | $.widget("ui.progressbar", { | ||
16 | |||
17 | _init: function() { | ||
18 | |||
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 | }); | ||
30 | |||
31 | this.valueDiv = $('<div class="ui-progressbar-value ui-widget-header ui-corner-left"></div>').appendTo(this.element); | ||
32 | |||
33 | this._refreshValue(); | ||
34 | |||
35 | }, | ||
36 | |||
37 | destroy: function() { | ||
38 | |||
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"); | ||
50 | |||
51 | this.valueDiv.remove(); | ||
52 | |||
53 | $.widget.prototype.destroy.apply(this, arguments); | ||
54 | |||
55 | }, | ||
56 | |||
57 | value: function(newValue) { | ||
58 | if (newValue === undefined) { | ||
59 | return this._value(); | ||
60 | } | ||
61 | |||
62 | this._setData('value', newValue); | ||
63 | return this; | ||
64 | }, | ||
65 | |||
66 | _setData: function(key, value) { | ||
67 | |||
68 | switch (key) { | ||
69 | case 'value': | ||
70 | this.options.value = value; | ||
71 | this._refreshValue(); | ||
72 | this._trigger('change', null, {}); | ||
73 | break; | ||
74 | } | ||
75 | |||
76 | $.widget.prototype._setData.apply(this, arguments); | ||
77 | |||
78 | }, | ||
79 | |||
80 | _value: function() { | ||
81 | |||
82 | var val = this.options.value; | ||
83 | if (val < this._valueMin()) val = this._valueMin(); | ||
84 | if (val > this._valueMax()) val = this._valueMax(); | ||
85 | |||
86 | return val; | ||
87 | |||
88 | }, | ||
89 | |||
90 | _valueMin: function() { | ||
91 | var valueMin = 0; | ||
92 | return valueMin; | ||
93 | }, | ||
94 | |||
95 | _valueMax: function() { | ||
96 | var valueMax = 100; | ||
97 | return valueMax; | ||
98 | }, | ||
99 | |||
100 | _refreshValue: function() { | ||
101 | var value = this.value(); | ||
102 | this.valueDiv[value == this._valueMax() ? 'addClass' : 'removeClass']("ui-corner-right"); | ||
103 | this.valueDiv.width(value + '%'); | ||
104 | this.element.attr("aria-valuenow", value); | ||
105 | } | ||
106 | |||
107 | }); | ||
108 | |||
109 | $.extend($.ui.progressbar, { | ||
110 | version: "1.7.2", | ||
111 | defaults: { | ||
112 | value: 0 | ||
113 | } | ||
114 | }); | ||
115 | |||
116 | })(jQuery); | ||