source: main/trunk/greenstone3/web/interfaces/oran/js/jquery-ui-1.8rc1/ui/jquery.ui.progressbar.js@ 24245

Last change on this file since 24245 was 24245, checked in by sjb48, 13 years ago

Oran code for supporting format changes to document.

  • Property svn:executable set to *
File size: 2.4 KB
Line 
1/*
2 * jQuery UI Progressbar 1.8rc1
3 *
4 * Copyright (c) 2010 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 * jquery.ui.core.js
12 * jquery.ui.widget.js
13 */
14(function($) {
15
16$.widget("ui.progressbar", {
17 options: {
18 value: 0
19 },
20 _create: function() {
21
22 this.element
23 .addClass("ui-progressbar"
24 + " ui-widget"
25 + " ui-widget-content"
26 + " ui-corner-all")
27 .attr({
28 role: "progressbar",
29 "aria-valuemin": this._valueMin(),
30 "aria-valuemax": this._valueMax(),
31 "aria-valuenow": this._value()
32 });
33
34 this.valueDiv = $('<div class="ui-progressbar-value ui-widget-header ui-corner-left"></div>').appendTo(this.element);
35
36 this._refreshValue();
37
38 },
39
40 destroy: function() {
41
42 this.element
43 .removeClass("ui-progressbar"
44 + " ui-widget"
45 + " ui-widget-content"
46 + " ui-corner-all")
47 .removeAttr("role")
48 .removeAttr("aria-valuemin")
49 .removeAttr("aria-valuemax")
50 .removeAttr("aria-valuenow")
51 .removeData("progressbar")
52 .unbind(".progressbar");
53
54 this.valueDiv.remove();
55
56 $.Widget.prototype.destroy.apply(this, arguments);
57
58 return this;
59 },
60
61 value: function(newValue) {
62 if (newValue === undefined) {
63 return this._value();
64 }
65
66 this._setOption('value', newValue);
67 return this;
68 },
69
70 _setOption: function(key, value) {
71
72 switch (key) {
73 case 'value':
74 this.options.value = value;
75 this._refreshValue();
76 this._trigger('change', null, {});
77 break;
78 }
79
80 $.Widget.prototype._setOption.apply(this, arguments);
81
82 },
83
84 _value: function() {
85 var val = this.options.value;
86 // normalize invalid value
87 if (typeof val != "number")
88 val = 0;
89 if (val < this._valueMin()) val = this._valueMin();
90 if (val > this._valueMax()) val = this._valueMax();
91
92 return val;
93
94 },
95
96 _valueMin: function() {
97 var valueMin = 0;
98 return valueMin;
99 },
100
101 _valueMax: function() {
102 var valueMax = 100;
103 return valueMax;
104 },
105
106 _refreshValue: function() {
107 var value = this.value();
108 this.valueDiv[value == this._valueMax() ? 'addClass' : 'removeClass']("ui-corner-right");
109 this.valueDiv.width(value + '%');
110 this.element.attr("aria-valuenow", value);
111 }
112
113});
114
115$.extend($.ui.progressbar, {
116 version: "1.8rc1"
117});
118
119})(jQuery);
Note: See TracBrowser for help on using the repository browser.