aboutsummaryrefslogtreecommitdiffstats
path: root/ui/ui.progressbar.js
diff options
context:
space:
mode:
authorEduardo Lundgren <eduardolundgren@gmail.com>2008-08-08 05:56:57 +0000
committerEduardo Lundgren <eduardolundgren@gmail.com>2008-08-08 05:56:57 +0000
commitc0f55a95ac4680f6f28ace16d5d3ee3995cbd753 (patch)
tree679787683d163a74f9a2e193560dcb6f89c6d6fa /ui/ui.progressbar.js
parentb89a0ec293b7c9b1f50db4fc1815a283a7c791de (diff)
downloadjquery-ui-c0f55a95ac4680f6f28ace16d5d3ee3995cbd753.tar.gz
jquery-ui-c0f55a95ac4680f6f28ace16d5d3ee3995cbd753.zip
Source formatting
Diffstat (limited to 'ui/ui.progressbar.js')
-rw-r--r--ui/ui.progressbar.js54
1 files changed, 27 insertions, 27 deletions
diff --git a/ui/ui.progressbar.js b/ui/ui.progressbar.js
index bc4c10678..b9cd4458e 100644
--- a/ui/ui.progressbar.js
+++ b/ui/ui.progressbar.js
@@ -4,7 +4,7 @@
* Copyright (c) 2008 Eduardo Lundgren (braeker)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
- *
+ *
* http://docs.jquery.com/UI/ProgressBar
*
* Depends:
@@ -21,12 +21,12 @@ $.widget("ui.progressbar", {
$.extend(o, {
stepping: o.stepping > 100 ? 100 : o.stepping
});
-
+
$.extend(this, {
_step: 0,
rangeValue: 0,
threads: {},
-
+
wrapper: $('<div class="ui-progressbar-wrap"></div>'),
bar: $('<div class="ui-progressbar-bar ui-hidden"></div>').css({
width: '0px', overflow: 'hidden', zIndex: 100
@@ -37,15 +37,15 @@ $.widget("ui.progressbar", {
textBg: $('<div class="ui-progressbar-text ui-progressbar-text-back"></div>').html(text).css({
width: this.element.css('width')
})
-
+
});
-
+
this.wrapper
.append(this.bar.append(this.textElement), this.textBg)
.appendTo(this.element);
},
-
+
plugins: {},
ui: function(e) {
return {
@@ -62,7 +62,7 @@ $.widget("ui.progressbar", {
},
destroy: function() {
this.reset();
-
+
this.element
.removeClass("ui-progressbar ui-progressbar-disabled")
.removeData("progressbar").unbind(".progressbar")
@@ -79,24 +79,24 @@ $.widget("ui.progressbar", {
this.clearThreads();
},
start: function() {
-
+
if (this.disabled) return false;
this.inProgress = true;
-
+
var self = this, o = this.options, el = this.element;
this.clearThreads();
-
+
if (typeof o.wait == 'number' && !self.waitThread)
self.waitThread = setTimeout(function() {
clearInterval(self.waitThread);
self.waitThread = null;
}, o.wait);
-
+
var frames = Math.ceil(100/o.stepping) || 0, ms = o.duration/frames || 0,
-
+
render = function(step, t) {
//clearInterval(t);
-
+
self.progress(o.stepping * step);
// on end
if (step >= frames) {
@@ -109,16 +109,16 @@ $.widget("ui.progressbar", {
}
};
var from = this._step, _step = (this._step - (from - 1));
-
+
/*for(var step = from; step <= frames; step++) {
var interval = (step - (from - 1)) * ms;
this.threads[step] = setTimeout(render(step, this.threads[step]), interval);
}*/
-
+
this.threads[0] = setInterval(function() {
render(_step++);
}, ms);
-
+
this.propagate('start');
return false;
},
@@ -127,19 +127,19 @@ $.widget("ui.progressbar", {
this.threads = {};
},
stop: function() {
-
+
if (this.disabled) return false;
var o = this.options, self = this;
-
+
this.clearThreads();
this.propagate('stop');
-
+
this.inProgress = false;
return false;
-
+
},
reset: function() {
-
+
if (this.disabled) return false;
this._step = 0;
this.rangeValue = 0;
@@ -148,23 +148,23 @@ $.widget("ui.progressbar", {
this.progress(0);
this.bar.addClass('ui-hidden');
return false;
-
+
},
progress: function(range) {
-
+
var o = this.options, el = this.element, bar = this.bar;
if (this.disabled) return false;
-
+
range = parseInt(range, 10);
this.rangeValue = this._fixRange(range);
this.pixelRange = Math.round( ((this.rangeValue/100)||0) * (el.innerWidth() - (el.outerWidth() - el.innerWidth()) - (bar.outerWidth() - bar.innerWidth())) );
-
+
this.bar.removeClass('ui-hidden');
-
+
var css = { width: this.pixelRange + 'px' };
this.bar.css(css);
this.textElement.css(css);
-
+
if (!o.text && o.range) this.text(this.rangeValue + '%');
this.propagate('progress', this.rangeValue);
return false;