]> source.dussan.org Git - jquery-ui.git/commitdiff
Source formatting
authorEduardo Lundgren <eduardolundgren@gmail.com>
Fri, 8 Aug 2008 05:56:57 +0000 (05:56 +0000)
committerEduardo Lundgren <eduardolundgren@gmail.com>
Fri, 8 Aug 2008 05:56:57 +0000 (05:56 +0000)
ui/ui.progressbar.js

index bc4c10678847250becdaa697a51def26a3759594..b9cd4458e773c8b0dc104c0c8692150a9e7ea946 100644 (file)
@@ -4,7 +4,7 @@
  * Copyright (c) 2008 Eduardo Lundgren (braeker)\r
  * Dual licensed under the MIT (MIT-LICENSE.txt)\r
  * and GPL (GPL-LICENSE.txt) licenses.\r
- * \r
+ *\r
  * http://docs.jquery.com/UI/ProgressBar\r
  *\r
  * Depends:\r
@@ -21,12 +21,12 @@ $.widget("ui.progressbar", {
                $.extend(o, {\r
                        stepping: o.stepping > 100 ? 100 : o.stepping\r
                });\r
-               \r
+\r
                $.extend(this, {\r
                        _step: 0,\r
                        rangeValue: 0,\r
                        threads: {},\r
-                       \r
+\r
                        wrapper: $('<div class="ui-progressbar-wrap"></div>'),\r
                        bar: $('<div class="ui-progressbar-bar ui-hidden"></div>').css({\r
                                width: '0px', overflow: 'hidden', zIndex: 100\r
@@ -37,15 +37,15 @@ $.widget("ui.progressbar", {
                        textBg: $('<div class="ui-progressbar-text ui-progressbar-text-back"></div>').html(text).css({\r
                                        width: this.element.css('width')\r
                        })\r
-                       \r
+\r
                });\r
-               \r
+\r
                this.wrapper\r
                        .append(this.bar.append(this.textElement), this.textBg)\r
                        .appendTo(this.element);\r
 \r
        },\r
-       \r
+\r
        plugins: {},\r
        ui: function(e) {\r
                return {\r
@@ -62,7 +62,7 @@ $.widget("ui.progressbar", {
        },\r
        destroy: function() {\r
                this.reset();\r
-               \r
+\r
                this.element\r
                        .removeClass("ui-progressbar ui-progressbar-disabled")\r
                        .removeData("progressbar").unbind(".progressbar")\r
@@ -79,24 +79,24 @@ $.widget("ui.progressbar", {
                this.clearThreads();\r
        },\r
        start: function() {\r
-               \r
+\r
                if (this.disabled) return false;\r
                this.inProgress = true;\r
-               \r
+\r
                var self = this, o = this.options, el = this.element;\r
                this.clearThreads();\r
-               \r
+\r
                if (typeof o.wait == 'number' && !self.waitThread)\r
                        self.waitThread = setTimeout(function() {\r
                                clearInterval(self.waitThread);\r
                                self.waitThread = null;\r
                        }, o.wait);\r
-               \r
+\r
                var frames = Math.ceil(100/o.stepping) || 0, ms = o.duration/frames || 0,\r
-               \r
+\r
                render = function(step, t) {\r
                        //clearInterval(t);\r
-                       \r
+\r
                        self.progress(o.stepping * step);\r
                        // on end\r
                        if (step >= frames) {\r
@@ -109,16 +109,16 @@ $.widget("ui.progressbar", {
                        }\r
                };\r
                var from = this._step, _step = (this._step - (from - 1));\r
-               \r
+\r
                /*for(var step = from; step <= frames; step++) {\r
                        var interval = (step - (from - 1)) * ms;\r
                        this.threads[step] = setTimeout(render(step, this.threads[step]), interval);\r
                }*/\r
-               \r
+\r
                this.threads[0] = setInterval(function() {\r
                        render(_step++);\r
                }, ms);\r
-               \r
+\r
                this.propagate('start');\r
                return false;\r
        },\r
@@ -127,19 +127,19 @@ $.widget("ui.progressbar", {
                this.threads = {};\r
        },\r
        stop: function() {\r
-               \r
+\r
                if (this.disabled) return false;\r
                var o = this.options, self = this;\r
-               \r
+\r
                this.clearThreads();\r
                this.propagate('stop');\r
-               \r
+\r
                this.inProgress = false;\r
                return false;\r
-               \r
+\r
        },\r
        reset: function() {\r
-               \r
+\r
                if (this.disabled) return false;\r
                this._step = 0;\r
                this.rangeValue = 0;\r
@@ -148,23 +148,23 @@ $.widget("ui.progressbar", {
                this.progress(0);\r
                this.bar.addClass('ui-hidden');\r
                return false;\r
-               \r
+\r
        },\r
        progress: function(range) {\r
-               \r
+\r
                var o = this.options, el = this.element, bar = this.bar;\r
                if (this.disabled) return false;\r
-               \r
+\r
                range = parseInt(range, 10);\r
                this.rangeValue = this._fixRange(range);\r
                this.pixelRange = Math.round( ((this.rangeValue/100)||0) * (el.innerWidth() - (el.outerWidth() - el.innerWidth()) - (bar.outerWidth() - bar.innerWidth())) );\r
-               \r
+\r
                this.bar.removeClass('ui-hidden');\r
-               \r
+\r
                var css = { width: this.pixelRange + 'px' };\r
                this.bar.css(css);\r
                this.textElement.css(css);\r
-               \r
+\r
                if (!o.text && o.range) this.text(this.rangeValue + '%');\r
                this.propagate('progress', this.rangeValue);\r
                return false;\r