From a2139ff85c533bb0c3b2b30a873c6349226814eb Mon Sep 17 00:00:00 2001
From: Enrique Erne
Date: Mon, 23 Nov 2009 10:46:45 +0100
Subject: [PATCH 001/285] fixed .unavailable to not :hover
---
datepicker.css | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/datepicker.css b/datepicker.css
index 1c54ebb..355bcae 100644
--- a/datepicker.css
+++ b/datepicker.css
@@ -207,7 +207,8 @@
color: #fff !important;
}
-.datepicker .unavailable {
+.datepicker .unavailable,
+.datepicker .body .days .week .day.unavailable:hover {
background: #edd !important;
color: #b88 !important;
cursor: default !important;
From 99310c4211c3f03b34cc48a5b13c9f02176bbde2 Mon Sep 17 00:00:00 2001
From: Enrique Erne
Date: Sun, 29 Nov 2009 13:41:11 +0100
Subject: [PATCH 002/285] fixed bug button previous month disappeared on the
last month
---
datepicker.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/datepicker.js b/datepicker.js
index 9c08b52..735d9ce 100644
--- a/datepicker.js
+++ b/datepicker.js
@@ -418,7 +418,7 @@ var DatePicker = new Class({
e.addClass('unavailable');
if (available) {
this.limit.right = true;
- } else if (this.d.getMonth() == month) {
+ } else if (this.d.getMonth() < month) {
this.limit.left = true;
}
} else {
From 95f4f641d5b2f41b685fb2fd5961150e09ff7e6a Mon Sep 17 00:00:00 2001
From: Enrique Erne
Date: Sun, 29 Nov 2009 15:00:14 +0100
Subject: [PATCH 003/285] very specific bug when month is processed before day
(i.e. Y-m-d) bug only occured on 29th, 30th and 31th when setting month
before day it fall to march. easy fix start unformat from absolute unix time
zero
---
datepicker.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/datepicker.js b/datepicker.js
index 735d9ce..50fa5ee 100644
--- a/datepicker.js
+++ b/datepicker.js
@@ -647,7 +647,7 @@ var DatePicker = new Class({
},
unformat: function(t, format) {
- var d = new Date();
+ var d = new Date('January 1, 1970 00:00:00');
var a = {};
var c, m;
t = t.toString();
From d9a6d9eeb3ee419590fb7c5f53b9763a30ac9d05 Mon Sep 17 00:00:00 2001
From: Enrique Erne
Date: Sun, 29 Nov 2009 23:13:43 +0100
Subject: [PATCH 004/285] added onNext and onPrevious events
---
datepicker.js | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/datepicker.js b/datepicker.js
index 50fa5ee..8f251f1 100644
--- a/datepicker.js
+++ b/datepicker.js
@@ -73,7 +73,9 @@ var DatePicker = new Class({
// and some event hooks:
onShow: $empty, // triggered when the datepicker pops up
onClose: $empty, // triggered after the datepicker is closed (destroyed)
- onSelect: $empty // triggered when a date is selected
+ onSelect: $empty, // triggered when a date is selected
+ onNext: $empty, // triggered when changing to next month
+ onPrevious: $empty // triggered when changing to previous month
},
initialize: function(attachTo, options) {
@@ -569,6 +571,7 @@ var DatePicker = new Class({
this.d.setMonth(this.d.getMonth() - 1);
}
this.render('left');
+ this.options.onPrevious();
},
next: function() {
@@ -580,6 +583,7 @@ var DatePicker = new Class({
this.d.setMonth(this.d.getMonth() + 1);
}
this.render('right');
+ this.options.onNext();
},
close: function(e, force) {
From 072959005bb9fed5a8582600b3ff172852baa2ce Mon Sep 17 00:00:00 2001
From: Ken Marfilla
Date: Tue, 19 Jan 2010 19:28:57 +0800
Subject: [PATCH 005/285] now uses Date.parse internally
---
datepicker.js | 79 +++++++--------------------------------------------
1 file changed, 10 insertions(+), 69 deletions(-)
diff --git a/datepicker.js b/datepicker.js
index 9c08b52..e0cb506 100644
--- a/datepicker.js
+++ b/datepicker.js
@@ -89,10 +89,10 @@ var DatePicker = new Class({
formatMinMaxDates: function() {
if (this.options.minDate && this.options.minDate.format) {
- this.options.minDate = this.unformat(this.options.minDate.date, this.options.minDate.format);
+ this.options.minDate = this.unformat(this.options.minDate.date);
}
if (this.options.maxDate && this.options.maxDate.format) {
- this.options.maxDate = this.unformat(this.options.maxDate.date, this.options.maxDate.format);
+ this.options.maxDate = this.unformat(this.options.maxDate.date);
this.options.maxDate.setHours(23);
this.options.maxDate.setMinutes(59);
this.options.maxDate.setSeconds(59);
@@ -120,7 +120,7 @@ var DatePicker = new Class({
// determine starting value(s)
if ($chk(item.get('value'))) {
- var init_clone_val = this.format(new Date(this.unformat(item.get('value'), this.options.inputOutputFormat)), this.options.format);
+ var init_clone_val = this.format(this.unformat(item.get('value')), this.options.format);
} else if (!this.options.allowEmpty) {
var init_clone_val = this.format(new Date(), this.options.format);
} else {
@@ -178,7 +178,7 @@ var DatePicker = new Class({
var init_visual_date, d = visual_input.getCoordinates();
if ($chk(original_input.get('value'))) {
- init_visual_date = this.unformat(original_input.get('value'), this.options.inputOutputFormat).valueOf();
+ init_visual_date = this.unformat(original_input.get('value')).valueOf();
} else {
init_visual_date = new Date();
if ($chk(this.options.maxDate) && init_visual_date.valueOf() > this.options.maxDate.valueOf()) {
@@ -646,74 +646,15 @@ var DatePicker = new Class({
return f;
},
- unformat: function(t, format) {
- var d = new Date();
- var a = {};
- var c, m;
- t = t.toString();
+ unformat: function(t) {
+ t = Date.parse(t);
- for (var i = 0; i < format.length; i++) {
- c = format.charAt(i);
- switch(c) {
- case '\\': r = null; i++; break;
- case 'y': r = '[0-9]{2}'; break;
- case 'Y': r = '[0-9]{4}'; break;
- case 'm': r = '0[1-9]|1[012]'; break;
- case 'n': r = '[1-9]|1[012]'; break;
- case 'M': r = '[A-Za-z]{'+this.options.monthShort+'}'; break;
- case 'F': r = '[A-Za-z]+'; break;
- case 'd': r = '0[1-9]|[12][0-9]|3[01]'; break;
- case 'j': r = '[1-9]|[12][0-9]|3[01]'; break;
- case 'D': r = '[A-Za-z]{'+this.options.dayShort+'}'; break;
- case 'l': r = '[A-Za-z]+'; break;
- case 'G':
- case 'H':
- case 'g':
- case 'h': r = '[0-9]{1,2}'; break;
- case 'a': r = '(am|pm)'; break;
- case 'A': r = '(AM|PM)'; break;
- case 'i':
- case 's': r = '[012345][0-9]'; break;
- case 'U': r = '-?[0-9]+$'; break;
- default: r = null;
- }
-
- if ($chk(r)) {
- m = t.match('^'+r);
- if ($chk(m)) {
- a[c] = m[0];
- t = t.substring(a[c].length);
- } else {
- if (this.options.debug) alert("Fatal Error in DatePicker\n\nUnexpected format at: '"+t+"' expected format character '"+c+"' (pattern '"+r+"')");
- return d;
- }
- } else {
- t = t.substring(1);
- }
+ if(isNaN(t.get('year'))) {
+ t = new Date();
}
- for (c in a) {
- var v = a[c];
- switch(c) {
- case 'y': d.setFullYear(v < 30 ? 2000 + v.toInt() : 1900 + v.toInt()); break; // assume between 1930 - 2029
- case 'Y': d.setFullYear(v); break;
- case 'm':
- case 'n': d.setMonth(v - 1); break;
- // FALL THROUGH NOTICE! "M" has no break, because "v" now is the full month (eg. 'February'), which will work with the next format "F":
- case 'M': v = this.options.months.filter(function(item, index) { return item.substring(0,this.options.monthShort) == v }.bind(this))[0];
- case 'F': d.setMonth(this.options.months.indexOf(v)); break;
- case 'd':
- case 'j': d.setDate(v); break;
- case 'G':
- case 'H': d.setHours(v); break;
- case 'g':
- case 'h': if (a['a'] == 'pm' || a['A'] == 'PM') { d.setHours(v == 12 ? 0 : v.toInt() + 12); } else { d.setHours(v); } break;
- case 'i': d.setMinutes(v); break;
- case 's': d.setSeconds(v); break;
- case 'U': d = new Date(v.toInt() * 1000);
- }
- };
+ t = (t.get('year') < 1900) ? new Date() : t;
- return d;
+ return t;
}
});
\ No newline at end of file
From 3077fcd4c676b708dec6e68e95de2df524963c20 Mon Sep 17 00:00:00 2001
From: Ken Marfilla
Date: Tue, 19 Jan 2010 19:31:43 +0800
Subject: [PATCH 006/285] now uses Date.format
---
datepicker.js | 31 +------------------------------
1 file changed, 1 insertion(+), 30 deletions(-)
diff --git a/datepicker.js b/datepicker.js
index e0cb506..ef87955 100644
--- a/datepicker.js
+++ b/datepicker.js
@@ -614,36 +614,7 @@ var DatePicker = new Class({
},
format: function(t, format) {
- var f = '';
- var h = t.getHours();
- var m = t.getMonth();
-
- for (var i = 0; i < format.length; i++) {
- switch(format.charAt(i)) {
- case '\\': i++; f+= format.charAt(i); break;
- case 'y': f += (100 + t.getYear() + '').substring(1); break
- case 'Y': f += t.getFullYear(); break;
- case 'm': f += this.leadZero(m + 1); break;
- case 'n': f += (m + 1); break;
- case 'M': f += this.options.months[m].substring(0,this.options.monthShort); break;
- case 'F': f += this.options.months[m]; break;
- case 'd': f += this.leadZero(t.getDate()); break;
- case 'j': f += t.getDate(); break;
- case 'D': f += this.options.days[t.getDay()].substring(0,this.options.dayShort); break;
- case 'l': f += this.options.days[t.getDay()]; break;
- case 'G': f += h; break;
- case 'H': f += this.leadZero(h); break;
- case 'g': f += (h % 12 ? h % 12 : 12); break;
- case 'h': f += this.leadZero(h % 12 ? h % 12 : 12); break;
- case 'a': f += (h > 11 ? 'pm' : 'am'); break;
- case 'A': f += (h > 11 ? 'PM' : 'AM'); break;
- case 'i': f += this.leadZero(t.getMinutes()); break;
- case 's': f += this.leadZero(t.getSeconds()); break;
- case 'U': f += Math.floor(t.valueOf() / 1000); break;
- default: f += format.charAt(i);
- }
- }
- return f;
+ return new Date(t).format(format);
},
unformat: function(t) {
From 782e0eae6392d35d1fccc28827c98e3f8db860d2 Mon Sep 17 00:00:00 2001
From: Ken Marfilla
Date: Tue, 19 Jan 2010 19:33:02 +0800
Subject: [PATCH 007/285] set default of allowEmpty to true
---
datepicker.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/datepicker.js b/datepicker.js
index ef87955..3d28a01 100644
--- a/datepicker.js
+++ b/datepicker.js
@@ -59,7 +59,7 @@ var DatePicker = new Class({
yearPicker: true,
yearsPerPage: 20,
format: 'd-m-Y',
- allowEmpty: false,
+ allowEmpty: true,
inputOutputFormat: 'U', // default to unix timestamp
animationDuration: 400,
useFadeInOut: !Browser.Engine.trident, // dont animate fade-in/fade-out for IE
From 8136d6d4dd8be2808a5b836433c88872f55e4913 Mon Sep 17 00:00:00 2001
From: Ken Marfilla
Date: Tue, 19 Jan 2010 19:49:55 +0800
Subject: [PATCH 008/285] remove the need for visual input, implements Events
---
datepicker.js | 68 ++++++++++++++++++++-------------------------------
1 file changed, 26 insertions(+), 42 deletions(-)
diff --git a/datepicker.js b/datepicker.js
index 3d28a01..bfd5f55 100644
--- a/datepicker.js
+++ b/datepicker.js
@@ -21,7 +21,7 @@
var DatePicker = new Class({
- Implements: Options,
+ Implements: [Options, Events],
// working date, which we will keep modifying to render the calendars
d: '',
@@ -58,9 +58,8 @@ var DatePicker = new Class({
timePickerOnly: false,
yearPicker: true,
yearsPerPage: 20,
- format: 'd-m-Y',
+ format: '%d-%m-%Y',
allowEmpty: true,
- inputOutputFormat: 'U', // default to unix timestamp
animationDuration: 400,
useFadeInOut: !Browser.Engine.trident, // dont animate fade-in/fade-out for IE
startView: 'month', // allowed values: {time, month, year, decades}
@@ -120,24 +119,15 @@ var DatePicker = new Class({
// determine starting value(s)
if ($chk(item.get('value'))) {
- var init_clone_val = this.format(this.unformat(item.get('value')), this.options.format);
+ var init_val = this.format(this.unformat(item.get('value')), this.options.format);
} else if (!this.options.allowEmpty) {
- var init_clone_val = this.format(new Date(), this.options.format);
+ var init_val = this.format(new Date(), this.options.format);
} else {
- var init_clone_val = '';
+ var init_val = '';
}
- // create clone
- var display = item.getStyle('display');
- var clone = item
- .setStyle('display', this.options.debug ? display : 'none')
- .store('datepicker', true) // to prevent double attachment...
- .clone()
- .store('datepicker', true) // ...even for the clone (!)
- .removeProperty('name') // secure clean (form)submission
- .setStyle('display', display)
- .set('value', init_clone_val)
- .inject(item, 'after');
+
+ item.store('datepicker', true); // to prevent double attachment...
// events
if ($chk(this.options.toggleElements)) {
@@ -145,20 +135,15 @@ var DatePicker = new Class({
.setStyle('cursor', 'pointer')
.addEvents({
'click': function(e) {
- this.onFocus(item, clone);
+ this.onFocus(item);
}.bind(this)
});
- clone.addEvents({
- 'blur': function() {
- item.set('value', clone.get('value'));
- }
});
} else {
- clone.addEvents({
+ item.addEvents({
'keydown': function(e) {
if (this.options.allowEmpty && (e.key == "delete" || e.key == "backspace")) {
item.set('value', '');
- e.target.set('value', '');
this.close(null, true);
} else if (e.key == "tab") {
this.close(null, true);
@@ -167,32 +152,31 @@ var DatePicker = new Class({
}
}.bind(this),
'focus': function(e) {
- this.onFocus(item, clone);
+ this.onFocus(item);
}.bind(this)
});
}
}.bind(this));
},
- onFocus: function(original_input, visual_input) {
- var init_visual_date, d = visual_input.getCoordinates();
+ onFocus: function(input) {
+ var input_date, d = input.getCoordinates();
- if ($chk(original_input.get('value'))) {
- init_visual_date = this.unformat(original_input.get('value')).valueOf();
+ if ($chk(input.get('value'))) {
+ input_date = this.unformat(input.get('value')).valueOf();
} else {
- init_visual_date = new Date();
- if ($chk(this.options.maxDate) && init_visual_date.valueOf() > this.options.maxDate.valueOf()) {
- init_visual_date = new Date(this.options.maxDate.valueOf());
+ input_date = new Date();
+ if ($chk(this.options.maxDate) && input_date.valueOf() > this.options.maxDate.valueOf()) {
+ input_date = new Date(this.options.maxDate.valueOf());
}
- if ($chk(this.options.minDate) && init_visual_date.valueOf() < this.options.minDate.valueOf()) {
- init_visual_date = new Date(this.options.minDate.valueOf());
+ if ($chk(this.options.minDate) && input_date.valueOf() < this.options.minDate.valueOf()) {
+ input_date = new Date(this.options.minDate.valueOf());
}
}
- this.show({ left: d.left + this.options.positionOffset.x, top: d.top + d.height + this.options.positionOffset.y }, init_visual_date);
- this.input = original_input;
- this.visual = visual_input;
- this.options.onShow();
+ this.show({ left: d.left + this.options.positionOffset.x, top: d.top + d.height + this.options.positionOffset.y }, input_date);
+ this.input = input;
+ this.fireEvent('show');
},
dateToObject: function(d) {
@@ -597,15 +581,15 @@ var DatePicker = new Class({
destroy: function() {
this.picker.destroy();
this.picker = null;
- this.options.onClose();
+ this.fireEvent('close');
},
select: function(values) {
this.choice = $merge(this.choice, values);
var d = this.dateFromObject(this.choice);
- this.input.set('value', this.format(d, this.options.inputOutputFormat));
- this.visual.set('value', this.format(d, this.options.format));
- this.options.onSelect(d);
+ this.input.set('value', this.format(d, this.options.format));
+ this.fireEvent('select', this, [d]);
+
this.close(null, true);
},
From 528fe46dbc1f5f60f7f3840a2a24f687e52d3d7d Mon Sep 17 00:00:00 2001
From: Ken Marfilla
Date: Tue, 19 Jan 2010 19:57:14 +0800
Subject: [PATCH 009/285] fixed syntax error from previous commit
---
datepicker.js | 1 -
1 file changed, 1 deletion(-)
diff --git a/datepicker.js b/datepicker.js
index bfd5f55..e175bb1 100644
--- a/datepicker.js
+++ b/datepicker.js
@@ -138,7 +138,6 @@ var DatePicker = new Class({
this.onFocus(item);
}.bind(this)
});
- });
} else {
item.addEvents({
'keydown': function(e) {
From e8c5364788dde24a2413fd231033b590059d404b Mon Sep 17 00:00:00 2001
From: Ken Marfilla
Date: Tue, 19 Jan 2010 20:01:20 +0800
Subject: [PATCH 010/285] prevents positioning beyond the visible viewport
---
datepicker.js | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/datepicker.js b/datepicker.js
index e175bb1..3e15a53 100644
--- a/datepicker.js
+++ b/datepicker.js
@@ -218,9 +218,23 @@ var DatePicker = new Class({
this.choice = this.dateToObject(this.d);
this.mode = (this.options.startView == 'time' && !this.options.timePicker) ? 'month' : this.options.startView;
this.render();
- this.picker.setStyles(position);
+ this.position({x: position.left, y: position.top});
},
-
+
+ position: function(p) {
+ var w = window.getSize(),
+ s = window.getScroll(),
+ d = this.picker.getSize(),
+ max_y = (w.y + s.y) - d.y,
+ max_x = (w.x + s.x) - d.x,
+ i = this.input.getCoordinates();
+
+ if(p.x > max_x) p.x = i.right - this.options.positionOffset.x - d.x;
+ if(p.y > max_y) p.y = i.top - this.options.positionOffset.y - d.y;
+
+ this.picker.setStyles({left: p.x, top: p.y});
+ },
+
render: function(fx) {
if (!$chk(this.picker)) {
this.constructPicker();
From 004a3f80da1af88c5d866e568ac8a425f779c20e Mon Sep 17 00:00:00 2001
From: Ken Marfilla
Date: Tue, 19 Jan 2010 20:07:11 +0800
Subject: [PATCH 011/285] fixed positioning bug
---
datepicker.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/datepicker.js b/datepicker.js
index 3e15a53..774360c 100644
--- a/datepicker.js
+++ b/datepicker.js
@@ -173,8 +173,8 @@ var DatePicker = new Class({
}
}
- this.show({ left: d.left + this.options.positionOffset.x, top: d.top + d.height + this.options.positionOffset.y }, input_date);
this.input = input;
+ this.show({ left: d.left + this.options.positionOffset.x, top: d.top + d.height + this.options.positionOffset.y }, input_date);
this.fireEvent('show');
},
From d453e947952f025d9ccc7586bfe95412ecc94848 Mon Sep 17 00:00:00 2001
From: Ken Marfilla
Date: Tue, 19 Jan 2010 20:15:19 +0800
Subject: [PATCH 012/285] enable drag, can be disabled via draggable option
---
datepicker.js | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/datepicker.js b/datepicker.js
index 774360c..93ce50f 100644
--- a/datepicker.js
+++ b/datepicker.js
@@ -68,6 +68,7 @@ var DatePicker = new Class({
maxDate: null, // same as minDate
debug: false,
toggleElements: null,
+ draggable: true,
// and some event hooks:
onShow: $empty, // triggered when the datepicker pops up
@@ -219,6 +220,11 @@ var DatePicker = new Class({
this.mode = (this.options.startView == 'time' && !this.options.timePicker) ? 'month' : this.options.startView;
this.render();
this.position({x: position.left, y: position.top});
+
+ if(this.options.draggable) {
+ this.dragger = this.picker.makeDraggable();
+ this.picker.setStyle('cursor', 'move');
+ }
},
position: function(p) {
From 44cafaf5c8316a4bafaef8ad7cbedf25549e4611 Mon Sep 17 00:00:00 2001
From: Ken Marfilla
Date: Tue, 19 Jan 2010 20:22:29 +0800
Subject: [PATCH 013/285] will now shim the picker in IE
---
datepicker.js | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/datepicker.js b/datepicker.js
index 93ce50f..04820d1 100644
--- a/datepicker.js
+++ b/datepicker.js
@@ -225,6 +225,31 @@ var DatePicker = new Class({
this.dragger = this.picker.makeDraggable();
this.picker.setStyle('cursor', 'move');
}
+
+ if(Browser.Engine.trident) this.shim();
+ },
+
+ shim: function() {
+ var coords = this.picker.setStyle('zIndex', 1000).getCoordinates();
+ this.frame = new Element('iframe', {
+ src: 'javascript:false;document.write("");',
+ styles: {
+ position: 'absolute',
+ zIndex: 999,
+ height: coords.height, width: coords.width,
+ left: coords.left, top: coords.top
+ }
+ }).inject(document.body);
+ this.frame.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)';
+
+ this.addEvent('close', function() {this.destroy()}.bind(this.frame));
+
+ if(this.options.draggable) {
+ this.dragger.addEvent('drag', function() {
+ var coords = this.picker.getCoordinates();
+ this.frame.setStyles({left: coords.left, top: coords.top});
+ }.bind(this));
+ }
},
position: function(p) {
From e22a66093f98608435737c2117b8efa05c31041c Mon Sep 17 00:00:00 2001
From: Chris Baxter
Date: Mon, 1 Feb 2010 11:56:46 +0000
Subject: [PATCH 014/285] Amended date validation to handle 'Invalid date'
---
datepicker.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/datepicker.js b/datepicker.js
index 04820d1..7549dc7 100644
--- a/datepicker.js
+++ b/datepicker.js
@@ -1,4 +1,4 @@
-/**
+/**
* datepicker.js - MooTools Datepicker class
* @version 1.16
*
@@ -648,7 +648,7 @@ var DatePicker = new Class({
unformat: function(t) {
t = Date.parse(t);
- if(isNaN(t.get('year'))) {
+ if(!t.isValid()) {
t = new Date();
}
From f0af0d8aa63e57a2689c1c3276f531c56da9ba86 Mon Sep 17 00:00:00 2001
From: Chris Baxter
Date: Mon, 1 Feb 2010 12:14:04 +0000
Subject: [PATCH 015/285] Added Date.defineParser to handle more date formats
---
datepicker.js | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/datepicker.js b/datepicker.js
index 7549dc7..ec0441b 100644
--- a/datepicker.js
+++ b/datepicker.js
@@ -120,7 +120,7 @@ var DatePicker = new Class({
// determine starting value(s)
if ($chk(item.get('value'))) {
- var init_val = this.format(this.unformat(item.get('value')), this.options.format);
+ var init_val = this.format(this.unformat(item.get('value'),this.options.format), this.options.format);
} else if (!this.options.allowEmpty) {
var init_val = this.format(new Date(), this.options.format);
} else {
@@ -163,7 +163,7 @@ var DatePicker = new Class({
var input_date, d = input.getCoordinates();
if ($chk(input.get('value'))) {
- input_date = this.unformat(input.get('value')).valueOf();
+ input_date = this.unformat(input.get('value'),this.options.format).valueOf();
} else {
input_date = new Date();
if ($chk(this.options.maxDate) && input_date.valueOf() > this.options.maxDate.valueOf()) {
@@ -645,7 +645,8 @@ var DatePicker = new Class({
return new Date(t).format(format);
},
- unformat: function(t) {
+ unformat: function(t,format) {
+ Date.defineParser(format);
t = Date.parse(t);
if(!t.isValid()) {
@@ -656,4 +657,4 @@ var DatePicker = new Class({
return t;
}
-});
\ No newline at end of file
+});
From d1f0b15907dc9a71ffcccb1bb7dd74f0054c9e7c Mon Sep 17 00:00:00 2001
From: Chris Baxter
Date: Mon, 1 Feb 2010 12:27:09 +0000
Subject: [PATCH 016/285] Changed format for minDate and maxDate to inputFormat
to resolve conflict with MooTools Date.format function
---
datepicker.js | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/datepicker.js b/datepicker.js
index ec0441b..167f48a 100644
--- a/datepicker.js
+++ b/datepicker.js
@@ -88,11 +88,11 @@ var DatePicker = new Class({
},
formatMinMaxDates: function() {
- if (this.options.minDate && this.options.minDate.format) {
- this.options.minDate = this.unformat(this.options.minDate.date);
+ if (this.options.minDate && this.options.minDate.inputFormat) { //cbaxter changed minDate.format for minDate.inputFormat to address issues when implemented with MooTools.Date extension due to date.format() being confused with date.format string
+ this.options.minDate = this.unformat(this.options.minDate.date, this.options.minDate.inputFormat);
}
- if (this.options.maxDate && this.options.maxDate.format) {
- this.options.maxDate = this.unformat(this.options.maxDate.date);
+ if (this.options.maxDate && this.options.maxDate.inputFormat) {
+ this.options.maxDate = this.unformat(this.options.maxDate.date, this.options.maxDate.inputFormat);
this.options.maxDate.setHours(23);
this.options.maxDate.setMinutes(59);
this.options.maxDate.setSeconds(59);
From 9ef5be1ced877dc67c50b73e299e0f14478efe6d Mon Sep 17 00:00:00 2001
From: Chris Baxter
Date: Mon, 1 Feb 2010 12:30:18 +0000
Subject: [PATCH 017/285] Added check that MooTools More extension Drag.Move is
included. Will now function without error if not included and incorrectly
configured.
---
datepicker.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/datepicker.js b/datepicker.js
index 167f48a..b868a4b 100644
--- a/datepicker.js
+++ b/datepicker.js
@@ -221,7 +221,7 @@ var DatePicker = new Class({
this.render();
this.position({x: position.left, y: position.top});
- if(this.options.draggable) {
+ if(this.options.draggable && $type(this.picker.makeDraggable) == 'function') {
this.dragger = this.picker.makeDraggable();
this.picker.setStyle('cursor', 'move');
}
From 8f14a5e7d394d8898f36965d03a33d11ab299c1f Mon Sep 17 00:00:00 2001
From: Chris Baxter
Date: Tue, 2 Feb 2010 14:10:00 +0000
Subject: [PATCH 018/285] Fixed bug with onPrevious and onNext when date > 29
was selected. As per issue 2 in original issue list
---
datepicker.js | 2 ++
1 file changed, 2 insertions(+)
diff --git a/datepicker.js b/datepicker.js
index b868a4b..77bc275 100644
--- a/datepicker.js
+++ b/datepicker.js
@@ -594,6 +594,7 @@ var DatePicker = new Class({
} else if (this.mode == 'year') {
this.d.setFullYear(this.d.getFullYear() - 1);
} else if (this.mode == 'month') {
+ this.d.setDate(1);
this.d.setMonth(this.d.getMonth() - 1);
}
this.render('left');
@@ -605,6 +606,7 @@ var DatePicker = new Class({
} else if (this.mode == 'year') {
this.d.setFullYear(this.d.getFullYear() + 1);
} else if (this.mode == 'month') {
+ this.d.setDate(1);
this.d.setMonth(this.d.getMonth() + 1);
}
this.render('right');
From c9e4cd6482ac54a70268f46be6c58330e795d040 Mon Sep 17 00:00:00 2001
From: Chris Baxter
Date: Tue, 2 Feb 2010 17:22:15 +0000
Subject: [PATCH 019/285] Fix to the picker.previous visibility during on month
display when minDate in use
---
datepicker.js | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/datepicker.js b/datepicker.js
index 77bc275..e521750 100644
--- a/datepicker.js
+++ b/datepicker.js
@@ -474,7 +474,15 @@ var DatePicker = new Class({
this.picker.getElement('.titleText').set('text', this.d.getFullYear());
this.d.setMonth(0);
-
+ if ($chk(this.options.minDate) {
+ this.d.decrement('month',1)
+ this.d.set('date',this.d.get('lastdayofmonth'));
+ if (this.limited('month')) {
+ this.limit.left = true;
+ }
+ this.d.increment('month',1)
+ }
+ this.d.set('date',this.d.get('lastdayofmonth'))
var i, e;
var available = false;
var container = new Element('div', { 'class': 'months' }).inject(this.newContents);
@@ -499,7 +507,8 @@ var DatePicker = new Class({
this.render('fade');
}.bindWithEvent(this, i));
}
- this.d.setMonth(i);
+ this.d.increment('month',1)
+ this.d.set('date',this.d.get('lastdayofmonth'))
}
if (!available) this.limit.right = true;
},
From 8b0e843ecfd2521a7a3305620cb4c38125f20301 Mon Sep 17 00:00:00 2001
From: Chris Baxter
Date: Tue, 2 Feb 2010 17:36:18 +0000
Subject: [PATCH 020/285] Correction to last commit
---
datepicker.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/datepicker.js b/datepicker.js
index e521750..6580cfd 100644
--- a/datepicker.js
+++ b/datepicker.js
@@ -474,7 +474,7 @@ var DatePicker = new Class({
this.picker.getElement('.titleText').set('text', this.d.getFullYear());
this.d.setMonth(0);
- if ($chk(this.options.minDate) {
+ if ($chk(this.options.minDate)) {
this.d.decrement('month',1)
this.d.set('date',this.d.get('lastdayofmonth'));
if (this.limited('month')) {
From 414b6a3af6f8d74f79167e77e12d09143a36383b Mon Sep 17 00:00:00 2001
From: Chris Baxter
Date: Tue, 2 Feb 2010 17:37:44 +0000
Subject: [PATCH 021/285] Update to correct picker.previous visibililty when
minDate is in use
---
datepicker.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/datepicker.js b/datepicker.js
index 6580cfd..2a0270a 100644
--- a/datepicker.js
+++ b/datepicker.js
@@ -446,7 +446,7 @@ var DatePicker = new Class({
e.addClass('unavailable');
if (available) {
this.limit.right = true;
- } else if (this.d.getMonth() == month) {
+ } else {
this.limit.left = true;
}
} else {
From 419322b5efa842157e039da17c01dd4329d3ece6 Mon Sep 17 00:00:00 2001
From: Chris Baxter
Date: Tue, 2 Feb 2010 18:46:54 +0000
Subject: [PATCH 022/285] Fix for picker coordinates were incorrect when main
input is invisible (display none or type hidden)
---
datepicker.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/datepicker.js b/datepicker.js
index 2a0270a..9f3cd88 100644
--- a/datepicker.js
+++ b/datepicker.js
@@ -136,7 +136,7 @@ var DatePicker = new Class({
.setStyle('cursor', 'pointer')
.addEvents({
'click': function(e) {
- this.onFocus(item);
+ this.onFocus(item,togglers[index]);
}.bind(this)
});
} else {
@@ -159,8 +159,8 @@ var DatePicker = new Class({
}.bind(this));
},
- onFocus: function(input) {
- var input_date, d = input.getCoordinates();
+ onFocus: function(input,toggler) {
+ var input_date, d = ($defined(toggler) ? toggler:input).getCoordinates();
if ($chk(input.get('value'))) {
input_date = this.unformat(input.get('value'),this.options.format).valueOf();
From edd07d5805524f382911d1042bc7b734ca6cddca Mon Sep 17 00:00:00 2001
From: Chris Baxter
Date: Wed, 3 Feb 2010 12:33:27 +0000
Subject: [PATCH 023/285] Changed the fireEvent to return just the date object
for onSelect as per original code
---
datepicker.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/datepicker.js b/datepicker.js
index 9f3cd88..ce18251 100644
--- a/datepicker.js
+++ b/datepicker.js
@@ -643,7 +643,7 @@ var DatePicker = new Class({
this.choice = $merge(this.choice, values);
var d = this.dateFromObject(this.choice);
this.input.set('value', this.format(d, this.options.format));
- this.fireEvent('select', this, [d]);
+ this.fireEvent('select', d);
this.close(null, true);
},
From 9a289bef34dc3f3faec2a45641bc87b6aac9d439 Mon Sep 17 00:00:00 2001
From: Chris Baxter
Date: Wed, 3 Feb 2010 12:38:50 +0000
Subject: [PATCH 024/285] Fixed next month image not visible when maxDate
between 1st->6th of next month
---
datepicker.js | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/datepicker.js b/datepicker.js
index ce18251..ec0062e 100644
--- a/datepicker.js
+++ b/datepicker.js
@@ -445,7 +445,9 @@ var DatePicker = new Class({
if (this.limited('date')) {
e.addClass('unavailable');
if (available) {
- this.limit.right = true;
+ if(month == this.d.getMonth() || this.d.getDate() == 1) {
+ this.limit.right = true;
+ }
} else {
this.limit.left = true;
}
From 6cb985ffbacd1a6f6cc48f4885a0a987e558b8f1 Mon Sep 17 00:00:00 2001
From: Arian
Date: Tue, 23 Feb 2010 15:02:15 +0100
Subject: [PATCH 025/285] Make it ready for the mootools forge
---
README.md | 16 ++++++++++++++
datepicker.css => Source/datepicker.css | 0
datepicker.js => Source/datepicker.js | 20 ++++++++++++++++++
.../datepicker_dashboard}/buttons.png | Bin
.../datepicker_dashboard.css | 0
.../datepicker_dashboard}/frame.png | Bin
.../datepicker_jqui}/arrows.png | Bin
.../datepicker_jqui}/datepicker_jqui.css | 0
.../datepicker_jqui}/frame.png | Bin
.../datepicker_vista}/buttons.png | Bin
.../datepicker_vista}/datepicker_vista.css | 0
.../datepicker_vista}/days.png | Bin
.../datepicker_vista}/frame.png | Bin
.../datepicker_vista}/months.png | Bin
.../datepicker_vista}/years.png | Bin
package.yml | 7 ++++++
screenshot.png | Bin 0 -> 14423 bytes
17 files changed, 43 insertions(+)
create mode 100644 README.md
rename datepicker.css => Source/datepicker.css (100%)
rename datepicker.js => Source/datepicker.js (99%)
rename {datepicker_dashboard => Source/datepicker_dashboard}/buttons.png (100%)
rename {datepicker_dashboard => Source/datepicker_dashboard}/datepicker_dashboard.css (100%)
rename {datepicker_dashboard => Source/datepicker_dashboard}/frame.png (100%)
rename {datepicker_jqui => Source/datepicker_jqui}/arrows.png (100%)
rename {datepicker_jqui => Source/datepicker_jqui}/datepicker_jqui.css (100%)
rename {datepicker_jqui => Source/datepicker_jqui}/frame.png (100%)
rename {datepicker_vista => Source/datepicker_vista}/buttons.png (100%)
rename {datepicker_vista => Source/datepicker_vista}/datepicker_vista.css (100%)
rename {datepicker_vista => Source/datepicker_vista}/days.png (100%)
rename {datepicker_vista => Source/datepicker_vista}/frame.png (100%)
rename {datepicker_vista => Source/datepicker_vista}/months.png (100%)
rename {datepicker_vista => Source/datepicker_vista}/years.png (100%)
create mode 100644 package.yml
create mode 100644 screenshot.png
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..e545f39
--- /dev/null
+++ b/README.md
@@ -0,0 +1,16 @@
+MooTools-DatePicker
+===============
+
+Smoothly animating, very configurable and easy to install.
+No Ajax, pure Javascript. 4 skins available out of the box.
+
+![Screenshot](http://github.com/arian/mootools-datepicker/raw/master/screenshot.png)
+
+How to use
+----------
+
+ #JS
+ new DatePicker(input-target-selector [, options-object]);
+
+where the input-target-selector naturally is a MooTools selector (eg. .datepickers or #great_picker). The datepicker will be effective for all selected input elements. Usage examples are given at the bottom of this document.
+
diff --git a/datepicker.css b/Source/datepicker.css
similarity index 100%
rename from datepicker.css
rename to Source/datepicker.css
diff --git a/datepicker.js b/Source/datepicker.js
similarity index 99%
rename from datepicker.js
rename to Source/datepicker.js
index 9c08b52..1f01b3d 100644
--- a/datepicker.js
+++ b/Source/datepicker.js
@@ -1,3 +1,23 @@
+/*
+---
+description: MooTools Datepicker class
+
+authors:
+ - MonkeyPhysics.com
+
+license:
+ - Attribution-Share Alike 3.0 Unported
+
+requires:
+ core/1.2.4: '*'
+
+provides:
+ - [DatePicker]
+
+...
+*/
+
+
/**
* datepicker.js - MooTools Datepicker class
* @version 1.16
diff --git a/datepicker_dashboard/buttons.png b/Source/datepicker_dashboard/buttons.png
similarity index 100%
rename from datepicker_dashboard/buttons.png
rename to Source/datepicker_dashboard/buttons.png
diff --git a/datepicker_dashboard/datepicker_dashboard.css b/Source/datepicker_dashboard/datepicker_dashboard.css
similarity index 100%
rename from datepicker_dashboard/datepicker_dashboard.css
rename to Source/datepicker_dashboard/datepicker_dashboard.css
diff --git a/datepicker_dashboard/frame.png b/Source/datepicker_dashboard/frame.png
similarity index 100%
rename from datepicker_dashboard/frame.png
rename to Source/datepicker_dashboard/frame.png
diff --git a/datepicker_jqui/arrows.png b/Source/datepicker_jqui/arrows.png
similarity index 100%
rename from datepicker_jqui/arrows.png
rename to Source/datepicker_jqui/arrows.png
diff --git a/datepicker_jqui/datepicker_jqui.css b/Source/datepicker_jqui/datepicker_jqui.css
similarity index 100%
rename from datepicker_jqui/datepicker_jqui.css
rename to Source/datepicker_jqui/datepicker_jqui.css
diff --git a/datepicker_jqui/frame.png b/Source/datepicker_jqui/frame.png
similarity index 100%
rename from datepicker_jqui/frame.png
rename to Source/datepicker_jqui/frame.png
diff --git a/datepicker_vista/buttons.png b/Source/datepicker_vista/buttons.png
similarity index 100%
rename from datepicker_vista/buttons.png
rename to Source/datepicker_vista/buttons.png
diff --git a/datepicker_vista/datepicker_vista.css b/Source/datepicker_vista/datepicker_vista.css
similarity index 100%
rename from datepicker_vista/datepicker_vista.css
rename to Source/datepicker_vista/datepicker_vista.css
diff --git a/datepicker_vista/days.png b/Source/datepicker_vista/days.png
similarity index 100%
rename from datepicker_vista/days.png
rename to Source/datepicker_vista/days.png
diff --git a/datepicker_vista/frame.png b/Source/datepicker_vista/frame.png
similarity index 100%
rename from datepicker_vista/frame.png
rename to Source/datepicker_vista/frame.png
diff --git a/datepicker_vista/months.png b/Source/datepicker_vista/months.png
similarity index 100%
rename from datepicker_vista/months.png
rename to Source/datepicker_vista/months.png
diff --git a/datepicker_vista/years.png b/Source/datepicker_vista/years.png
similarity index 100%
rename from datepicker_vista/years.png
rename to Source/datepicker_vista/years.png
diff --git a/package.yml b/package.yml
new file mode 100644
index 0000000..0c46ea0
--- /dev/null
+++ b/package.yml
@@ -0,0 +1,7 @@
+name: MooTools-DatePicker
+author: astolwijk
+current: 1.16
+category: Widgets
+tags: [Datepicker,Calendar]
+demo: http://www.monkeyphysics.com/mootools/script/2/datepicker
+docs: http://www.monkeyphysics.com/mootools/script/2/datepicker
\ No newline at end of file
diff --git a/screenshot.png b/screenshot.png
new file mode 100644
index 0000000000000000000000000000000000000000..4299e9467495608c03a985ec849619b105fc0553
GIT binary patch
literal 14423
zcma*OWmH>H*ELF^P@uRw1TXHc!QI{6i@TNL?rz147brmsMFRwPhvE*!otr-IbKm=o
z@7K*3**V!GIcLjRYt6aVJkhGkGN{Nz$S^Q4sB*HB>M$_xQlQ5}h_KLB>FY%l^y8ho
zx(pDeZk*&0`US~FR?i&<<|FpM_dA%JJOXIv2M;+VsSnGr_^AA3Tud=EFfbG_a+2bj
zKFg>1-iA0b#9*5{zY;16DKXU;`1r+m+gV8^bEUZQE+T((1!MmcB8ySt5?b2Zg?_A$
z8PxOdJJiI*{V-Migg09oy$$wWwsA1odJF1Z?gQS2z$6_L!h%g#E7@(?8(0Ju?_pp}
zg_BgFA732b{hv)EJalCL8q>1IaK?$mCMv}25$Q73ML#dX=KCQd;YiohIbs3}#j+E<
z4l3=~Y9GIVxa>S9qn-Sq)`?lnrmY=}3bKwXy=T6Oy=k(bo4Y&P@g&1^ejP8aQI->3
z{<SkTaY5&e7kn!Zx49?Ro45qFahWnR!DmjqPTf$vGiE
zh{?RlJND0$J7FCApyFBApR-eZY5TUL1@*V$x+k}h#5v`s!uqnJ0WDGnFSTzQqp~j=
zz_~i{gzbZqT9qnS7|UZq0IDvYmU_{Yw&hD(=l0mAHR;n%nT0^=^vA3AeAmZ_wOH6Y
zqy_F|jn4NIZzE)Zo}nBzXXhlsrfq(!e>$vkMq=WqEMhaeIPCX@5dgIAD+b%Wa6E(Q
z#3<56$hNV<3`uGYFY*>^_z0T^mU9nC)@W8-T}QcENt{9vQj#Fy38j)4X8gv-}Iw
zSo4Msy4@L8{0SBi*0F1M(!Y?KQwgE=+V}<0XU6(s>!p!J@5v<77sn>-ja%zSrPJ=9oC#sAq|iI_`$IZffNQy1Niu1AitXx!Spu*y_1W_hX{V}l8|G7wth;wN30Ak$L#y!Fcg4N(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nrlO}!td*J&|6uJ?+E0jnn)EL0hn(zwdbQ7T7Vk5s%vi{})1r_Ee
zZ#U|>f%vsrj75FI$$pgr`D$jI8Y`ZPGmsVOP1hwEShK*;J`eSAgym%c^alx)B5
z(Xa=mFBH3H;vt{0!uTaz_ts9_us;u-|0O8-05ahyn);@(5#Mbv9_1*sa^Eq8=t!@q
zFjlz$3?XtInZ}+TA@GI#J}O*gwjm;t3FH+C{p(YiS~2^)9~ogDa5**fA|S$r15s9D
z<#IvoW^sSWn(*5U&ALc~#|Q}tLFr>M?p&Okn|qeCv#V@rX{oNR{`E_Eqh;=2hRF!@
z1wV4RQA=0%V0(LeZ*OmNlOkQdD9SVm5k~3t!EuOHYvrA&gL~)an`t27~c9nRk)
z^G@t2B{PS!_MSmOUE0;@!VUK#{?4gGiIdl-ovZa~~MbaSx&ctQvdPYMq)e%42
zpX%j7Y4T;p^^pwkUkRa-qb>une>lpvkp=^?RQ(gA5v9*G&QpLC?1~j#`baGdlSQ{D
zm!esznUIhG69OGsq!;vLs{|EV`;jDRsZkalC?CJ7lnhelfJ`}t^+*@-TwX|#H
z?4^h8@rbFV{nNe0b18A6^tl@5$D$DbO3qzL@wJI=hRj=>f1r$dRB_IY1yW-PM}9Dv
zn;652{x{!$ayLt3xOcyplWL_M__ekM*iib|m>}Ao%{jBU!hYV`?n@&ET0?uWRl#oq
zhE{Lq4V`Ua)sG
Date: Tue, 23 Feb 2010 15:16:02 +0100
Subject: [PATCH 026/285] Comment the events in the options object (since it is
no good practice anymore)
---
Source/datepicker.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Source/datepicker.js b/Source/datepicker.js
index 1f01b3d..ebdd087 100644
--- a/Source/datepicker.js
+++ b/Source/datepicker.js
@@ -88,12 +88,12 @@ var DatePicker = new Class({
minDate: null, // { date: '[date-string]', format: '[date-string-interpretation-format]' }
maxDate: null, // same as minDate
debug: false,
- toggleElements: null,
+ toggleElements: null/*,
// and some event hooks:
onShow: $empty, // triggered when the datepicker pops up
onClose: $empty, // triggered after the datepicker is closed (destroyed)
- onSelect: $empty // triggered when a date is selected
+ onSelect: $empty // triggered when a date is selected*/
},
initialize: function(attachTo, options) {
From 11f4e01a4382cba5847a62c8bb7a911381240482 Mon Sep 17 00:00:00 2001
From: Arian
Date: Tue, 23 Feb 2010 15:32:16 +0100
Subject: [PATCH 027/285] Replace $$() and $() functions for resp
document.getElements and document.id
---
Source/datepicker.js | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/Source/datepicker.js b/Source/datepicker.js
index ebdd087..e0dc5db 100644
--- a/Source/datepicker.js
+++ b/Source/datepicker.js
@@ -131,10 +131,9 @@ var DatePicker = new Class({
}.bind(this)
});
};
-
+
// attach functionality to the inputs
- $$(this.attachTo).each(function(item, index) {
-
+ document.getElements(this.attachTo).each(function(item, index) {
// never double attach
if (item.retrieve('datepicker')) return;
@@ -603,7 +602,7 @@ var DatePicker = new Class({
},
close: function(e, force) {
- if (!$(this.picker)) return;
+ if (!document.id(this.picker)) return;
var clickOutside = ($chk(e) && e.target != this.picker && !this.picker.hasChild(e.target) && e.target != this.visual);
if (force || clickOutside) {
if (this.options.useFadeInOut) {
From 780abe3039e8fde259cf4aa5e8d849a03fc3b0e3 Mon Sep 17 00:00:00 2001
From: Arian
Date: Tue, 23 Feb 2010 15:38:15 +0100
Subject: [PATCH 028/285] Add a demo
---
Test/index.html | 71 +
Test/mootools-1.2.4-core.js | 4329 +++++++++++++++++++++++++++++++++++
Test/style.css | 121 +
3 files changed, 4521 insertions(+)
create mode 100644 Test/index.html
create mode 100644 Test/mootools-1.2.4-core.js
create mode 100644 Test/style.css
diff --git a/Test/index.html b/Test/index.html
new file mode 100644
index 0000000..4075321
--- /dev/null
+++ b/Test/index.html
@@ -0,0 +1,71 @@
+
+
+
+
+
+MooTools Datepicker
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+MooTools Datepicker
+
+
+ Smoothly animating, very configurable and easy to install. No Ajax, pure Javascript.
+
+
+
+ More information and the original: Monkey Physics
+
+
+
+Demo and Examples
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Test/mootools-1.2.4-core.js b/Test/mootools-1.2.4-core.js
new file mode 100644
index 0000000..0098571
--- /dev/null
+++ b/Test/mootools-1.2.4-core.js
@@ -0,0 +1,4329 @@
+/*
+---
+
+script: Core.js
+
+description: The core of MooTools, contains all the base functions and the Native and Hash implementations. Required by all the other scripts.
+
+license: MIT-style license.
+
+copyright: Copyright (c) 2006-2008 [Valerio Proietti](http://mad4milk.net/).
+
+authors: The MooTools production team (http://mootools.net/developers/)
+
+inspiration:
+- Class implementation inspired by [Base.js](http://dean.edwards.name/weblog/2006/03/base/) Copyright (c) 2006 Dean Edwards, [GNU Lesser General Public License](http://opensource.org/licenses/lgpl-license.php)
+- Some functionality inspired by [Prototype.js](http://prototypejs.org) Copyright (c) 2005-2007 Sam Stephenson, [MIT License](http://opensource.org/licenses/mit-license.php)
+
+provides: [Mootools, Native, Hash.base, Array.each, $util]
+
+...
+*/
+
+var MooTools = {
+ 'version': '1.2.4',
+ 'build': '0d9113241a90b9cd5643b926795852a2026710d4'
+};
+
+var Native = function(options){
+ options = options || {};
+ var name = options.name;
+ var legacy = options.legacy;
+ var protect = options.protect;
+ var methods = options.implement;
+ var generics = options.generics;
+ var initialize = options.initialize;
+ var afterImplement = options.afterImplement || function(){};
+ var object = initialize || legacy;
+ generics = generics !== false;
+
+ object.constructor = Native;
+ object.$family = {name: 'native'};
+ if (legacy && initialize) object.prototype = legacy.prototype;
+ object.prototype.constructor = object;
+
+ if (name){
+ var family = name.toLowerCase();
+ object.prototype.$family = {name: family};
+ Native.typize(object, family);
+ }
+
+ var add = function(obj, name, method, force){
+ if (!protect || force || !obj.prototype[name]) obj.prototype[name] = method;
+ if (generics) Native.genericize(obj, name, protect);
+ afterImplement.call(obj, name, method);
+ return obj;
+ };
+
+ object.alias = function(a1, a2, a3){
+ if (typeof a1 == 'string'){
+ var pa1 = this.prototype[a1];
+ if ((a1 = pa1)) return add(this, a2, a1, a3);
+ }
+ for (var a in a1) this.alias(a, a1[a], a2);
+ return this;
+ };
+
+ object.implement = function(a1, a2, a3){
+ if (typeof a1 == 'string') return add(this, a1, a2, a3);
+ for (var p in a1) add(this, p, a1[p], a2);
+ return this;
+ };
+
+ if (methods) object.implement(methods);
+
+ return object;
+};
+
+Native.genericize = function(object, property, check){
+ if ((!check || !object[property]) && typeof object.prototype[property] == 'function') object[property] = function(){
+ var args = Array.prototype.slice.call(arguments);
+ return object.prototype[property].apply(args.shift(), args);
+ };
+};
+
+Native.implement = function(objects, properties){
+ for (var i = 0, l = objects.length; i < l; i++) objects[i].implement(properties);
+};
+
+Native.typize = function(object, family){
+ if (!object.type) object.type = function(item){
+ return ($type(item) === family);
+ };
+};
+
+(function(){
+ var natives = {'Array': Array, 'Date': Date, 'Function': Function, 'Number': Number, 'RegExp': RegExp, 'String': String};
+ for (var n in natives) new Native({name: n, initialize: natives[n], protect: true});
+
+ var types = {'boolean': Boolean, 'native': Native, 'object': Object};
+ for (var t in types) Native.typize(types[t], t);
+
+ var generics = {
+ 'Array': ["concat", "indexOf", "join", "lastIndexOf", "pop", "push", "reverse", "shift", "slice", "sort", "splice", "toString", "unshift", "valueOf"],
+ 'String': ["charAt", "charCodeAt", "concat", "indexOf", "lastIndexOf", "match", "replace", "search", "slice", "split", "substr", "substring", "toLowerCase", "toUpperCase", "valueOf"]
+ };
+ for (var g in generics){
+ for (var i = generics[g].length; i--;) Native.genericize(natives[g], generics[g][i], true);
+ }
+})();
+
+var Hash = new Native({
+
+ name: 'Hash',
+
+ initialize: function(object){
+ if ($type(object) == 'hash') object = $unlink(object.getClean());
+ for (var key in object) this[key] = object[key];
+ return this;
+ }
+
+});
+
+Hash.implement({
+
+ forEach: function(fn, bind){
+ for (var key in this){
+ if (this.hasOwnProperty(key)) fn.call(bind, this[key], key, this);
+ }
+ },
+
+ getClean: function(){
+ var clean = {};
+ for (var key in this){
+ if (this.hasOwnProperty(key)) clean[key] = this[key];
+ }
+ return clean;
+ },
+
+ getLength: function(){
+ var length = 0;
+ for (var key in this){
+ if (this.hasOwnProperty(key)) length++;
+ }
+ return length;
+ }
+
+});
+
+Hash.alias('forEach', 'each');
+
+Array.implement({
+
+ forEach: function(fn, bind){
+ for (var i = 0, l = this.length; i < l; i++) fn.call(bind, this[i], i, this);
+ }
+
+});
+
+Array.alias('forEach', 'each');
+
+function $A(iterable){
+ if (iterable.item){
+ var l = iterable.length, array = new Array(l);
+ while (l--) array[l] = iterable[l];
+ return array;
+ }
+ return Array.prototype.slice.call(iterable);
+};
+
+function $arguments(i){
+ return function(){
+ return arguments[i];
+ };
+};
+
+function $chk(obj){
+ return !!(obj || obj === 0);
+};
+
+function $clear(timer){
+ clearTimeout(timer);
+ clearInterval(timer);
+ return null;
+};
+
+function $defined(obj){
+ return (obj != undefined);
+};
+
+function $each(iterable, fn, bind){
+ var type = $type(iterable);
+ ((type == 'arguments' || type == 'collection' || type == 'array') ? Array : Hash).each(iterable, fn, bind);
+};
+
+function $empty(){};
+
+function $extend(original, extended){
+ for (var key in (extended || {})) original[key] = extended[key];
+ return original;
+};
+
+function $H(object){
+ return new Hash(object);
+};
+
+function $lambda(value){
+ return ($type(value) == 'function') ? value : function(){
+ return value;
+ };
+};
+
+function $merge(){
+ var args = Array.slice(arguments);
+ args.unshift({});
+ return $mixin.apply(null, args);
+};
+
+function $mixin(mix){
+ for (var i = 1, l = arguments.length; i < l; i++){
+ var object = arguments[i];
+ if ($type(object) != 'object') continue;
+ for (var key in object){
+ var op = object[key], mp = mix[key];
+ mix[key] = (mp && $type(op) == 'object' && $type(mp) == 'object') ? $mixin(mp, op) : $unlink(op);
+ }
+ }
+ return mix;
+};
+
+function $pick(){
+ for (var i = 0, l = arguments.length; i < l; i++){
+ if (arguments[i] != undefined) return arguments[i];
+ }
+ return null;
+};
+
+function $random(min, max){
+ return Math.floor(Math.random() * (max - min + 1) + min);
+};
+
+function $splat(obj){
+ var type = $type(obj);
+ return (type) ? ((type != 'array' && type != 'arguments') ? [obj] : obj) : [];
+};
+
+var $time = Date.now || function(){
+ return +new Date;
+};
+
+function $try(){
+ for (var i = 0, l = arguments.length; i < l; i++){
+ try {
+ return arguments[i]();
+ } catch(e){}
+ }
+ return null;
+};
+
+function $type(obj){
+ if (obj == undefined) return false;
+ if (obj.$family) return (obj.$family.name == 'number' && !isFinite(obj)) ? false : obj.$family.name;
+ if (obj.nodeName){
+ switch (obj.nodeType){
+ case 1: return 'element';
+ case 3: return (/\S/).test(obj.nodeValue) ? 'textnode' : 'whitespace';
+ }
+ } else if (typeof obj.length == 'number'){
+ if (obj.callee) return 'arguments';
+ else if (obj.item) return 'collection';
+ }
+ return typeof obj;
+};
+
+function $unlink(object){
+ var unlinked;
+ switch ($type(object)){
+ case 'object':
+ unlinked = {};
+ for (var p in object) unlinked[p] = $unlink(object[p]);
+ break;
+ case 'hash':
+ unlinked = new Hash(object);
+ break;
+ case 'array':
+ unlinked = [];
+ for (var i = 0, l = object.length; i < l; i++) unlinked[i] = $unlink(object[i]);
+ break;
+ default: return object;
+ }
+ return unlinked;
+};
+
+
+/*
+---
+
+script: Browser.js
+
+description: The Browser Core. Contains Browser initialization, Window and Document, and the Browser Hash.
+
+license: MIT-style license.
+
+requires:
+- /Native
+- /$util
+
+provides: [Browser, Window, Document, $exec]
+
+...
+*/
+
+var Browser = $merge({
+
+ Engine: {name: 'unknown', version: 0},
+
+ Platform: {name: (window.orientation != undefined) ? 'ipod' : (navigator.platform.match(/mac|win|linux/i) || ['other'])[0].toLowerCase()},
+
+ Features: {xpath: !!(document.evaluate), air: !!(window.runtime), query: !!(document.querySelector)},
+
+ Plugins: {},
+
+ Engines: {
+
+ presto: function(){
+ return (!window.opera) ? false : ((arguments.callee.caller) ? 960 : ((document.getElementsByClassName) ? 950 : 925));
+ },
+
+ trident: function(){
+ return (!window.ActiveXObject) ? false : ((window.XMLHttpRequest) ? ((document.querySelectorAll) ? 6 : 5) : 4);
+ },
+
+ webkit: function(){
+ return (navigator.taintEnabled) ? false : ((Browser.Features.xpath) ? ((Browser.Features.query) ? 525 : 420) : 419);
+ },
+
+ gecko: function(){
+ return (!document.getBoxObjectFor && window.mozInnerScreenX == null) ? false : ((document.getElementsByClassName) ? 19 : 18);
+ }
+
+ }
+
+}, Browser || {});
+
+Browser.Platform[Browser.Platform.name] = true;
+
+Browser.detect = function(){
+
+ for (var engine in this.Engines){
+ var version = this.Engines[engine]();
+ if (version){
+ this.Engine = {name: engine, version: version};
+ this.Engine[engine] = this.Engine[engine + version] = true;
+ break;
+ }
+ }
+
+ return {name: engine, version: version};
+
+};
+
+Browser.detect();
+
+Browser.Request = function(){
+ return $try(function(){
+ return new XMLHttpRequest();
+ }, function(){
+ return new ActiveXObject('MSXML2.XMLHTTP');
+ }, function(){
+ return new ActiveXObject('Microsoft.XMLHTTP');
+ });
+};
+
+Browser.Features.xhr = !!(Browser.Request());
+
+Browser.Plugins.Flash = (function(){
+ var version = ($try(function(){
+ return navigator.plugins['Shockwave Flash'].description;
+ }, function(){
+ return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version');
+ }) || '0 r0').match(/\d+/g);
+ return {version: parseInt(version[0] || 0 + '.' + version[1], 10) || 0, build: parseInt(version[2], 10) || 0};
+})();
+
+function $exec(text){
+ if (!text) return text;
+ if (window.execScript){
+ window.execScript(text);
+ } else {
+ var script = document.createElement('script');
+ script.setAttribute('type', 'text/javascript');
+ script[(Browser.Engine.webkit && Browser.Engine.version < 420) ? 'innerText' : 'text'] = text;
+ document.head.appendChild(script);
+ document.head.removeChild(script);
+ }
+ return text;
+};
+
+Native.UID = 1;
+
+var $uid = (Browser.Engine.trident) ? function(item){
+ return (item.uid || (item.uid = [Native.UID++]))[0];
+} : function(item){
+ return item.uid || (item.uid = Native.UID++);
+};
+
+var Window = new Native({
+
+ name: 'Window',
+
+ legacy: (Browser.Engine.trident) ? null: window.Window,
+
+ initialize: function(win){
+ $uid(win);
+ if (!win.Element){
+ win.Element = $empty;
+ if (Browser.Engine.webkit) win.document.createElement("iframe"); //fixes safari 2
+ win.Element.prototype = (Browser.Engine.webkit) ? window["[[DOMElement.prototype]]"] : {};
+ }
+ win.document.window = win;
+ return $extend(win, Window.Prototype);
+ },
+
+ afterImplement: function(property, value){
+ window[property] = Window.Prototype[property] = value;
+ }
+
+});
+
+Window.Prototype = {$family: {name: 'window'}};
+
+new Window(window);
+
+var Document = new Native({
+
+ name: 'Document',
+
+ legacy: (Browser.Engine.trident) ? null: window.Document,
+
+ initialize: function(doc){
+ $uid(doc);
+ doc.head = doc.getElementsByTagName('head')[0];
+ doc.html = doc.getElementsByTagName('html')[0];
+ if (Browser.Engine.trident && Browser.Engine.version <= 4) $try(function(){
+ doc.execCommand("BackgroundImageCache", false, true);
+ });
+ if (Browser.Engine.trident) doc.window.attachEvent('onunload', function(){
+ doc.window.detachEvent('onunload', arguments.callee);
+ doc.head = doc.html = doc.window = null;
+ });
+ return $extend(doc, Document.Prototype);
+ },
+
+ afterImplement: function(property, value){
+ document[property] = Document.Prototype[property] = value;
+ }
+
+});
+
+Document.Prototype = {$family: {name: 'document'}};
+
+new Document(document);
+
+
+/*
+---
+
+script: Array.js
+
+description: Contains Array Prototypes like each, contains, and erase.
+
+license: MIT-style license.
+
+requires:
+- /$util
+- /Array.each
+
+provides: [Array]
+
+...
+*/
+
+Array.implement({
+
+ every: function(fn, bind){
+ for (var i = 0, l = this.length; i < l; i++){
+ if (!fn.call(bind, this[i], i, this)) return false;
+ }
+ return true;
+ },
+
+ filter: function(fn, bind){
+ var results = [];
+ for (var i = 0, l = this.length; i < l; i++){
+ if (fn.call(bind, this[i], i, this)) results.push(this[i]);
+ }
+ return results;
+ },
+
+ clean: function(){
+ return this.filter($defined);
+ },
+
+ indexOf: function(item, from){
+ var len = this.length;
+ for (var i = (from < 0) ? Math.max(0, len + from) : from || 0; i < len; i++){
+ if (this[i] === item) return i;
+ }
+ return -1;
+ },
+
+ map: function(fn, bind){
+ var results = [];
+ for (var i = 0, l = this.length; i < l; i++) results[i] = fn.call(bind, this[i], i, this);
+ return results;
+ },
+
+ some: function(fn, bind){
+ for (var i = 0, l = this.length; i < l; i++){
+ if (fn.call(bind, this[i], i, this)) return true;
+ }
+ return false;
+ },
+
+ associate: function(keys){
+ var obj = {}, length = Math.min(this.length, keys.length);
+ for (var i = 0; i < length; i++) obj[keys[i]] = this[i];
+ return obj;
+ },
+
+ link: function(object){
+ var result = {};
+ for (var i = 0, l = this.length; i < l; i++){
+ for (var key in object){
+ if (object[key](this[i])){
+ result[key] = this[i];
+ delete object[key];
+ break;
+ }
+ }
+ }
+ return result;
+ },
+
+ contains: function(item, from){
+ return this.indexOf(item, from) != -1;
+ },
+
+ extend: function(array){
+ for (var i = 0, j = array.length; i < j; i++) this.push(array[i]);
+ return this;
+ },
+
+ getLast: function(){
+ return (this.length) ? this[this.length - 1] : null;
+ },
+
+ getRandom: function(){
+ return (this.length) ? this[$random(0, this.length - 1)] : null;
+ },
+
+ include: function(item){
+ if (!this.contains(item)) this.push(item);
+ return this;
+ },
+
+ combine: function(array){
+ for (var i = 0, l = array.length; i < l; i++) this.include(array[i]);
+ return this;
+ },
+
+ erase: function(item){
+ for (var i = this.length; i--; i){
+ if (this[i] === item) this.splice(i, 1);
+ }
+ return this;
+ },
+
+ empty: function(){
+ this.length = 0;
+ return this;
+ },
+
+ flatten: function(){
+ var array = [];
+ for (var i = 0, l = this.length; i < l; i++){
+ var type = $type(this[i]);
+ if (!type) continue;
+ array = array.concat((type == 'array' || type == 'collection' || type == 'arguments') ? Array.flatten(this[i]) : this[i]);
+ }
+ return array;
+ },
+
+ hexToRgb: function(array){
+ if (this.length != 3) return null;
+ var rgb = this.map(function(value){
+ if (value.length == 1) value += value;
+ return value.toInt(16);
+ });
+ return (array) ? rgb : 'rgb(' + rgb + ')';
+ },
+
+ rgbToHex: function(array){
+ if (this.length < 3) return null;
+ if (this.length == 4 && this[3] == 0 && !array) return 'transparent';
+ var hex = [];
+ for (var i = 0; i < 3; i++){
+ var bit = (this[i] - 0).toString(16);
+ hex.push((bit.length == 1) ? '0' + bit : bit);
+ }
+ return (array) ? hex : '#' + hex.join('');
+ }
+
+});
+
+
+/*
+---
+
+script: Function.js
+
+description: Contains Function Prototypes like create, bind, pass, and delay.
+
+license: MIT-style license.
+
+requires:
+- /Native
+- /$util
+
+provides: [Function]
+
+...
+*/
+
+Function.implement({
+
+ extend: function(properties){
+ for (var property in properties) this[property] = properties[property];
+ return this;
+ },
+
+ create: function(options){
+ var self = this;
+ options = options || {};
+ return function(event){
+ var args = options.arguments;
+ args = (args != undefined) ? $splat(args) : Array.slice(arguments, (options.event) ? 1 : 0);
+ if (options.event) args = [event || window.event].extend(args);
+ var returns = function(){
+ return self.apply(options.bind || null, args);
+ };
+ if (options.delay) return setTimeout(returns, options.delay);
+ if (options.periodical) return setInterval(returns, options.periodical);
+ if (options.attempt) return $try(returns);
+ return returns();
+ };
+ },
+
+ run: function(args, bind){
+ return this.apply(bind, $splat(args));
+ },
+
+ pass: function(args, bind){
+ return this.create({bind: bind, arguments: args});
+ },
+
+ bind: function(bind, args){
+ return this.create({bind: bind, arguments: args});
+ },
+
+ bindWithEvent: function(bind, args){
+ return this.create({bind: bind, arguments: args, event: true});
+ },
+
+ attempt: function(args, bind){
+ return this.create({bind: bind, arguments: args, attempt: true})();
+ },
+
+ delay: function(delay, bind, args){
+ return this.create({bind: bind, arguments: args, delay: delay})();
+ },
+
+ periodical: function(periodical, bind, args){
+ return this.create({bind: bind, arguments: args, periodical: periodical})();
+ }
+
+});
+
+
+/*
+---
+
+script: Number.js
+
+description: Contains Number Prototypes like limit, round, times, and ceil.
+
+license: MIT-style license.
+
+requires:
+- /Native
+- /$util
+
+provides: [Number]
+
+...
+*/
+
+Number.implement({
+
+ limit: function(min, max){
+ return Math.min(max, Math.max(min, this));
+ },
+
+ round: function(precision){
+ precision = Math.pow(10, precision || 0);
+ return Math.round(this * precision) / precision;
+ },
+
+ times: function(fn, bind){
+ for (var i = 0; i < this; i++) fn.call(bind, i, this);
+ },
+
+ toFloat: function(){
+ return parseFloat(this);
+ },
+
+ toInt: function(base){
+ return parseInt(this, base || 10);
+ }
+
+});
+
+Number.alias('times', 'each');
+
+(function(math){
+ var methods = {};
+ math.each(function(name){
+ if (!Number[name]) methods[name] = function(){
+ return Math[name].apply(null, [this].concat($A(arguments)));
+ };
+ });
+ Number.implement(methods);
+})(['abs', 'acos', 'asin', 'atan', 'atan2', 'ceil', 'cos', 'exp', 'floor', 'log', 'max', 'min', 'pow', 'sin', 'sqrt', 'tan']);
+
+
+/*
+---
+
+script: String.js
+
+description: Contains String Prototypes like camelCase, capitalize, test, and toInt.
+
+license: MIT-style license.
+
+requires:
+- /Native
+
+provides: [String]
+
+...
+*/
+
+String.implement({
+
+ test: function(regex, params){
+ return ((typeof regex == 'string') ? new RegExp(regex, params) : regex).test(this);
+ },
+
+ contains: function(string, separator){
+ return (separator) ? (separator + this + separator).indexOf(separator + string + separator) > -1 : this.indexOf(string) > -1;
+ },
+
+ trim: function(){
+ return this.replace(/^\s+|\s+$/g, '');
+ },
+
+ clean: function(){
+ return this.replace(/\s+/g, ' ').trim();
+ },
+
+ camelCase: function(){
+ return this.replace(/-\D/g, function(match){
+ return match.charAt(1).toUpperCase();
+ });
+ },
+
+ hyphenate: function(){
+ return this.replace(/[A-Z]/g, function(match){
+ return ('-' + match.charAt(0).toLowerCase());
+ });
+ },
+
+ capitalize: function(){
+ return this.replace(/\b[a-z]/g, function(match){
+ return match.toUpperCase();
+ });
+ },
+
+ escapeRegExp: function(){
+ return this.replace(/([-.*+?^${}()|[\]\/\\])/g, '\\$1');
+ },
+
+ toInt: function(base){
+ return parseInt(this, base || 10);
+ },
+
+ toFloat: function(){
+ return parseFloat(this);
+ },
+
+ hexToRgb: function(array){
+ var hex = this.match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/);
+ return (hex) ? hex.slice(1).hexToRgb(array) : null;
+ },
+
+ rgbToHex: function(array){
+ var rgb = this.match(/\d{1,3}/g);
+ return (rgb) ? rgb.rgbToHex(array) : null;
+ },
+
+ stripScripts: function(option){
+ var scripts = '';
+ var text = this.replace(/
+
@@ -148,8 +155,8 @@ Demo and Examples
-Click to attach the datpicker to this field
-Click to detach the datpicker from this field
+Click to attach the datepicker to this field
+Click to detach the datepicker from this field
Show datepicker (after you attached it)
@@ -172,5 +179,12 @@
Demo and Examples
+
+
+
+
+
+
+