/*
- * Autocomplete - jQuery plugin 1.0.1
+ * jQuery UI Autocomplete
*
- * Copyright (c) 2007 Dylan Verheul, Dan G. Switzer, Anjesh Tuladhar, Jörn Zaefferer
- *
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
- *
- * Revision: $Id: jquery.autocomplete.js 5698 2008-05-27 13:53:30Z paul.bakaus $
+ * Copyright (c) 2007, 2008 Dylan Verheul, Dan G. Switzer, Anjesh Tuladhar, Jörn Zaefferer
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * http://docs.jquery.com/UI/Autocomplete
*
+ * Depends:
+ * ui.core.js
*/
-
-;(function($) {
-
+(function($) {
$.widget("ui.autocomplete", {
});
-
$.Autocompleter = function(input, options) {
var KEY = {
field.focus();
};
-})(jQuery);
\ No newline at end of file
+})(jQuery);
*\r
* http://docs.jquery.com/UI/History\r
*\r
- * Revision: $Id: ui.history.js 5218 2008-04-09 20:08:24Z rdworth $\r
+ * Depends:\r
+ * ui.core.js\r
*/\r
-;(function($) {\r
+(function($) {\r
\r
- // if the UI scope is not availalable, add it\r
- $.ui = $.ui || {}; \r
+// TODO lazy loading singleton\r
+$.ui.hmanager = new function() {\r
+ var states = {}, def = function() {};\r
\r
- // TODO lazy loading singleton\r
- $.ui.hmanager = new function() {\r
- var states = {}, def = function() {};\r
- \r
- var $window = $(window), hash = location.hash; \r
- \r
- function getState() {\r
- return hash.replace('#', '');\r
- } \r
- \r
- var iframe;\r
- // var keepHistoryIn = iframe || window;\r
- \r
- return {\r
+ var $window = $(window), hash = location.hash; \r
\r
- enable: function() {\r
- \r
- if ($.browser.msie && parseInt($.browser.version) < 8) {\r
- $(function() {\r
- // create hidden iframe for hash change tracking\r
- iframe = $('<iframe id="ui-history-iframe" style="display: none;"></iframe>').\r
- prependTo(document.body)[0];\r
- \r
- // create initial history entry\r
- iframe.contentWindow.document.open();\r
- iframe.contentWindow.document.close();\r
- \r
- if (getState())\r
- iframe.contentWindow.document.location.hash = getState();\r
- \r
- });\r
- }\r
- \r
- $window.bind('hashchange', function(e) {\r
- // Prevent IE 8 from fireing an event twice,\r
- // one from true event, one from trigger...\r
- if (!iframe && hash == location.hash || iframe && hash == iframe.contentWindow.document.location.hash)\r
- return false;\r
+ function getState() {\r
+ return hash.replace('#', '');\r
+ } \r
+ \r
+ var iframe;\r
+ // var keepHistoryIn = iframe || window;\r
+ \r
+ return {\r
\r
- if ($.browser.msie && parseInt($.browser.version) < 8) {\r
- hash = iframe.contentWindow.document.location.hash;\r
- }\r
- else\r
- hash = location.hash;\r
+ enable: function() {\r
+ \r
+ if ($.browser.msie && parseInt($.browser.version) < 8) {\r
+ $(function() {\r
+ // create hidden iframe for hash change tracking\r
+ iframe = $('<iframe id="ui-history-iframe" style="display: none;"></iframe>').\r
+ prependTo(document.body)[0];\r
+ \r
+ // create initial history entry\r
+ iframe.contentWindow.document.open();\r
+ iframe.contentWindow.document.close();\r
\r
if (getState())\r
- states[getState()]();\r
- else\r
- // TODO invoke default\r
- ;\r
+ iframe.contentWindow.document.location.hash = getState();\r
+ \r
});\r
- \r
- if (!($.browser.msie && parseInt($.browser.version) >= 8)) {\r
- setInterval(\r
- ($.browser.msie ?\r
- function() {\r
- if (hash != iframe.contentWindow.document.location.hash)\r
- $window.trigger('hashchange');\r
- } : \r
- function() {\r
- if (hash != location.hash)\r
- $window.trigger('hashchange');\r
- else\r
- // Do the history.length check hack for Safari 2\r
- ;\r
- }\r
- )\r
- , 200\r
- );\r
+ }\r
+ \r
+ $window.bind('hashchange', function(e) {\r
+ // Prevent IE 8 from fireing an event twice,\r
+ // one from true event, one from trigger...\r
+ if (!iframe && hash == location.hash || iframe && hash == iframe.contentWindow.document.location.hash)\r
+ return false;\r
+\r
+ if ($.browser.msie && parseInt($.browser.version) < 8) {\r
+ hash = iframe.contentWindow.document.location.hash;\r
}\r
+ else\r
+ hash = location.hash;\r
\r
- },\r
-\r
- add: function(state, handler) {\r
- states[state] = handler;\r
- },\r
+ if (getState())\r
+ states[getState()]();\r
+ else\r
+ // TODO invoke default\r
+ ;\r
+ });\r
\r
- go: function(state) {\r
- if (state) {\r
- if ($.browser.msie && parseInt($.browser.version) < 8) {\r
- iframe.contentWindow.document.open();\r
- iframe.contentWindow.document.close();\r
- iframe.contentWindow.document.location.hash = state; \r
- }\r
- location.hash = state;\r
- $window.trigger('hashchange');\r
- }\r
- else \r
- console.log('TODO do default state');\r
+ if (!($.browser.msie && parseInt($.browser.version) >= 8)) {\r
+ setInterval(\r
+ ($.browser.msie ?\r
+ function() {\r
+ if (hash != iframe.contentWindow.document.location.hash)\r
+ $window.trigger('hashchange');\r
+ } : \r
+ function() {\r
+ if (hash != location.hash)\r
+ $window.trigger('hashchange');\r
+ else\r
+ // Do the history.length check hack for Safari 2\r
+ ;\r
+ }\r
+ )\r
+ , 200\r
+ );\r
}\r
+ },\r
\r
- }\r
+ add: function(state, handler) {\r
+ states[state] = handler;\r
+ },\r
\r
- };\r
+ go: function(state) {\r
+ if (state) {\r
+ if ($.browser.msie && parseInt($.browser.version) < 8) {\r
+ iframe.contentWindow.document.open();\r
+ iframe.contentWindow.document.close();\r
+ iframe.contentWindow.document.location.hash = state; \r
+ }\r
+ location.hash = state;\r
+ $window.trigger('hashchange');\r
+ }\r
+ else \r
+ console.log('TODO do default state');\r
+ }\r
+ }\r
+};\r
+\r
+$.ui.history = function() { \r
+ var args = Array.prototype.slice.call(arguments, 1);\r
+ $.ui.hmanager[arguments[0]].apply($.ui.hmanager, args);\r
+};\r
\r
- $.ui.history = function() { \r
- var args = Array.prototype.slice.call(arguments, 1);\r
- $.ui.hmanager[arguments[0]].apply($.ui.hmanager, args);\r
- };\r
- \r
})(jQuery);\r
+/*\r
+ * jQuery UI Magnifier\r
+ *\r
+ * Copyright (c) 2008 jQuery\r
+ * Dual licensed under the MIT (MIT-LICENSE.txt)\r
+ * and GPL (GPL-LICENSE.txt) licenses.\r
+ *\r
+ * http://docs.jquery.com/UI/Magnifier\r
+ *\r
+ * Depends:\r
+ * ui.core.js\r
+ */\r
(function($) {\r
\r
- $.widget("ui.magnifier", {\r
- init: function() {\r
+$.widget("ui.magnifier", {\r
+ init: function() {\r
\r
- var self = this, o = this.options;\r
- this.items = [];\r
- this.element.addClass("ui-magnifier");\r
- if(!(/^(r|a)/).test(this.element.css("position"))) this.element.css("position", "relative");\r
- \r
- this.pp = this.element.offset();\r
- \r
- $(o.items, this.element).each(function() {\r
+ var self = this, o = this.options;\r
+ this.items = [];\r
+ this.element.addClass("ui-magnifier");\r
+ if(!(/^(r|a)/).test(this.element.css("position"))) this.element.css("position", "relative");\r
+ \r
+ this.pp = this.element.offset();\r
+ \r
+ $(o.items, this.element).each(function() {\r
\r
- self.items.push([\r
- this,\r
- $(this).offset(),\r
- [$(this).width(),$(this).height()],\r
- (o.overlap ? $(this).position() : null)\r
- ]);\r
+ self.items.push([\r
+ this,\r
+ $(this).offset(),\r
+ [$(this).width(),$(this).height()],\r
+ (o.overlap ? $(this).position() : null)\r
+ ]);\r
\r
- if(o.opacity)\r
- $(this).css('opacity', o.opacity.min);\r
+ if(o.opacity)\r
+ $(this).css('opacity', o.opacity.min);\r
\r
+ });\r
+ \r
+ if(o.overlap) {\r
+ for(var i=0;i<this.items.length;i++) {\r
+ //Absolutize\r
+ $(this.items[i][0]).css({\r
+ position: "absolute",\r
+ top: this.items[i][3].top,\r
+ left: this.items[i][3].left\r
+ });\r
+ };\r
+ }\r
+ \r
+ this.identifier = ++$.ui.magnifier.counter;\r
+ $(document).bind("mousemove.magnifier"+this.identifier, function(e) {\r
+ if(!self.disabled) self.magnify.apply(self, [e]);\r
+ });\r
+ \r
+ if(o.click) {\r
+ this.element.bind('click.magnifier', function(e) {\r
+ if(!self.disabled) o.click.apply(this, [e, { options: self.options, current: self.current[0], currentOffset: self.current[1] }]);\r
});\r
+ }\r
+\r
+ },\r
+ \r
+ \r
+ destroy: function() {\r
+ this.reset();\r
+ this.element\r
+ .removeClass("ui-magnifier")\r
+ .removeClass("ui-magnifier-disabled")\r
+ .unbind(".magnifier");\r
+ $(document).unbind("mousemove.magnifier"+this.identifier);\r
+ },\r
+ disable: function() {\r
+ this.reset();\r
+ this.element.addClass("ui-magnifier-disabled");\r
+ this.options.disabled = true;\r
+ },\r
+ reset: function(e) {\r
\r
- if(o.overlap) {\r
- for(var i=0;i<this.items.length;i++) {\r
- //Absolutize\r
- $(this.items[i][0]).css({\r
- position: "absolute",\r
- top: this.items[i][3].top,\r
- left: this.items[i][3].left\r
- });\r
- };\r
- }\r
+ var o = this.options, c, distance = 1;\r
+ \r
+ for(var i=0; i < this.items.length; i++) {\r
+\r
+ c = this.items[i];\r
\r
- this.identifier = ++$.ui.magnifier.counter;\r
- $(document).bind("mousemove.magnifier"+this.identifier, function(e) {\r
- if(!self.disabled) self.magnify.apply(self, [e]);\r
+ $(c[0]).css({\r
+ width: c[2][0],\r
+ height: c[2][1],\r
+ top: (c[3] ? c[3].top : 0),\r
+ left: (c[3] ? c[3].left : 0)\r
});\r
\r
- if(o.click) {\r
- this.element.bind('click.magnifier', function(e) {\r
- if(!self.disabled) o.click.apply(this, [e, { options: self.options, current: self.current[0], currentOffset: self.current[1] }]);\r
- });\r
- }\r
+ if(o.opacity)\r
+ $(c[0]).css('opacity', o.opacity.min);\r
+ \r
+ if(o.zIndex)\r
+ $(c[0]).css("z-index", "");\r
+ \r
+ }\r
\r
- },\r
- \r
+ },\r
+ magnify: function(e) {\r
\r
- destroy: function() {\r
- this.reset();\r
- this.element\r
- .removeClass("ui-magnifier")\r
- .removeClass("ui-magnifier-disabled")\r
- .unbind(".magnifier");\r
- $(document).unbind("mousemove.magnifier"+this.identifier);\r
- },\r
- disable: function() {\r
- this.reset();\r
- this.element.addClass("ui-magnifier-disabled");\r
- this.options.disabled = true;\r
- },\r
- reset: function(e) {\r
+ var p = [e.pageX,e.pageY], o = this.options, c, distance = 1;\r
+ this.current = this.items[0];\r
+\r
+ //Compute the parents distance, because we don't need to fire anything if we are not near the parent\r
+ var overlap = ((p[0] > this.pp.left-o.distance && p[0] < this.pp.left + this.element[0].offsetWidth + o.distance) && (p[1] > this.pp.top-o.distance && p[1] < this.pp.top + this.element[0].offsetHeight + o.distance));\r
+ if(!overlap) return false;\r
\r
- var o = this.options, c, distance = 1;\r
+ for(var i=0;i<this.items.length;i++) {\r
\r
- for(var i=0; i < this.items.length; i++) {\r
- \r
- c = this.items[i];\r
+ c = this.items[i];\r
+ \r
+ var olddistance = distance;\r
+ if(!o.axis) {\r
+ distance = Math.sqrt(\r
+ Math.pow(p[0] - ((c[3] ? this.pp.left : c[1].left) + parseInt(c[0].style.left,10)) - (c[0].offsetWidth/2), 2)\r
+ + Math.pow(p[1] - ((c[3] ? this.pp.top : c[1].top ) + parseInt(c[0].style.top,10)) - (c[0].offsetHeight/2), 2)\r
+ );\r
+ } else {\r
+ if(o.axis == "y") {\r
+ distance = Math.abs(p[1] - ((c[3] ? this.pp.top : c[1].top ) + parseInt(c[0].style.top,10)) - (c[0].offsetHeight/2));\r
+ } else {\r
+ distance = Math.abs(p[0] - ((c[3] ? this.pp.left : c[1].left) + parseInt(c[0].style.left,10)) - (c[0].offsetWidth/2));\r
+ } \r
+ }\r
+ \r
+ if(distance < o.distance) {\r
+\r
+ this.current = distance < olddistance ? this.items[i] : this.current;\r
+ \r
+ if(!o.axis || o.axis != "y") {\r
+ $(c[0]).css({\r
+ width: c[2][0]+ (c[2][0] * (o.magnification-1)) - (((distance/o.distance)*c[2][0]) * (o.magnification-1)),\r
+ left: (c[3] ? (c[3].left + o.verticalLine * ((c[2][1] * (o.magnification-1)) - (((distance/o.distance)*c[2][1]) * (o.magnification-1)))) : 0)\r
+ });\r
+ }\r
+ \r
+ if(!o.axis || o.axis != "x") {\r
+ $(c[0]).css({\r
+ height: c[2][1]+ (c[2][1] * (o.magnification-1)) - (((distance/o.distance)*c[2][1]) * (o.magnification-1)),\r
+ top: (c[3] ? c[3].top : 0) + (o.baseline-0.5) * ((c[2][0] * (o.magnification-1)) - (((distance/o.distance)*c[2][0]) * (o.magnification-1)))\r
+ }); \r
+ }\r
+ \r
+ if(o.opacity)\r
+ $(c[0]).css('opacity', o.opacity.max-(distance/o.distance) < o.opacity.min ? o.opacity.min : o.opacity.max-(distance/o.distance));\r
+ \r
+ } else {\r
\r
$(c[0]).css({\r
width: c[2][0],\r
\r
if(o.opacity)\r
$(c[0]).css('opacity', o.opacity.min);\r
- \r
- if(o.zIndex)\r
- $(c[0]).css("z-index", "");\r
- \r
+ \r
}\r
-\r
- },\r
- magnify: function(e) {\r
\r
- var p = [e.pageX,e.pageY], o = this.options, c, distance = 1;\r
- this.current = this.items[0];\r
- \r
- //Compute the parents distance, because we don't need to fire anything if we are not near the parent\r
- var overlap = ((p[0] > this.pp.left-o.distance && p[0] < this.pp.left + this.element[0].offsetWidth + o.distance) && (p[1] > this.pp.top-o.distance && p[1] < this.pp.top + this.element[0].offsetHeight + o.distance));\r
- if(!overlap) return false;\r
- \r
- for(var i=0;i<this.items.length;i++) {\r
- \r
- c = this.items[i];\r
- \r
- var olddistance = distance;\r
- if(!o.axis) {\r
- distance = Math.sqrt(\r
- Math.pow(p[0] - ((c[3] ? this.pp.left : c[1].left) + parseInt(c[0].style.left,10)) - (c[0].offsetWidth/2), 2)\r
- + Math.pow(p[1] - ((c[3] ? this.pp.top : c[1].top ) + parseInt(c[0].style.top,10)) - (c[0].offsetHeight/2), 2)\r
- );\r
- } else {\r
- if(o.axis == "y") {\r
- distance = Math.abs(p[1] - ((c[3] ? this.pp.top : c[1].top ) + parseInt(c[0].style.top,10)) - (c[0].offsetHeight/2));\r
- } else {\r
- distance = Math.abs(p[0] - ((c[3] ? this.pp.left : c[1].left) + parseInt(c[0].style.left,10)) - (c[0].offsetWidth/2));\r
- } \r
- }\r
- \r
- if(distance < o.distance) {\r
- \r
- this.current = distance < olddistance ? this.items[i] : this.current;\r
- \r
- if(!o.axis || o.axis != "y") {\r
- $(c[0]).css({\r
- width: c[2][0]+ (c[2][0] * (o.magnification-1)) - (((distance/o.distance)*c[2][0]) * (o.magnification-1)),\r
- left: (c[3] ? (c[3].left + o.verticalLine * ((c[2][1] * (o.magnification-1)) - (((distance/o.distance)*c[2][1]) * (o.magnification-1)))) : 0)\r
- });\r
- }\r
- \r
- if(!o.axis || o.axis != "x") {\r
- $(c[0]).css({\r
- height: c[2][1]+ (c[2][1] * (o.magnification-1)) - (((distance/o.distance)*c[2][1]) * (o.magnification-1)),\r
- top: (c[3] ? c[3].top : 0) + (o.baseline-0.5) * ((c[2][0] * (o.magnification-1)) - (((distance/o.distance)*c[2][0]) * (o.magnification-1)))\r
- }); \r
- }\r
- \r
- if(o.opacity)\r
- $(c[0]).css('opacity', o.opacity.max-(distance/o.distance) < o.opacity.min ? o.opacity.min : o.opacity.max-(distance/o.distance));\r
- \r
- } else {\r
- \r
- $(c[0]).css({\r
- width: c[2][0],\r
- height: c[2][1],\r
- top: (c[3] ? c[3].top : 0),\r
- left: (c[3] ? c[3].left : 0)\r
- });\r
- \r
- if(o.opacity)\r
- $(c[0]).css('opacity', o.opacity.min);\r
- \r
- }\r
- \r
- if(o.zIndex)\r
- $(c[0]).css("z-index", "");\r
- \r
- }\r
- \r
- if(this.options.zIndex)\r
- $(this.current[0]).css("z-index", this.options.zIndex);\r
- \r
- } \r
+ if(o.zIndex)\r
+ $(c[0]).css("z-index", "");\r
+\r
+ }\r
\r
+ if(this.options.zIndex)\r
+ $(this.current[0]).css("z-index", this.options.zIndex);\r
\r
- });\r
+ } \r
+ \r
\r
- $.extend($.ui.magnifier, {\r
- counter: 0,\r
- defaults: {\r
- distance: 150,\r
- magnification: 2,\r
- baseline: 0,\r
- verticalLine: -0.5,\r
- items: "> *"\r
- } \r
- });\r
+});\r
+\r
+$.extend($.ui.magnifier, {\r
+ counter: 0,\r
+ defaults: {\r
+ distance: 150,\r
+ magnification: 2,\r
+ baseline: 0,\r
+ verticalLine: -0.5,\r
+ items: "> *"\r
+ } \r
+});\r
\r
})(jQuery);\r
* http://docs.jquery.com/UI/ProgressBar\r
*\r
* Depends:\r
- * ui.base.js\r
- *\r
- * Revision: $Id: ui.progressbar.js 5196 2008-04-04 12:52:32Z braeker $\r
+ * ui.core.js\r
*/\r
-;(function($) {\r
+(function($) {\r
\r
- $.widget("ui.progressbar", {\r
- init: function() {\r
+$.widget("ui.progressbar", {\r
+ init: function() {\r
\r
- var self = this, o = this.options, text = o.text ? o.text : (o.range ? '0%' : '');;\r
- this.element.addClass("ui-progressbar");\r
+ var self = this, o = this.options, text = o.text ? o.text : (o.range ? '0%' : '');;\r
+ this.element.addClass("ui-progressbar");\r
\r
- $.extend(o, {\r
- stepping: o.stepping > 100 ? 100 : o.stepping\r
- });\r
- \r
- $.extend(this, {\r
- _step: 0,\r
- rangeValue: 0,\r
- threads: {},\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
- }),\r
- textElement: $("<div class='ui-progressbar-text'></div>").html(text).css({\r
- width: '0px', overflow: 'hidden'\r
- }),\r
- 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
- this.wrapper\r
- .append(this.bar.append(this.textElement), this.textBg)\r
- .appendTo(this.element);\r
+ $.extend(o, {\r
+ stepping: o.stepping > 100 ? 100 : o.stepping\r
+ });\r
+ \r
+ $.extend(this, {\r
+ _step: 0,\r
+ rangeValue: 0,\r
+ threads: {},\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
+ }),\r
+ textElement: $("<div class='ui-progressbar-text'></div>").html(text).css({\r
+ width: '0px', overflow: 'hidden'\r
+ }),\r
+ 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
+ this.wrapper\r
+ .append(this.bar.append(this.textElement), this.textBg)\r
+ .appendTo(this.element);\r
\r
- },\r
- \r
- plugins: {},\r
- ui: function(e) {\r
- return {\r
- instance: this,\r
- options: this.options,\r
- step: this._step,\r
- rangeValue: this.rangeValue,\r
- pixelRange: this.pixelRange\r
- };\r
- },\r
- propagate: function(n,e) {\r
- $.ui.plugin.call(this, n, [e, this.ui()]);\r
- this.element.triggerHandler(n == "progressbar" ? n : ["progressbar", n].join(""), [e, this.ui()], this.options[n]);\r
- },\r
- destroy: function() {\r
- this.reset();\r
- \r
- this.element\r
- .removeClass("ui-progressbar ui-progressbar-disabled")\r
- .removeData("progressbar").unbind(".progressbar")\r
- .find('.ui-progressbar-wrap').remove();\r
- },\r
- enable: function() {\r
- this.element.removeClass("ui-progressbar-disabled");\r
- this.disabled = false;\r
- if(this.inProgress) this.start();\r
- },\r
- disable: function() {\r
- this.element.addClass("ui-progressbar-disabled");\r
- this.disabled = true;\r
- this.clearThreads();\r
- },\r
- start: function() {\r
- \r
- if (this.disabled) return false;\r
- this.inProgress = true;\r
- \r
- var self = this, o = this.options, el = this.element;\r
- this.clearThreads();\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
- var frames = Math.ceil(100/o.stepping) || 0, ms = o.duration/frames || 0,\r
+ },\r
+ \r
+ plugins: {},\r
+ ui: function(e) {\r
+ return {\r
+ instance: this,\r
+ options: this.options,\r
+ step: this._step,\r
+ rangeValue: this.rangeValue,\r
+ pixelRange: this.pixelRange\r
+ };\r
+ },\r
+ propagate: function(n,e) {\r
+ $.ui.plugin.call(this, n, [e, this.ui()]);\r
+ this.element.triggerHandler(n == "progressbar" ? n : ["progressbar", n].join(""), [e, this.ui()], this.options[n]);\r
+ },\r
+ destroy: function() {\r
+ this.reset();\r
+ \r
+ this.element\r
+ .removeClass("ui-progressbar ui-progressbar-disabled")\r
+ .removeData("progressbar").unbind(".progressbar")\r
+ .find('.ui-progressbar-wrap').remove();\r
+ },\r
+ enable: function() {\r
+ this.element.removeClass("ui-progressbar-disabled");\r
+ this.disabled = false;\r
+ if(this.inProgress) this.start();\r
+ },\r
+ disable: function() {\r
+ this.element.addClass("ui-progressbar-disabled");\r
+ this.disabled = true;\r
+ this.clearThreads();\r
+ },\r
+ start: function() {\r
+ \r
+ if (this.disabled) return false;\r
+ this.inProgress = true;\r
+ \r
+ var self = this, o = this.options, el = this.element;\r
+ this.clearThreads();\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
+ var frames = Math.ceil(100/o.stepping) || 0, ms = o.duration/frames || 0,\r
+ \r
+ render = function(step, t) {\r
+ //clearInterval(t);\r
\r
- render = function(step, t) {\r
- //clearInterval(t);\r
- \r
- self.progress(o.stepping * step);\r
- // on end\r
- if (step >= frames) {\r
- self.stop();\r
+ self.progress(o.stepping * step);\r
+ // on end\r
+ if (step >= frames) {\r
+ self.stop();\r
\r
- if (self.waitThread || o.wait == 'loop') {\r
- self._step = 0;\r
- self.start();\r
- }\r
+ if (self.waitThread || o.wait == 'loop') {\r
+ self._step = 0;\r
+ self.start();\r
}\r
- };\r
- var from = this._step, _step = (this._step - (from - 1));\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
- this.threads[0] = setInterval(function() {\r
- render(_step++);\r
- }, ms);\r
- \r
- this.propagate('start');\r
- return false;\r
- },\r
- clearThreads: function() {\r
- $.each(this.threads, function(s, t) { clearInterval(t); });\r
- this.threads = {};\r
- },\r
- stop: function() {\r
- \r
- if (this.disabled) return false;\r
- var o = this.options, self = this;\r
- \r
- this.clearThreads();\r
- this.propagate('stop');\r
- \r
- this.inProgress = false;\r
- return false;\r
- \r
- },\r
- reset: function() {\r
- \r
- if (this.disabled) return false;\r
- this._step = 0;\r
- this.rangeValue = 0;\r
- this.inProgress = false;\r
- this.clearThreads();\r
- this.progress(0);\r
- this.bar.addClass('ui-hidden');\r
- return false;\r
- \r
- },\r
- progress: function(range) {\r
- \r
- var o = this.options, el = this.element, bar = this.bar;\r
- if (this.disabled) return false;\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
- this.bar.removeClass('ui-hidden');\r
- \r
- var css = { width: this.pixelRange + 'px' };\r
- this.bar.css(css);\r
- this.textElement.css(css);\r
- \r
- if (!o.text && o.range) this.text(this.rangeValue + '%');\r
- this.propagate('progress', this.rangeValue);\r
- return false;\r
- },\r
- text: function(text) {\r
- this.textElement.html(text);\r
- },\r
- _fixRange: function(range) {\r
- var o = this.options;\r
- this._step = Math.ceil(range/o.stepping);\r
- this.rangeValue = Math.round(o.stepping * this._step);\r
- this.rangeValue = (this.rangeValue) >= 100 ? 100 : this.rangeValue;\r
- return this.rangeValue;\r
- }\r
- });\r
- \r
- $.ui.progressbar.defaults = {\r
- duration: 3000,\r
- stepping: 1,\r
- text: '',\r
- range: true,\r
- addClass: '',\r
- textClass: ''\r
- };\r
+ }\r
+ };\r
+ var from = this._step, _step = (this._step - (from - 1));\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
+ this.threads[0] = setInterval(function() {\r
+ render(_step++);\r
+ }, ms);\r
+ \r
+ this.propagate('start');\r
+ return false;\r
+ },\r
+ clearThreads: function() {\r
+ $.each(this.threads, function(s, t) { clearInterval(t); });\r
+ this.threads = {};\r
+ },\r
+ stop: function() {\r
+ \r
+ if (this.disabled) return false;\r
+ var o = this.options, self = this;\r
+ \r
+ this.clearThreads();\r
+ this.propagate('stop');\r
+ \r
+ this.inProgress = false;\r
+ return false;\r
+ \r
+ },\r
+ reset: function() {\r
+ \r
+ if (this.disabled) return false;\r
+ this._step = 0;\r
+ this.rangeValue = 0;\r
+ this.inProgress = false;\r
+ this.clearThreads();\r
+ this.progress(0);\r
+ this.bar.addClass('ui-hidden');\r
+ return false;\r
+ \r
+ },\r
+ progress: function(range) {\r
+ \r
+ var o = this.options, el = this.element, bar = this.bar;\r
+ if (this.disabled) return false;\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
+ this.bar.removeClass('ui-hidden');\r
+ \r
+ var css = { width: this.pixelRange + 'px' };\r
+ this.bar.css(css);\r
+ this.textElement.css(css);\r
+ \r
+ if (!o.text && o.range) this.text(this.rangeValue + '%');\r
+ this.propagate('progress', this.rangeValue);\r
+ return false;\r
+ },\r
+ text: function(text) {\r
+ this.textElement.html(text);\r
+ },\r
+ _fixRange: function(range) {\r
+ var o = this.options;\r
+ this._step = Math.ceil(range/o.stepping);\r
+ this.rangeValue = Math.round(o.stepping * this._step);\r
+ this.rangeValue = (this.rangeValue) >= 100 ? 100 : this.rangeValue;\r
+ return this.rangeValue;\r
+ }\r
+});\r
+\r
+$.ui.progressbar.defaults = {\r
+ duration: 3000,\r
+ stepping: 1,\r
+ text: '',\r
+ range: true,\r
+ addClass: '',\r
+ textClass: ''\r
+};\r
\r
})(jQuery);\r
+/*\r
+ * jQuery UI Spinner\r
+ *\r
+ * Copyright (c) 2008 jQuery\r
+ * Dual licensed under the MIT (MIT-LICENSE.txt)\r
+ * and GPL (GPL-LICENSE.txt) licenses.\r
+ *\r
+ * http://docs.jquery.com/UI/Spinner\r
+ *\r
+ * Depends:\r
+ * ui.core.js\r
+ */\r
(function($) {\r
\r
- $.widget("ui.spinner", {\r
- init: function() {\r
+$.widget("ui.spinner", {\r
+ init: function() {\r
\r
- //Initialize needed constants\r
- var self = this;\r
- this.element.addClass("ui-spinner");\r
- this.element[0].value = this.options.start;\r
- \r
- var pickerHeight = this.element.innerHeight() / 2 - parseInt(this.element.css("borderTopWidth"),10) - 2;\r
- this.element\r
- .wrap("<div>")\r
- .parent()\r
- .css({\r
- position: this.element.css("position") == "static" ? "relative" : this.element.css("position"),\r
- left: this.element.css("left"),\r
- top: this.element.css("top"),\r
- width: this.element.outerWidth(),\r
- height: this.element.outerHeight()\r
- })\r
- .css("float", this.element.css("float"))\r
- .prepend('<div class="ui-spinner-up"></div>')\r
- .find("div.ui-spinner-up")\r
- .bind("mousedown", function() { if(!self.counter) self.counter = 1; self.mousedown(100, "up"); })\r
- .bind("mouseup", function(e) { self.counter = 0; if(self.timer) window.clearInterval(self.timer); self.element[0].focus(); self.propagate("change", e); })\r
- .css({ height: pickerHeight, top: parseInt(this.element.css("borderTopWidth"),10)+1, right: parseInt(this.element.css("borderRightWidth"),10)+1 })\r
- .end()\r
- .append('<div class="ui-spinner-down"></div>')\r
- .find("div.ui-spinner-down")\r
- .bind("mousedown", function() { if(!self.counter) self.counter = 1; self.mousedown(100, "down"); })\r
- .bind("mouseup", function(e) { self.counter = 0; if(self.timer) window.clearInterval(self.timer); self.element[0].focus(); self.propagate("change", e); })\r
- .css({ height: pickerHeight, bottom: parseInt(this.element.css("borderBottomWidth"),10)+1, right: parseInt(this.element.css("borderRightWidth"),10)+1 })\r
- .end()\r
- ;\r
- \r
- this.element\r
- .bind("keydown.spinner", function(e) {\r
- if(!self.counter) self.counter = 1;\r
- self.keydown.call(self, e);\r
+ //Initialize needed constants\r
+ var self = this;\r
+ this.element.addClass("ui-spinner");\r
+ this.element[0].value = this.options.start;\r
+ \r
+ var pickerHeight = this.element.innerHeight() / 2 - parseInt(this.element.css("borderTopWidth"),10) - 2;\r
+ this.element\r
+ .wrap("<div>")\r
+ .parent()\r
+ .css({\r
+ position: this.element.css("position") == "static" ? "relative" : this.element.css("position"),\r
+ left: this.element.css("left"),\r
+ top: this.element.css("top"),\r
+ width: this.element.outerWidth(),\r
+ height: this.element.outerHeight()\r
})\r
- .bind("keyup.spinner", function(e) {\r
- self.counter = 0;\r
- self.cleanUp();\r
- self.propagate("change", e);\r
- })\r
- ;\r
+ .css("float", this.element.css("float"))\r
+ .prepend('<div class="ui-spinner-up"></div>')\r
+ .find("div.ui-spinner-up")\r
+ .bind("mousedown", function() { if(!self.counter) self.counter = 1; self.mousedown(100, "up"); })\r
+ .bind("mouseup", function(e) { self.counter = 0; if(self.timer) window.clearInterval(self.timer); self.element[0].focus(); self.propagate("change", e); })\r
+ .css({ height: pickerHeight, top: parseInt(this.element.css("borderTopWidth"),10)+1, right: parseInt(this.element.css("borderRightWidth"),10)+1 })\r
+ .end()\r
+ .append('<div class="ui-spinner-down"></div>')\r
+ .find("div.ui-spinner-down")\r
+ .bind("mousedown", function() { if(!self.counter) self.counter = 1; self.mousedown(100, "down"); })\r
+ .bind("mouseup", function(e) { self.counter = 0; if(self.timer) window.clearInterval(self.timer); self.element[0].focus(); self.propagate("change", e); })\r
+ .css({ height: pickerHeight, bottom: parseInt(this.element.css("borderBottomWidth"),10)+1, right: parseInt(this.element.css("borderRightWidth"),10)+1 })\r
+ .end()\r
+ ;\r
+ \r
+ this.element\r
+ .bind("keydown.spinner", function(e) {\r
+ if(!self.counter) self.counter = 1;\r
+ self.keydown.call(self, e);\r
+ })\r
+ .bind("keyup.spinner", function(e) {\r
+ self.counter = 0;\r
+ self.cleanUp();\r
+ self.propagate("change", e);\r
+ })\r
+ ;\r
+\r
+ },\r
+ plugins: {},\r
+ constrain: function() {\r
+ if(this.options.min != undefined && this.element[0].value < this.options.min) this.element[0].value = this.options.min;\r
+ if(this.options.max != undefined && this.element[0].value > this.options.max) this.element[0].value = this.options.max;\r
+ },\r
+ cleanUp: function() {\r
+ this.element[0].value = this.element[0].value.replace(/[^0-9\-]/g, '');\r
+ this.constrain();\r
+ },\r
+ down: function(e) {\r
+ if(isNaN(parseInt(this.element[0].value,10))) this.element[0].value = this.options.start;\r
+ this.element[0].value -= (this.options.incremental && this.counter > 100 ? (this.counter > 200 ? 100 : 10) : 1) * this.options.stepping;\r
+ this.constrain();\r
+ if(this.counter) this.counter++;\r
+ this.propagate("spin", e);\r
+ },\r
+ up: function(e) {\r
+ if(isNaN(parseInt(this.element[0].value,10))) this.element[0].value = this.options.start;\r
+ this.element[0].value = parseFloat(this.element[0].value) + (this.options.incremental && this.counter > 100 ? (this.counter > 200 ? 100 : 10) : 1) * this.options.stepping;\r
+ this.constrain();\r
+ if(this.counter) this.counter++;\r
+ this.propagate("spin", e);\r
+ },\r
+ mousedown: function(i, d) {\r
+ var self = this;\r
+ i = i || 100;\r
+ if(this.timer) window.clearInterval(this.timer);\r
+ this.timer = window.setInterval(function() {\r
+ self[d]();\r
+ if(self.counter > 20) self.mousedown(20, d);\r
+ }, i);\r
+ },\r
+ keydown: function(e) {\r
+ if(e.keyCode == 38 || e.keyCode == 39) this.up(e);\r
+ if(e.keyCode == 40 || e.keyCode == 37) this.down(e);\r
+ if(e.keyCode == 36) this.element[0].value = this.options.min || this.options.start; //Home key goes to min, if defined, else to start\r
+ if(e.keyCode == 35 && this.options.max != undefined) this.element[0].value = this.options.max; //End key goes to maximum\r
+ },\r
+ ui: function(e) {\r
+ return {\r
+ instance: this,\r
+ options: this.options,\r
+ element: this.element \r
+ };\r
+ },\r
+ propagate: function(n,e) {\r
+ $.ui.plugin.call(this, n, [e, this.ui()]);\r
+ return this.element.triggerHandler(n == "spin" ? n : "spin"+n, [e, this.ui()], this.options[n]);\r
+ },\r
+ destroy: function() {\r
+ if(!$.data(this.element[0], 'spinner')) return;\r
+ this.element\r
+ .removeClass("ui-spinner ui-spinner-disabled")\r
+ .removeData("spinner")\r
+ .unbind(".spinner");\r
+ }\r
+});\r
+\r
+$.ui.spinner.defaults = {\r
+ stepping: 1,\r
+ start: 0,\r
+ incremental: true\r
+};\r
\r
- },\r
- plugins: {},\r
- constrain: function() {\r
- if(this.options.min != undefined && this.element[0].value < this.options.min) this.element[0].value = this.options.min;\r
- if(this.options.max != undefined && this.element[0].value > this.options.max) this.element[0].value = this.options.max;\r
- },\r
- cleanUp: function() {\r
- this.element[0].value = this.element[0].value.replace(/[^0-9\-]/g, '');\r
- this.constrain();\r
- },\r
- down: function(e) {\r
- if(isNaN(parseInt(this.element[0].value,10))) this.element[0].value = this.options.start;\r
- this.element[0].value -= (this.options.incremental && this.counter > 100 ? (this.counter > 200 ? 100 : 10) : 1) * this.options.stepping;\r
- this.constrain();\r
- if(this.counter) this.counter++;\r
- this.propagate("spin", e);\r
- },\r
- up: function(e) {\r
- if(isNaN(parseInt(this.element[0].value,10))) this.element[0].value = this.options.start;\r
- this.element[0].value = parseFloat(this.element[0].value) + (this.options.incremental && this.counter > 100 ? (this.counter > 200 ? 100 : 10) : 1) * this.options.stepping;\r
- this.constrain();\r
- if(this.counter) this.counter++;\r
- this.propagate("spin", e);\r
- },\r
- mousedown: function(i, d) {\r
- var self = this;\r
- i = i || 100;\r
- if(this.timer) window.clearInterval(this.timer);\r
- this.timer = window.setInterval(function() {\r
- self[d]();\r
- if(self.counter > 20) self.mousedown(20, d);\r
- }, i);\r
- },\r
- keydown: function(e) {\r
- if(e.keyCode == 38 || e.keyCode == 39) this.up(e);\r
- if(e.keyCode == 40 || e.keyCode == 37) this.down(e);\r
- if(e.keyCode == 36) this.element[0].value = this.options.min || this.options.start; //Home key goes to min, if defined, else to start\r
- if(e.keyCode == 35 && this.options.max != undefined) this.element[0].value = this.options.max; //End key goes to maximum\r
- },\r
- ui: function(e) {\r
- return {\r
- instance: this,\r
- options: this.options,\r
- element: this.element \r
- };\r
- },\r
- propagate: function(n,e) {\r
- $.ui.plugin.call(this, n, [e, this.ui()]);\r
- return this.element.triggerHandler(n == "spin" ? n : "spin"+n, [e, this.ui()], this.options[n]);\r
- },\r
- destroy: function() {\r
- if(!$.data(this.element[0], 'spinner')) return;\r
- this.element\r
- .removeClass("ui-spinner ui-spinner-disabled")\r
- .removeData("spinner")\r
- .unbind(".spinner");\r
- }\r
- });\r
- \r
- $.ui.spinner.defaults = {\r
- stepping: 1,\r
- start: 0,\r
- incremental: true\r
- };\r
- \r
-})(jQuery);
\ No newline at end of file
+})(jQuery);\r