jquery_gantt_rails 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. checksums.yaml +15 -0
  2. data/.gitignore +74 -0
  3. data/.idea/encodings.xml +5 -0
  4. data/.idea/jquery_gantt_rails.iml +9 -0
  5. data/.idea/misc.xml +22 -0
  6. data/.idea/modules.xml +9 -0
  7. data/.idea/scopes/scope_settings.xml +5 -0
  8. data/.idea/vcs.xml +7 -0
  9. data/.ruby-version.rb +1 -0
  10. data/Gemfile +3 -0
  11. data/README.md +41 -0
  12. data/Rakefile +1 -0
  13. data/jquery_gantt_rails.gemspec +20 -0
  14. data/lib/jquery_gantt_rails/version.rb +3 -0
  15. data/lib/jquery_gantt_rails/version.rb~ +3 -0
  16. data/lib/jquery_gantt_rails.rb +9 -0
  17. data/vendor/assets/javascripts/jquery_gantt/README.md +28 -0
  18. data/vendor/assets/javascripts/jquery_gantt/add.gif +0 -0
  19. data/vendor/assets/javascripts/jquery_gantt/alert.gif +0 -0
  20. data/vendor/assets/javascripts/jquery_gantt/closeBig.png +0 -0
  21. data/vendor/assets/javascripts/jquery_gantt/del.gif +0 -0
  22. data/vendor/assets/javascripts/jquery_gantt/edit.gif +0 -0
  23. data/vendor/assets/javascripts/jquery_gantt/gantt.css +323 -0
  24. data/vendor/assets/javascripts/jquery_gantt/gantt.html +547 -0
  25. data/vendor/assets/javascripts/jquery_gantt/ganttDrawer.js +752 -0
  26. data/vendor/assets/javascripts/jquery_gantt/ganttGridEditor.js +518 -0
  27. data/vendor/assets/javascripts/jquery_gantt/ganttMaster.js +702 -0
  28. data/vendor/assets/javascripts/jquery_gantt/ganttTask.js +947 -0
  29. data/vendor/assets/javascripts/jquery_gantt/ganttUtilities.js +237 -0
  30. data/vendor/assets/javascripts/jquery_gantt/gantt_compact.css +323 -0
  31. data/vendor/assets/javascripts/jquery_gantt/hasExternalDeps.png +0 -0
  32. data/vendor/assets/javascripts/jquery_gantt/libs/JST/jquery.JST.js +167 -0
  33. data/vendor/assets/javascripts/jquery_gantt/libs/date.js +584 -0
  34. data/vendor/assets/javascripts/jquery_gantt/libs/dateField/images/next.png +0 -0
  35. data/vendor/assets/javascripts/jquery_gantt/libs/dateField/images/prev.png +0 -0
  36. data/vendor/assets/javascripts/jquery_gantt/libs/dateField/jquery.dateField.css +88 -0
  37. data/vendor/assets/javascripts/jquery_gantt/libs/dateField/jquery.dateField.js +212 -0
  38. data/vendor/assets/javascripts/jquery_gantt/libs/i18nJs.js +140 -0
  39. data/vendor/assets/javascripts/jquery_gantt/libs/jquery.livequery.min.js +11 -0
  40. data/vendor/assets/javascripts/jquery_gantt/libs/jquery.timers.js +142 -0
  41. data/vendor/assets/javascripts/jquery_gantt/libs/platform.js +954 -0
  42. data/vendor/assets/javascripts/jquery_gantt/linkArrow.png +0 -0
  43. data/vendor/assets/javascripts/jquery_gantt/milestone.png +0 -0
  44. data/vendor/assets/javascripts/jquery_gantt/platform.css +346 -0
  45. data/vendor/assets/javascripts/jquery_gantt/teamwork-regular-webfont.eot +0 -0
  46. data/vendor/assets/javascripts/jquery_gantt/teamwork-regular-webfont.otf +0 -0
  47. data/vendor/assets/javascripts/jquery_gantt/teamwork-regular-webfont.svg +152 -0
  48. data/vendor/assets/javascripts/jquery_gantt/teamwork-regular-webfont.ttf +0 -0
  49. data/vendor/assets/javascripts/jquery_gantt/teamwork-regular-webfont.woff +0 -0
  50. data/vendor/assets/javascripts/jquery_gantt/teamworkFont.css +16 -0
  51. data/vendor/assets/javascripts/jquery_gantt/twGanttSmall.png +0 -0
  52. metadata +107 -0
@@ -0,0 +1,212 @@
1
+ /*
2
+ Copyright (c) 2009 Open Lab
3
+ Written by Roberto Bicchierai http://roberto.open-lab.com
4
+ Permission is hereby granted, free of charge, to any person obtaining
5
+ a copy of this software and associated documentation files (the
6
+ "Software"), to deal in the Software without restriction, including
7
+ without limitation the rights to use, copy, modify, merge, publish,
8
+ distribute, sublicense, and/or sell copies of the Software, and to
9
+ permit persons to whom the Software is furnished to do so, subject to
10
+ the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ */
23
+
24
+ jQuery.fn.dateField = function(options) {
25
+
26
+ //check if the input field is passed correctly
27
+ if (!options.inputField){
28
+ console.error("You must supply an input field");
29
+ return false;
30
+ }
31
+
32
+ // -------------------------- start default option values --------------------------
33
+
34
+ if (typeof(options.firstDayOfWeek) == "undefined")
35
+ options.firstDayOfWeek=Date.firstDayOfWeek;
36
+
37
+ if (typeof(options.useWheel) == "undefined")
38
+ options.useWheel=true;
39
+
40
+ if (typeof(options.dateFormat) == "undefined")
41
+ options.dateFormat=Date.defaultFormat;
42
+ // -------------------------- end default option values --------------------------
43
+
44
+
45
+ // ------------------ start
46
+ if(options.inputField.is("[readonly]") || options.inputField.is("[disabled]"))
47
+ return;
48
+
49
+ var calendar = {currentDate: new Date()};
50
+ calendar.options = options;
51
+
52
+ //build the calendar on the first element in the set of matched elements.
53
+ var theOpener = this.eq(0);
54
+ var theDiv=$("<div>").addClass("calBox");
55
+
56
+
57
+ //create calendar elements elements
58
+ var divNavBar = $("<div>").addClass("calNavBar");
59
+ var divDays = $("<div>").addClass("calDay");
60
+
61
+ divDays.addClass("calFullMonth");
62
+ theDiv.append(divNavBar).append(divDays);
63
+
64
+ if (options.isSearchField){
65
+ var divShortcuts=$("<div>").addClass("shortCuts").html("<span title='last quarter'>LQ</span> <span title='last month'>LM</span> <span title='this month'>M</span> <span title='last week'>LW</span> <span title='this week'>W</span> <span title='yesterday'>Y</span> <span title='today'>T</span><span title='tomorrow'>TM</span> <span title='next week'>NW</span> <span title='next month'>NM</span> <span title='this quarter'>Q</span> <span title='next quarter'>NQ</span>");
66
+ divShortcuts.click(function(ev){
67
+ var el=$(ev.target);
68
+ if(el.is("span")){
69
+ if (!options.isSearchField)
70
+ options.inputField.val(Date.parseString(el.text().trim(),options.dateFormat).format(options.dateFormat));
71
+ else
72
+ options.inputField.val(el.text().trim());
73
+ theDiv.remove();
74
+ }
75
+ });
76
+ theDiv.append(divShortcuts);
77
+ }
78
+
79
+
80
+ $("body").append(theDiv);
81
+ nearBestPosition(theOpener,theDiv);
82
+ theDiv.bringToFront();
83
+
84
+
85
+ //register for click outside. Delayed to avoid it run immediately
86
+ $("body").oneTime(100, "regclibodcal", function() {
87
+ $("body").bind("click.dateField", function() {
88
+ $(this).unbind("click.dateField");
89
+ theDiv.remove();
90
+ });
91
+ });
92
+
93
+
94
+ calendar.drawCalendar = function(date) {
95
+ calendar.currentDate = date;
96
+
97
+ var fillNavBar = function(date) {
98
+ var t = new Date(date.getTime());
99
+ divNavBar.empty();
100
+
101
+ t.setMonth(t.getMonth()-1);
102
+ var spanPrev = $("<span>").addClass("calElement noCallback prev").attr("millis", t.getTime());
103
+ t.setMonth(t.getMonth()+1);
104
+ var spanMonth = $("<span>").html(t.format("MMMM yyyy"));
105
+ t.setMonth(t.getMonth()+1);
106
+ var spanNext = $("<span>").addClass("calElement noCallback next").attr("millis", t.getTime());
107
+
108
+ divNavBar.append(spanPrev).append(spanMonth).append(spanNext);
109
+ };
110
+
111
+ var fillDaysFullMonth = function(date) {
112
+ divDays.empty();
113
+ var t = new Date();//today
114
+ var w = parseInt((theDiv.width()-4-(4*7))/7)+"px";
115
+ // draw day headers
116
+ var d = new Date(date);
117
+ d.setFirstDayOfThisWeek(options.firstDayOfWeek);
118
+ for (var i = 0; i < 7; i++) {
119
+ var span = $("<span>").addClass("calDayHeader").attr("day", d.getDay());
120
+ span.css("width",w);
121
+ span.html(Date.dayAbbreviations[d.getDay()]);
122
+
123
+ //call the dayHeaderRenderer
124
+ if (typeof(options.dayHeaderRenderer) == "function")
125
+ options.dayHeaderRenderer(span,d.getDay());
126
+
127
+ divDays.append(span);
128
+ d.setDate(d.getDate()+1);
129
+ }
130
+
131
+ //draw cells
132
+ d = new Date(date);
133
+ d.setDate(1); // set day to start of month
134
+ d.setFirstDayOfThisWeek(options.firstDayOfWeek);//go to first day of week
135
+
136
+ var i=0;
137
+
138
+ while ((d.getMonth()<=date.getMonth() && d.getFullYear()<=date.getFullYear()) || d.getFullYear()<date.getFullYear() || (i%7!=0)) {
139
+ var span = $("<span>").addClass("calElement day").attr("millis", d.getTime());
140
+
141
+ span.html("<span class=dayNumber>" + d.getDate() + "</span>").css("width",w);
142
+ if (d.getYear() == t.getYear() && d.getMonth() == t.getMonth() && d.getDate() == t.getDate())
143
+ span.addClass("today");
144
+ if (d.getYear() == date.getYear() && d.getMonth() == date.getMonth() && d.getDate() == date.getDate())
145
+ span.addClass("selected");
146
+
147
+ if(d.getMonth()!=date.getMonth())
148
+ span.addClass("calOutOfScope");
149
+
150
+ //call the dayRenderer
151
+ if (typeof(options.dayRenderer) == "function")
152
+ options.dayRenderer(span,d);
153
+
154
+ divDays.append(span);
155
+ d.setDate(d.getDate()+1);
156
+ i++;
157
+ }
158
+
159
+ };
160
+
161
+ fillNavBar(date);
162
+ fillDaysFullMonth(date);
163
+ };
164
+
165
+
166
+ theDiv.click(function(ev) {
167
+ var el = $(ev.target).closest(".calElement");
168
+ if (el.size() > 0) {
169
+ var date = new Date(parseInt(el.attr("millis")));
170
+ if (el.hasClass("day")) {
171
+ theDiv.remove();
172
+ if (!el.is(".noCallback")) {
173
+ options.inputField.val(date.format(options.dateFormat)).attr("millis", date.getTime()).focus();
174
+ if (typeof(options.callback) == "function")
175
+ options.callback(date);
176
+ }
177
+ } else {
178
+ calendar.drawCalendar(date);
179
+ }
180
+ }
181
+ ev.stopPropagation();
182
+ });
183
+
184
+
185
+ //if mousewheel
186
+ if ($.event.special.mousewheel && options.useWheel) {
187
+ divDays.mousewheel(function(event, delta) {
188
+ var d = new Date(calendar.currentDate.getTime());
189
+ d.setMonth(d.getMonth() + delta);
190
+ calendar.drawCalendar(d);
191
+ return false;
192
+ });
193
+ }
194
+
195
+
196
+ // start calendar to the date in the input
197
+ var dateStr=options.inputField.val();
198
+
199
+
200
+ if (!dateStr || !Date.isValid(dateStr,options.dateFormat)){
201
+ calendar.drawCalendar(new Date());
202
+ } else {
203
+ var date = Date.parseString(dateStr,options.dateFormat);
204
+ //set date string formatted
205
+ if (!options.isSearchField)
206
+ options.inputField.val(date.format(options.dateFormat)).attr("millis",date.getTime());
207
+
208
+ calendar.drawCalendar(date);
209
+ }
210
+
211
+ return calendar;
212
+ };
@@ -0,0 +1,140 @@
1
+
2
+
3
+
4
+ function dateToRelative(localTime){
5
+ var diff=new Date().getTime()-localTime;
6
+ var ret="";
7
+
8
+ var min=60000;
9
+ var hour=3600000;
10
+ var day=86400000;
11
+ var wee=604800000;
12
+ var mon=2629800000;
13
+ var yea=31557600000;
14
+
15
+ if (diff<-yea*2)
16
+ ret ="in ## years".replace("##",(-diff/yea).toFixed(0));
17
+
18
+ else if (diff<-mon*9)
19
+ ret ="in ## months".replace("##",(-diff/mon).toFixed(0));
20
+
21
+ else if (diff<-wee*5)
22
+ ret ="in ## weeks".replace("##",(-diff/wee).toFixed(0));
23
+
24
+ else if (diff<-day*2)
25
+ ret ="in ## days".replace("##",(-diff/day).toFixed(0));
26
+
27
+ else if (diff<-hour)
28
+ ret ="in ## hours".replace("##",(-diff/hour).toFixed(0));
29
+
30
+ else if (diff<-min*35)
31
+ ret ="in about one hour";
32
+
33
+ else if (diff<-min*25)
34
+ ret ="in about half hour";
35
+
36
+ else if (diff<-min*10)
37
+ ret ="in some minutes";
38
+
39
+ else if (diff<-min*2)
40
+ ret ="in few minutes";
41
+
42
+ else if (diff<=min)
43
+ ret ="just now";
44
+
45
+ else if (diff<=min*5)
46
+ ret ="few minutes ago";
47
+
48
+ else if (diff<=min*15)
49
+ ret ="some minutes ago";
50
+
51
+ else if (diff<=min*35)
52
+ ret ="about half hour ago";
53
+
54
+ else if (diff<=min*75)
55
+ ret ="about an hour ago";
56
+
57
+ else if (diff<=hour*5)
58
+ ret ="few hours ago";
59
+
60
+ else if (diff<=hour*24)
61
+ ret ="## hours ago".replace("##",(diff/hour).toFixed(0));
62
+
63
+ else if (diff<=day*7)
64
+ ret ="## days ago".replace("##",(diff/day).toFixed(0));
65
+
66
+ else if (diff<=wee*5)
67
+ ret ="## weeks ago".replace("##",(diff/wee).toFixed(0));
68
+
69
+ else if (diff<=mon*12)
70
+ ret ="## months ago".replace("##",(diff/mon).toFixed(0));
71
+
72
+ else
73
+ ret ="## years ago".replace("##",(diff/yea).toFixed(0));
74
+
75
+ return ret;
76
+ }
77
+
78
+ //override date format i18n
79
+
80
+ Date.monthNames = ["January","February","March","April","May","June","July","August","September","October","November","December"];
81
+ // Month abbreviations. Change this for local month names
82
+ Date.monthAbbreviations = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
83
+ // Full day names. Change this for local month names
84
+ Date.dayNames =["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];
85
+ // Day abbreviations. Change this for local month names
86
+ Date.dayAbbreviations = ["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];
87
+ // Used for parsing ambiguous dates like 1/2/2000 - default to preferring 'American' format meaning Jan 2.
88
+ // Set to false to prefer 'European' format meaning Feb 1
89
+ Date.preferAmericanFormat = false;
90
+
91
+ Date.firstDayOfWeek =1;
92
+ Date.defaultFormat = "dd/MM/yyyy";
93
+
94
+
95
+ Number.decimalSeparator = ".";
96
+ Number.groupingSeparator = ",";
97
+ Number.minusSign = "-";
98
+ Number.currencyFormat = "##0.00";
99
+
100
+
101
+
102
+ var millisInWorkingDay =36000000;
103
+ var workingDaysPerWeek =5;
104
+
105
+ function isHoliday(date) {
106
+ var friIsHoly =false;
107
+ var satIsHoly =true;
108
+ var sunIsHoly =true;
109
+
110
+ pad = function (val) {
111
+ val = "0" + val;
112
+ return val.substr(val.length - 2);
113
+ };
114
+
115
+ var holidays = "#01_01#04_25#08_15#11_01#12_25#12_26#06_02#12_08#05_01#2010_04_05#2010_10_19#2010_05_15#2011_04_04#";
116
+
117
+ var ymd = "#" + date.getFullYear() + "_" + pad(date.getMonth() + 1) + "_" + pad(date.getDate()) + "#";
118
+ var md = "#" + pad(date.getMonth() + 1) + "_" + pad(date.getDate()) + "#";
119
+ var day = date.getDay();
120
+
121
+ return (day == 5 && friIsHoly) || (day == 6 && satIsHoly) || (day == 0 && sunIsHoly) || holidays.indexOf(ymd) > -1 || holidays.indexOf(md) > -1;
122
+ }
123
+
124
+
125
+
126
+ var i18n = {
127
+ FORM_IS_CHANGED:"You have some unsaved data on the page!",
128
+ YES:"yes",
129
+ NO:"no",
130
+ FLD_CONFIRM_DELETE:"confirm the deletion?",
131
+ INVALID_DATA:"The data inserted are invalid for the field format.",
132
+ ERROR_ON_FIELD:"Error on field",
133
+ CLOSE_ALL_CONTAINERS:"close all?",
134
+
135
+
136
+
137
+ DO_YOU_CONFIRM:"Do you confirm?"
138
+ };
139
+
140
+
@@ -0,0 +1,11 @@
1
+ /* Copyright (c) 2007 Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
2
+ * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
3
+ * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
4
+ *
5
+ * Version: 1.0.2
6
+ * Requires jQuery 1.1.3+
7
+ * Docs: http://docs.jquery.com/Plugins/livequery
8
+ */
9
+ (function($){$.extend($.fn,{livequery:function(type,fn,fn2){var self=this,q;if($.isFunction(type))fn2=fn,fn=type,type=undefined;$.each($.livequery.queries,function(i,query){if(self.selector==query.selector&&self.context==query.context&&type==query.type&&(!fn||fn.$lqguid==query.fn.$lqguid)&&(!fn2||fn2.$lqguid==query.fn2.$lqguid))return(q=query)&&false;});q=q||new $.livequery(this.selector,this.context,type,fn,fn2);q.stopped=false;$.livequery.run(q.id);return this;},expire:function(type,fn,fn2){var self=this;if($.isFunction(type))fn2=fn,fn=type,type=undefined;$.each($.livequery.queries,function(i,query){if(self.selector==query.selector&&self.context==query.context&&(!type||type==query.type)&&(!fn||fn.$lqguid==query.fn.$lqguid)&&(!fn2||fn2.$lqguid==query.fn2.$lqguid)&&!this.stopped)$.livequery.stop(query.id);});return this;}});$.livequery=function(selector,context,type,fn,fn2){this.selector=selector;this.context=context||document;this.type=type;this.fn=fn;this.fn2=fn2;this.elements=[];this.stopped=false;this.id=$.livequery.queries.push(this)-1;fn.$lqguid=fn.$lqguid||$.livequery.guid++;if(fn2)fn2.$lqguid=fn2.$lqguid||$.livequery.guid++;return this;};$.livequery.prototype={stop:function(){var query=this;if(this.type)this.elements.unbind(this.type,this.fn);else if(this.fn2)this.elements.each(function(i,el){query.fn2.apply(el);});this.elements=[];this.stopped=true;},run:function(){if(this.stopped)return;var query=this;var oEls=this.elements,els=$(this.selector,this.context),nEls=els.not(oEls);this.elements=els;if(this.type){nEls.bind(this.type,this.fn);if(oEls.length>0)$.each(oEls,function(i,el){if($.inArray(el,els)<0)$.event.remove(el,query.type,query.fn);});}else{nEls.each(function(){query.fn.apply(this);});if(this.fn2&&oEls.length>0)$.each(oEls,function(i,el){if($.inArray(el,els)<0)query.fn2.apply(el);});}}};$.extend($.livequery,{guid:0,queries:[],queue:[],running:false,timeout:null,checkQueue:function(){if($.livequery.running&&$.livequery.queue.length){var length=$.livequery.queue.length;while(length--)$.livequery.queries[$.livequery.queue.shift()].run();}},pause:function(){$.livequery.running=false;},play:function(){$.livequery.running=true;$.livequery.run();},registerPlugin:function(){$.each(arguments,function(i,n){if(!$.fn[n])return;var old=$.fn[n];$.fn[n]=function(){var r=old.apply(this,arguments);$.livequery.run();return r;}});},run:function(id){if(id!=undefined){if($.inArray(id,$.livequery.queue)<0)$.livequery.queue.push(id);}else
10
+ $.each($.livequery.queries,function(id){if($.inArray(id,$.livequery.queue)<0)$.livequery.queue.push(id);});if($.livequery.timeout)clearTimeout($.livequery.timeout);$.livequery.timeout=setTimeout($.livequery.checkQueue,20);},stop:function(id){if(id!=undefined)$.livequery.queries[id].stop();else
11
+ $.each($.livequery.queries,function(id){$.livequery.queries[id].stop();});}});$.livequery.registerPlugin('append','prepend','after','before','wrap','attr','removeAttr','addClass','removeClass','toggleClass','empty','remove');$(function(){$.livequery.play();});var init=$.prototype.init;$.prototype.init=function(a,c){var r=init.apply(this,arguments);if(a&&a.selector)r.context=a.context,r.selector=a.selector;if(typeof a=='string')r.context=c||document,r.selector=a;return r;};$.prototype.init.prototype=$.prototype;})(jQuery);
@@ -0,0 +1,142 @@
1
+ jQuery.fn.extend({
2
+ everyTime: function(interval, label, fn, times, belay) {
3
+ return this.each(function() {
4
+ jQuery.timer.add(this, interval, label, fn, times, belay);
5
+ });
6
+ },
7
+ oneTime: function(interval, label, fn) {
8
+ return this.each(function() {
9
+ jQuery.timer.add(this, interval, label, fn, 1);
10
+ });
11
+ },
12
+ stopTime: function(label, fn) {
13
+ return this.each(function() {
14
+ jQuery.timer.remove(this, label, fn);
15
+ });
16
+ }
17
+ });
18
+
19
+ jQuery.extend({
20
+ timer: {
21
+ guid: 1,
22
+ global: {},
23
+ regex: /^([0-9]+)\s*(.*s)?$/,
24
+ powers: {
25
+ // Yeah this is major overkill...
26
+ 'ms': 1,
27
+ 'cs': 10,
28
+ 'ds': 100,
29
+ 's': 1000,
30
+ 'das': 10000,
31
+ 'hs': 100000,
32
+ 'ks': 1000000
33
+ },
34
+ timeParse: function(value) {
35
+ if (value == undefined || value == null)
36
+ return null;
37
+ var result = this.regex.exec(jQuery.trim(value.toString()));
38
+ if (result[2]) {
39
+ var num = parseInt(result[1], 10);
40
+ var mult = this.powers[result[2]] || 1;
41
+ return num * mult;
42
+ } else {
43
+ return value;
44
+ }
45
+ },
46
+ add: function(element, interval, label, fn, times, belay) {
47
+ var counter = 0;
48
+
49
+ if (jQuery.isFunction(label)) {
50
+ if (!times)
51
+ times = fn;
52
+ fn = label;
53
+ label = interval;
54
+ }
55
+
56
+ interval = jQuery.timer.timeParse(interval);
57
+
58
+ if (typeof interval != 'number' || isNaN(interval) || interval <= 0)
59
+ return;
60
+
61
+ if (times && times.constructor != Number) {
62
+ belay = !!times;
63
+ times = 0;
64
+ }
65
+
66
+ times = times || 0;
67
+ belay = belay || false;
68
+
69
+ if (!element.$timers)
70
+ element.$timers = {};
71
+
72
+ if (!element.$timers[label])
73
+ element.$timers[label] = {};
74
+
75
+ fn.$timerID = fn.$timerID || this.guid++;
76
+
77
+ var handler = function() {
78
+ if (belay && this.inProgress)
79
+ return;
80
+ this.inProgress = true;
81
+ if ((++counter > times && times !== 0) || fn.call(element, counter) === false)
82
+ jQuery.timer.remove(element, label, fn);
83
+ this.inProgress = false;
84
+ };
85
+
86
+ handler.$timerID = fn.$timerID;
87
+
88
+ if (!element.$timers[label][fn.$timerID])
89
+ element.$timers[label][fn.$timerID] = window.setInterval(handler,interval);
90
+
91
+ if ( !this.global[label] )
92
+ this.global[label] = [];
93
+ this.global[label].push( element );
94
+
95
+ },
96
+ remove: function(element, label, fn) {
97
+ var timers = element.$timers, ret;
98
+
99
+ if ( timers ) {
100
+
101
+ if (!label) {
102
+ for ( label in timers )
103
+ this.remove(element, label, fn);
104
+ } else if ( timers[label] ) {
105
+ if ( fn ) {
106
+ if ( fn.$timerID ) {
107
+ window.clearInterval(timers[label][fn.$timerID]);
108
+ delete timers[label][fn.$timerID];
109
+ }
110
+ } else {
111
+ for ( var fn in timers[label] ) {
112
+ window.clearInterval(timers[label][fn]);
113
+ delete timers[label][fn];
114
+ }
115
+ }
116
+
117
+ for ( ret in timers[label] ) break;
118
+ if ( !ret ) {
119
+ ret = null;
120
+ delete timers[label];
121
+ }
122
+ }
123
+
124
+ for ( ret in timers ) break;
125
+ if ( !ret )
126
+ element.$timers = null;
127
+ }
128
+ }
129
+ }
130
+ });
131
+
132
+ if (jQuery.browser.msie)
133
+ jQuery(window).one("unload", function() {
134
+ var global = jQuery.timer.global;
135
+ for ( var label in global ) {
136
+ var els = global[label], i = els.length;
137
+ while ( --i )
138
+ jQuery.timer.remove(els[i], label);
139
+ }
140
+ });
141
+
142
+