diff --git a/README.md b/README.md
index 248ade7..9aadec3 100755
--- a/README.md
+++ b/README.md
@@ -46,7 +46,17 @@ exactly the path.
### Basic Usages
```js
var myCalendar = new ax5.ui.calendar();
-myCalendar.setConfig();
+myCalendar.setConfig({
+ target: document.getElementById("calendar-target"),
+ displayDate: (new Date()),
+ onClick: function () {
+ console.log(this);
+ console.log(myCalendar.getSelection());
+ },
+ onStateChanged: function () {
+ console.log(this);
+ }
+});
```
- - -
diff --git a/dist/ax5calendar.css b/dist/ax5calendar.css
index 5a5f6fc..8133a26 100644
--- a/dist/ax5calendar.css
+++ b/dist/ax5calendar.css
@@ -1 +1 @@
-@-webkit-keyframes ax5-ui-calendar-fadeout{from{opacity:1.0}to{opacity:0.0}}@-moz-keyframes ax5-ui-calendar-fadeout{from{opacity:1.0}to{opacity:0.0}}@keyframes ax5-ui-calendar-fadeout{from{opacity:1.0}to{opacity:0.0}}@-webkit-keyframes ax5-ui-calendar-fadein{from{opacity:0.0}to{opacity:1.0}}@-moz-keyframes ax5-ui-calendar-fadein{from{opacity:0.0}to{opacity:1.0}}@keyframes ax5-ui-calendar-fadein{from{opacity:0.0}to{opacity:1.0}}.ax5-ui-calendar{box-sizing:border-box;position:relative}.ax5-ui-calendar .calendar-control{position:relative;box-sizing:content-box;background-color:#f5f5f5;background-image:-webkit-linear-gradient(bottom, #f5f5f5);background-image:linear-gradient(to top,#f5f5f5);border:1px solid #ddd;border-radius:5px;font-size:18px;margin-bottom:5px;color:#333}.ax5-ui-calendar .calendar-control .date-move-left,.ax5-ui-calendar .calendar-control .date-move-right{display:block;position:absolute;overflow:hidden;text-align:center;font-size:22px;cursor:pointer;text-decoration:none}.ax5-ui-calendar .calendar-control .date-move-left i,.ax5-ui-calendar .calendar-control .date-move-left span,.ax5-ui-calendar .calendar-control .date-move-right i,.ax5-ui-calendar .calendar-control .date-move-right span{line-height:inherit}.ax5-ui-calendar .calendar-control .date-move-left{left:0px;top:0px}.ax5-ui-calendar .calendar-control .date-move-right{right:0px;top:0px}.ax5-ui-calendar .calendar-control .date-display{text-align:center}.ax5-ui-calendar .calendar-control .date-display [data-calendar-display]{margin:0px 10px;cursor:pointer;text-decoration:underline}.ax5-ui-calendar .calendar-control a{color:#333}.ax5-ui-calendar .calendar-control a:hover{color:#337ab7}.ax5-ui-calendar .calendar-body.fadein{-webkit-animation:ax5-ui-calendar-fadein 0.3s ease-in-out;-moz-animation:ax5-ui-calendar-fadein 0.3s ease-in-out;animation:ax5-ui-calendar-fadein 0.3s ease-in-out;opacity:1.0}.ax5-ui-calendar .calendar-body.fadeout{-webkit-animation:ax5-ui-calendar-fadeout 0.3s ease-in-out;-moz-animation:ax5-ui-calendar-fadeout 0.3s ease-in-out;animation:ax5-ui-calendar-fadeout 0.3s ease-in-out;opacity:0.0}.ax5-ui-calendar .calendar-body table{box-sizing:border-box;table-layout:fixed;border-collapse:collapse;border-spacing:0px}.ax5-ui-calendar .calendar-body table thead td,.ax5-ui-calendar .calendar-body table thead th{box-sizing:border-box;vertical-align:middle;line-height:1em;cursor:pointer;text-align:center;font-size:12px;padding:10px 2px;border:0px none;background-color:#fff;background-image:-webkit-linear-gradient(bottom, #fff,#fff);background-image:linear-gradient(to top,#fff,#fff);color:#6D6E70}.ax5-ui-calendar .calendar-body table thead td.calendar-col-0,.ax5-ui-calendar .calendar-body table thead th.calendar-col-0{color:#C78B81}.ax5-ui-calendar .calendar-body table thead td.calendar-col-6,.ax5-ui-calendar .calendar-body table thead th.calendar-col-6{color:#32B4DC}.ax5-ui-calendar .calendar-body table tbody td,.ax5-ui-calendar .calendar-body table tbody th{box-sizing:border-box;vertical-align:middle;line-height:1em;cursor:pointer;text-align:center;font-size:14px;border:0px none;background-color:#fff;background-image:-webkit-linear-gradient(bottom, #fff,#fff);background-image:linear-gradient(to top,#fff,#fff);overflow:hidden}.ax5-ui-calendar .calendar-body table tbody td .calendar-item-day,.ax5-ui-calendar .calendar-body table tbody th .calendar-item-day{position:relative;display:block;width:100%;height:100%;vertical-align:middle;border-radius:5px;overflow:hidden;line-height:inherit;background-color:#fff;background-image:-webkit-linear-gradient(bottom, #fff,#fff);background-image:linear-gradient(to top,#fff,#fff);color:#C3C4C6;font-size:16px}.ax5-ui-calendar .calendar-body table tbody td .calendar-item-day span.addon,.ax5-ui-calendar .calendar-body table tbody th .calendar-item-day span.addon{position:absolute;left:0px;top:0px;width:100%;text-align:center;line-height:10px}.ax5-ui-calendar .calendar-body table tbody td .calendar-item-day span.lunar,.ax5-ui-calendar .calendar-body table tbody th .calendar-item-day span.lunar{position:absolute;left:0px;bottom:3px;width:100%;text-align:center;font-size:12px;color:#eee;line-height:12px}.ax5-ui-calendar .calendar-body table tbody td .calendar-item-day.live,.ax5-ui-calendar .calendar-body table tbody th .calendar-item-day.live{background-color:#F0F0F0;background-image:-webkit-linear-gradient(bottom, #F0F0F0,#F0F0F0);background-image:linear-gradient(to top,#F0F0F0,#F0F0F0);color:#6D6E70}.ax5-ui-calendar .calendar-body table tbody td .calendar-item-day.live span.addon,.ax5-ui-calendar .calendar-body table tbody th .calendar-item-day.live span.addon{color:#A1A1A1}.ax5-ui-calendar .calendar-body table tbody td .calendar-item-day.live span.lunar,.ax5-ui-calendar .calendar-body table tbody th .calendar-item-day.live span.lunar{color:#A1A1A1}.ax5-ui-calendar .calendar-body table tbody td .calendar-item-day.focus,.ax5-ui-calendar .calendar-body table tbody th .calendar-item-day.focus{background-color:#E67241;background-image:-webkit-linear-gradient(bottom, #E67241,#E67241);background-image:linear-gradient(to top,#E67241,#E67241);color:#fff}.ax5-ui-calendar .calendar-body table tbody td .calendar-item-day.focus span.addon,.ax5-ui-calendar .calendar-body table tbody th .calendar-item-day.focus span.addon{color:#fff}.ax5-ui-calendar .calendar-body table tbody td .calendar-item-day.focus span.lunar,.ax5-ui-calendar .calendar-body table tbody th .calendar-item-day.focus span.lunar{color:#fff}.ax5-ui-calendar .calendar-body table tbody td .calendar-item-day.focus.hover,.ax5-ui-calendar .calendar-body table tbody th .calendar-item-day.focus.hover{background-color:#32B4DC;background-image:-webkit-linear-gradient(bottom, #32B4DC,#32B4DC);background-image:linear-gradient(to top,#32B4DC,#32B4DC);color:#fff !important}.ax5-ui-calendar .calendar-body table tbody td .calendar-item-day.focus.hover span.addon,.ax5-ui-calendar .calendar-body table tbody th .calendar-item-day.focus.hover span.addon{color:#fff}.ax5-ui-calendar .calendar-body table tbody td .calendar-item-day.focus.hover span.lunar,.ax5-ui-calendar .calendar-body table tbody th .calendar-item-day.focus.hover span.lunar{color:#fff}.ax5-ui-calendar .calendar-body table tbody td .calendar-item-day.hover,.ax5-ui-calendar .calendar-body table tbody th .calendar-item-day.hover{background-color:#32B4DC;background-image:-webkit-linear-gradient(bottom, #32B4DC,#32B4DC);background-image:linear-gradient(to top,#32B4DC,#32B4DC);color:#fff !important}.ax5-ui-calendar .calendar-body table tbody td .calendar-item-day.hover span.addon,.ax5-ui-calendar .calendar-body table tbody th .calendar-item-day.hover span.addon{color:#fff}.ax5-ui-calendar .calendar-body table tbody td .calendar-item-day.hover span.lunar,.ax5-ui-calendar .calendar-body table tbody th .calendar-item-day.hover span.lunar{color:#fff}.ax5-ui-calendar .calendar-body table tbody td .calendar-item-day.disable,.ax5-ui-calendar .calendar-body table tbody th .calendar-item-day.disable{background-color:#fff;background-image:-webkit-linear-gradient(bottom, #fff,#fff);background-image:linear-gradient(to top,#fff,#fff);color:#dddedf}.ax5-ui-calendar .calendar-body table tbody td .calendar-item-month,.ax5-ui-calendar .calendar-body table tbody th .calendar-item-month{display:block;width:100%;height:100%;vertical-align:middle;border-radius:5px;overflow:hidden;line-height:inherit;background-color:#fff;background-image:-webkit-linear-gradient(bottom, #fff,#fff);background-image:linear-gradient(to top,#fff,#fff);color:#C3C4C6;font-size:16px}.ax5-ui-calendar .calendar-body table tbody td .calendar-item-month.live,.ax5-ui-calendar .calendar-body table tbody th .calendar-item-month.live{background-color:#F0F0F0;background-image:-webkit-linear-gradient(bottom, #F0F0F0,#F0F0F0);background-image:linear-gradient(to top,#F0F0F0,#F0F0F0);color:#6D6E70}.ax5-ui-calendar .calendar-body table tbody td .calendar-item-month.hover,.ax5-ui-calendar .calendar-body table tbody th .calendar-item-month.hover{background-color:#32B4DC;background-image:-webkit-linear-gradient(bottom, #32B4DC,#32B4DC);background-image:linear-gradient(to top,#32B4DC,#32B4DC);color:#fff}.ax5-ui-calendar .calendar-body table tbody td .calendar-item-month.focus,.ax5-ui-calendar .calendar-body table tbody th .calendar-item-month.focus{background-color:#E67241;background-image:-webkit-linear-gradient(bottom, #E67241,#E67241);background-image:linear-gradient(to top,#E67241,#E67241);color:#fff}.ax5-ui-calendar .calendar-body table tbody td .calendar-item-year,.ax5-ui-calendar .calendar-body table tbody th .calendar-item-year{display:block;width:100%;height:100%;vertical-align:middle;border-radius:5px;overflow:hidden;line-height:inherit;background-color:#fff;background-image:-webkit-linear-gradient(bottom, #fff,#fff);background-image:linear-gradient(to top,#fff,#fff);color:#C3C4C6;font-size:16px}.ax5-ui-calendar .calendar-body table tbody td .calendar-item-year.live,.ax5-ui-calendar .calendar-body table tbody th .calendar-item-year.live{background-color:#F0F0F0;background-image:-webkit-linear-gradient(bottom, #F0F0F0,#F0F0F0);background-image:linear-gradient(to top,#F0F0F0,#F0F0F0);color:#6D6E70}.ax5-ui-calendar .calendar-body table tbody td .calendar-item-year.hover,.ax5-ui-calendar .calendar-body table tbody th .calendar-item-year.hover{background-color:#32B4DC;background-image:-webkit-linear-gradient(bottom, #32B4DC,#32B4DC);background-image:linear-gradient(to top,#32B4DC,#32B4DC);color:#fff}.ax5-ui-calendar .calendar-body table tbody td .calendar-item-year.focus,.ax5-ui-calendar .calendar-body table tbody th .calendar-item-year.focus{background-color:#E67241;background-image:-webkit-linear-gradient(bottom, #E67241,#E67241);background-image:linear-gradient(to top,#E67241,#E67241);color:#fff}.ax5-ui-calendar .calendar-body table tbody td.calendar-col-0 .calendar-item-day.live,.ax5-ui-calendar .calendar-body table tbody th.calendar-col-0 .calendar-item-day.live{color:#C78B81}.ax5-ui-calendar .calendar-body table tbody td.calendar-col-6 .calendar-item-day.live,.ax5-ui-calendar .calendar-body table tbody th.calendar-col-6 .calendar-item-day.live{color:#32B4DC}
+@-webkit-keyframes ax5-ui-calendar-fadeout{from{opacity:1.0}to{opacity:0.0}}@-moz-keyframes ax5-ui-calendar-fadeout{from{opacity:1.0}to{opacity:0.0}}@keyframes ax5-ui-calendar-fadeout{from{opacity:1.0}to{opacity:0.0}}@-webkit-keyframes ax5-ui-calendar-fadein{from{opacity:0.0}to{opacity:1.0}}@-moz-keyframes ax5-ui-calendar-fadein{from{opacity:0.0}to{opacity:1.0}}@keyframes ax5-ui-calendar-fadein{from{opacity:0.0}to{opacity:1.0}}.ax5-ui-calendar{box-sizing:border-box;position:relative}.ax5-ui-calendar .calendar-control{position:relative;box-sizing:content-box;background-color:#f5f5f5;background-image:-webkit-linear-gradient(bottom, #f5f5f5);background-image:linear-gradient(to top,#f5f5f5);border:1px solid #ddd;border-radius:5px;font-size:18px;margin-bottom:5px;color:#333}.ax5-ui-calendar .calendar-control .date-move-left,.ax5-ui-calendar .calendar-control .date-move-right{display:block;position:absolute;overflow:hidden;text-align:center;font-size:22px;cursor:pointer;text-decoration:none}.ax5-ui-calendar .calendar-control .date-move-left i,.ax5-ui-calendar .calendar-control .date-move-left span,.ax5-ui-calendar .calendar-control .date-move-right i,.ax5-ui-calendar .calendar-control .date-move-right span{line-height:inherit}.ax5-ui-calendar .calendar-control .date-move-left{left:0px;top:0px}.ax5-ui-calendar .calendar-control .date-move-right{right:0px;top:0px}.ax5-ui-calendar .calendar-control .date-display{text-align:center}.ax5-ui-calendar .calendar-control .date-display [data-calendar-display]{margin:0px 10px;cursor:pointer;text-decoration:underline}.ax5-ui-calendar .calendar-control a{color:#333}.ax5-ui-calendar .calendar-control a:hover{color:#337ab7}.ax5-ui-calendar .calendar-body.fadein{-webkit-animation:ax5-ui-calendar-fadein 0.3s ease-in-out;-moz-animation:ax5-ui-calendar-fadein 0.3s ease-in-out;animation:ax5-ui-calendar-fadein 0.3s ease-in-out;opacity:1.0}.ax5-ui-calendar .calendar-body.fadeout{-webkit-animation:ax5-ui-calendar-fadeout 0.3s ease-in-out;-moz-animation:ax5-ui-calendar-fadeout 0.3s ease-in-out;animation:ax5-ui-calendar-fadeout 0.3s ease-in-out;opacity:0.0}.ax5-ui-calendar .calendar-body table{box-sizing:border-box;table-layout:fixed;border-collapse:collapse;border-spacing:0px}.ax5-ui-calendar .calendar-body table thead td,.ax5-ui-calendar .calendar-body table thead th{box-sizing:border-box;vertical-align:middle;line-height:1em;cursor:pointer;text-align:center;font-size:12px;padding:10px 2px;border:0px none;background-color:#fff;background-image:-webkit-linear-gradient(bottom, #fff,#fff);background-image:linear-gradient(to top,#fff,#fff);color:#6D6E70}.ax5-ui-calendar .calendar-body table thead td.calendar-col-0,.ax5-ui-calendar .calendar-body table thead th.calendar-col-0{color:#C78B81}.ax5-ui-calendar .calendar-body table thead td.calendar-col-6,.ax5-ui-calendar .calendar-body table thead th.calendar-col-6{color:#32B4DC}.ax5-ui-calendar .calendar-body table tbody td,.ax5-ui-calendar .calendar-body table tbody th{box-sizing:border-box;vertical-align:middle;line-height:1em;cursor:pointer;text-align:center;font-size:14px;border:0px none;background-color:#fff;background-image:-webkit-linear-gradient(bottom, #fff,#fff);background-image:linear-gradient(to top,#fff,#fff);overflow:hidden}.ax5-ui-calendar .calendar-body table tbody td .calendar-item-day,.ax5-ui-calendar .calendar-body table tbody th .calendar-item-day{position:relative;display:block;width:100%;height:100%;vertical-align:middle;border-radius:5px;overflow:hidden;line-height:inherit;background-color:#fff;background-image:-webkit-linear-gradient(bottom, #fff,#fff);background-image:linear-gradient(to top,#fff,#fff);color:#C3C4C6;font-size:16px}.ax5-ui-calendar .calendar-body table tbody td .calendar-item-day span.addon,.ax5-ui-calendar .calendar-body table tbody th .calendar-item-day span.addon{position:absolute;left:0px;top:0px;width:100%;text-align:center;line-height:10px}.ax5-ui-calendar .calendar-body table tbody td .calendar-item-day span.lunar,.ax5-ui-calendar .calendar-body table tbody th .calendar-item-day span.lunar{position:absolute;left:0px;bottom:3px;width:100%;text-align:center;font-size:12px;color:#eee;line-height:12px}.ax5-ui-calendar .calendar-body table tbody td .calendar-item-day.live,.ax5-ui-calendar .calendar-body table tbody th .calendar-item-day.live{background-color:#F0F0F0;background-image:-webkit-linear-gradient(bottom, #F0F0F0,#F0F0F0);background-image:linear-gradient(to top,#F0F0F0,#F0F0F0);color:#6D6E70}.ax5-ui-calendar .calendar-body table tbody td .calendar-item-day.live span.addon,.ax5-ui-calendar .calendar-body table tbody th .calendar-item-day.live span.addon{color:#A1A1A1}.ax5-ui-calendar .calendar-body table tbody td .calendar-item-day.live span.lunar,.ax5-ui-calendar .calendar-body table tbody th .calendar-item-day.live span.lunar{color:#A1A1A1}.ax5-ui-calendar .calendar-body table tbody td .calendar-item-day.focus,.ax5-ui-calendar .calendar-body table tbody th .calendar-item-day.focus{background-color:#E67241;background-image:-webkit-linear-gradient(bottom, #E67241,#E67241);background-image:linear-gradient(to top,#E67241,#E67241);color:#fff}.ax5-ui-calendar .calendar-body table tbody td .calendar-item-day.focus span.addon,.ax5-ui-calendar .calendar-body table tbody th .calendar-item-day.focus span.addon{color:#fff}.ax5-ui-calendar .calendar-body table tbody td .calendar-item-day.focus span.lunar,.ax5-ui-calendar .calendar-body table tbody th .calendar-item-day.focus span.lunar{color:#fff}.ax5-ui-calendar .calendar-body table tbody td .calendar-item-day.focus.hover,.ax5-ui-calendar .calendar-body table tbody th .calendar-item-day.focus.hover{background-color:#32B4DC;background-image:-webkit-linear-gradient(bottom, #32B4DC,#32B4DC);background-image:linear-gradient(to top,#32B4DC,#32B4DC);color:#fff !important}.ax5-ui-calendar .calendar-body table tbody td .calendar-item-day.focus.hover span.addon,.ax5-ui-calendar .calendar-body table tbody th .calendar-item-day.focus.hover span.addon{color:#fff}.ax5-ui-calendar .calendar-body table tbody td .calendar-item-day.focus.hover span.lunar,.ax5-ui-calendar .calendar-body table tbody th .calendar-item-day.focus.hover span.lunar{color:#fff}.ax5-ui-calendar .calendar-body table tbody td .calendar-item-day.selected-day,.ax5-ui-calendar .calendar-body table tbody th .calendar-item-day.selected-day{background-color:#32B4DC;background-image:-webkit-linear-gradient(bottom, #32B4DC,#32B4DC);background-image:linear-gradient(to top,#32B4DC,#32B4DC);color:#fff !important}.ax5-ui-calendar .calendar-body table tbody td .calendar-item-day.selected-day span.addon,.ax5-ui-calendar .calendar-body table tbody th .calendar-item-day.selected-day span.addon{color:#fff}.ax5-ui-calendar .calendar-body table tbody td .calendar-item-day.selected-day span.lunar,.ax5-ui-calendar .calendar-body table tbody th .calendar-item-day.selected-day span.lunar{color:#fff}.ax5-ui-calendar .calendar-body table tbody td .calendar-item-day.disable,.ax5-ui-calendar .calendar-body table tbody th .calendar-item-day.disable{background-color:#fff;background-image:-webkit-linear-gradient(bottom, #fff,#fff);background-image:linear-gradient(to top,#fff,#fff);color:#dddedf}.ax5-ui-calendar .calendar-body table tbody td .calendar-item-month,.ax5-ui-calendar .calendar-body table tbody th .calendar-item-month{display:block;width:100%;height:100%;vertical-align:middle;border-radius:5px;overflow:hidden;line-height:inherit;background-color:#fff;background-image:-webkit-linear-gradient(bottom, #fff,#fff);background-image:linear-gradient(to top,#fff,#fff);color:#C3C4C6;font-size:16px}.ax5-ui-calendar .calendar-body table tbody td .calendar-item-month.live,.ax5-ui-calendar .calendar-body table tbody th .calendar-item-month.live{background-color:#F0F0F0;background-image:-webkit-linear-gradient(bottom, #F0F0F0,#F0F0F0);background-image:linear-gradient(to top,#F0F0F0,#F0F0F0);color:#6D6E70}.ax5-ui-calendar .calendar-body table tbody td .calendar-item-month.hover,.ax5-ui-calendar .calendar-body table tbody th .calendar-item-month.hover{background-color:#32B4DC;background-image:-webkit-linear-gradient(bottom, #32B4DC,#32B4DC);background-image:linear-gradient(to top,#32B4DC,#32B4DC);color:#fff}.ax5-ui-calendar .calendar-body table tbody td .calendar-item-month.focus,.ax5-ui-calendar .calendar-body table tbody th .calendar-item-month.focus{background-color:#E67241;background-image:-webkit-linear-gradient(bottom, #E67241,#E67241);background-image:linear-gradient(to top,#E67241,#E67241);color:#fff}.ax5-ui-calendar .calendar-body table tbody td .calendar-item-year,.ax5-ui-calendar .calendar-body table tbody th .calendar-item-year{display:block;width:100%;height:100%;vertical-align:middle;border-radius:5px;overflow:hidden;line-height:inherit;background-color:#fff;background-image:-webkit-linear-gradient(bottom, #fff,#fff);background-image:linear-gradient(to top,#fff,#fff);color:#C3C4C6;font-size:16px}.ax5-ui-calendar .calendar-body table tbody td .calendar-item-year.live,.ax5-ui-calendar .calendar-body table tbody th .calendar-item-year.live{background-color:#F0F0F0;background-image:-webkit-linear-gradient(bottom, #F0F0F0,#F0F0F0);background-image:linear-gradient(to top,#F0F0F0,#F0F0F0);color:#6D6E70}.ax5-ui-calendar .calendar-body table tbody td .calendar-item-year.hover,.ax5-ui-calendar .calendar-body table tbody th .calendar-item-year.hover{background-color:#32B4DC;background-image:-webkit-linear-gradient(bottom, #32B4DC,#32B4DC);background-image:linear-gradient(to top,#32B4DC,#32B4DC);color:#fff}.ax5-ui-calendar .calendar-body table tbody td .calendar-item-year.focus,.ax5-ui-calendar .calendar-body table tbody th .calendar-item-year.focus{background-color:#E67241;background-image:-webkit-linear-gradient(bottom, #E67241,#E67241);background-image:linear-gradient(to top,#E67241,#E67241);color:#fff}.ax5-ui-calendar .calendar-body table tbody td.calendar-col-0 .calendar-item-day.live,.ax5-ui-calendar .calendar-body table tbody th.calendar-col-0 .calendar-item-day.live{color:#C78B81}.ax5-ui-calendar .calendar-body table tbody td.calendar-col-6 .calendar-item-day.live,.ax5-ui-calendar .calendar-body table tbody th.calendar-col-6 .calendar-item-day.live{color:#32B4DC}
diff --git a/dist/ax5calendar.js b/dist/ax5calendar.js
index 5712305..0dc3a65 100755
--- a/dist/ax5calendar.js
+++ b/dist/ax5calendar.js
@@ -257,7 +257,7 @@
}
})() + ' ' + (function () {
- return ""; //( U.date(loopDate, {"return":"yyyymmdd"}) == U.date(cfg.displayDate, {"return":"yyyymmdd"}) ) ? "hover" : "";
+ return "";
})() + '" data-calendar-item-date="' + U.date(loopDate, {"return": cfg.dateFormat}) + '"> '
+ cfg.lang.day.replace('%s', loopDate.getDate())
+ ' ');
@@ -493,16 +493,18 @@
if (selectable) {
selectableCount = (cfg.multipleSelect) ? (U.isNumber(cfg.multipleSelect)) ? cfg.multipleSelect : 2 : 1;
+
+ console.log(selectableCount);
+
if (self.selection.length >= selectableCount) {
var removed = self.selection.splice(0, self.selection.length - (selectableCount - 1));
removed.forEach(function (d) {
- self.$["body"].find('[data-calendar-item-date="' + U.date(d, {"return": cfg.dateFormat}) + '"]').removeClass("selected");
+ self.$["body"].find('[data-calendar-item-date="' + U.date(d, {"return": cfg.dateFormat}) + '"]').removeClass("selected-day");
});
}
- jQuery(target).addClass("selected");
+ jQuery(target).addClass("selected-day");
self.selection.push(value);
- // cfg.displayDate = value;
if (cfg.onClick)
{
diff --git a/dist/ax5calendar.min.js b/dist/ax5calendar.min.js
index a500cc9..2b5d651 100755
--- a/dist/ax5calendar.min.js
+++ b/dist/ax5calendar.min.js
@@ -1 +1 @@
-!function(t,a){var e=ax5.util,n=function(){var t,n=this;this.main=function(){a&&a.call(this),this.config={clickEventName:"click",theme:"default",mode:"day",dateFormat:"yyyy-mm-dd",displayDate:new Date,animateTime:250,dimensions:{controlHeight:"40px",controlButtonWidth:"40px",itemPadding:2},lang:{yearHeading:"Choose the year",monthHeading:"Choose the month",year:"%s",month:["January","February","March","April","May","June","July","August","September","October","November","December"],day:"%s"}}}.apply(this,arguments),this.target=null,t=this.config,this.printedDay={start:"",end:""},this.init=function(){t.target||console.log(ax5.info.getError("ax5calendar","401","setConfig")),this.target=jQuery(t.target),t.displayDate=e.date(t.displayDate),this.target.html(this.getFrame()),this.$={root:this.target.find('[data-calendar-els="root"]'),control:this.target.find('[data-calendar-els="control"]'),"control-display":this.target.find('[data-calendar-els="control-display"]'),body:this.target.find('[data-calendar-els="body"]')},t.control&&this.$.control.find("[data-calendar-move]").on(t.clickEventName,function(t){this.move(t||window.event)}.bind(this)),"day"===t.mode||"d"===t.mode?this.printDay(t.displayDate):"month"===t.mode||"m"===t.mode?this.printMonth(t.displayDate):("year"===t.mode||"y"===t.mode)&&this.printYear(t.displayDate)},this.getFrame=function(){var a=[];if(a.push('
'),t.control){var n={},i={};i.height=n.height=e.cssNumber(t.dimensions.controlHeight),i["line-height"]=n["line-height"]=e.cssNumber(t.dimensions.controlHeight),i.width=e.cssNumber(t.dimensions.controlHeight),a.push('
")}return a.push('
'),a.push("
"),a.join("")},this.setDisplay=function(){if(t.control){var a=e.date(t.displayDate),n="",i="";if("day"==t.mode||"d"==t.mode)t.control.yearTmpl&&(n=t.control.yearTmpl.replace("%s",a.getFullYear())),t.control.monthTmpl&&(i=t.control.monthTmpl.replace("%s",t.lang.month[a.getMonth()])),this.$["control-display"].html(function(){return t.control.yearFirst?''+n+' '+i+" ":''+i+' '+n+" "}());else if("month"==t.mode||"m"==t.mode)t.control.yearTmpl&&(n=t.control.yearTmpl.replace("%s",a.getFullYear())),this.$["control-display"].html(''+n+" ");else if("year"==t.mode||"y"==t.mode){var d=t.control.yearTmpl.replace("%s",a.getFullYear()-10),s=t.control.yearTmpl.replace("%s",Number(a.getFullYear())+9);this.$["control-display"].html(d+" ~ "+s)}this.$["control-display"].find("[data-calendar-display]").on(t.clickEventName,function(t){if(target=e.findParentNode(t.target,function(t){return t.getAttribute("data-calendar-display")?!0:void 0}),target){var a=target.getAttribute("data-calendar-display");this.changeMode(a)}}.bind(this))}},this.printDay=function(a){var i,d,s,r=e.date(a),l=[],o=new Date(r.getFullYear(),r.getMonth(),1,12),h=t.displayDate,c=function(){var t=o.getDay();return 0==t&&(t=7),e.date(o,{add:{d:-t}})}(),p=r.getMonth(),u=(r.getDate(),{}),y=this.$.body.width(),m=Math.floor(y*(6/7));for(t.dimensions.height&&(m=e.number(t.dimensions.height)),u.height=Math.floor(m/6)-2*e.number(t.dimensions.itemPadding)+"px",u["line-height"]=u.height,u.padding=e.cssNumber(t.dimensions.itemPadding),l.push(''),l.push(""),l.push(""),s=0;7>s;)l.push(''),l.push(ax5.info.weekNames[s].label),l.push(" "),s++;for(l.push(" "),l.push(" "),l.push(""),i=c,d=0;6>d;){for(l.push(""),s=0;7>s;)l.push(''),l.push(' '+t.lang.day.replace("%s",i.getDate())+' '),l.push(" "),s++,i=e.date(i,{add:{d:1}});l.push(" "),d++}if(l.push(" "),l.push("
"),this.$.body.html(l.join("")),this.$.body.find("[data-calendar-item-date]").on(t.clickEventName,function(t){t=t||window.event,n.onclick(t);try{t.preventDefault&&t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.cancelBubble=!0}catch(t){}return!1}),this.printedDay={start:c,end:i},t.onStateChanged){var g={action:"printDay",printedDay:this.printedDay};t.onStateChanged.call(g,g)}this.setDisplay()},this.printMonth=function(a){var i,d,s,r=e.date(a),l=r.getMonth(),o=[],h={},c=this.$.body.width(),p=Math.floor(c*(6/7));for(t.dimensions.height&&(p=e.number(t.dimensions.height)),h.height=Math.floor(p/4)-2*e.number(t.dimensions.itemPadding)+"px",h["line-height"]=h.height,h.padding=e.cssNumber(t.dimensions.itemPadding),o.push(''),o.push(""),o.push(""),o.push(''+t.lang.monthHeading+" "),o.push(" "),o.push(" "),o.push(""),s=0,i=0;4>i;){for(o.push(""),d=0;3>d;)o.push(''),o.push(''+t.lang.month[s]+" "),o.push(" "),s++,d++;o.push(" "),i++}o.push(" "),o.push("
"),this.$.body.html(o.join("")),this.$.body.find("[data-calendar-item-month]").on(t.clickEventName,function(t){if(t=t||window.event,target=e.findParentNode(t.target,function(t){return t.getAttribute("data-calendar-item-month")?!0:void 0}),target){value=target.getAttribute("data-calendar-item-month"),n.changeMode("day",value);try{t.preventDefault&&t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.cancelBubble=!0}catch(t){}return!1}}),this.setDisplay()},this.printYear=function(a){var i,d,s=e.date(a),r=s.getFullYear(),l=[],o={},h=this.$.body.width(),c=Math.floor(h*(6/7));for(t.dimensions.height&&(c=e.number(t.dimensions.height)),o.height=Math.floor(c/5)-2*e.number(t.dimensions.itemPadding)+"px",o["line-height"]=o.height,o.padding=e.cssNumber(t.dimensions.itemPadding),l.push(''),l.push(""),l.push(""),l.push(''+t.lang.yearHeading+" "),l.push(" "),l.push(" "),l.push(""),y=r-10,i=0;5>i;){for(l.push(""),d=0;4>d;)l.push(''),l.push(''+t.lang.year.replace("%s",y)+" "),l.push(" "),y++,d++;l.push(" "),i++}l.push(" "),l.push("
"),this.$.body.html(l.join("")),this.$.body.find("[data-calendar-item-year]").on(t.clickEventName,function(t){if(t=t||window.event,target=e.findParentNode(t.target,function(t){return t.getAttribute("data-calendar-item-year")?!0:void 0}),target){value=target.getAttribute("data-calendar-item-year"),n.changeMode("month",value);try{t.preventDefault&&t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.cancelBubble=!0}catch(t){}return!1}}),this.setDisplay()},this.onclick=function(a,n,i){if(n=e.findParentNode(a.target,function(t){return t.getAttribute("data-calendar-item-date")?!0:void 0})){i=n.getAttribute("data-calendar-item-date");var d=e.date(i,{"return":t.dateFormat}),s=!0;t.selectable&&(t.selectable[d]||(s=!1)),s&&(this.$.body.find('[data-calendar-item-date="'+e.date(t.displayDate,{"return":t.dateFormat})+'"]').removeClass("hover"),jQuery(n).addClass("hover"),t.displayDate=i,t.onClick&&t.onClick.call({date:i,target:this.target,dateElement:n}))}},this.move=function(a,n,i){n=e.findParentNode(a.target,function(t){return t.getAttribute("data-calendar-move")?!0:void 0}),n&&(i=n.getAttribute("data-calendar-move"),"day"==t.mode?("left"==i?t.displayDate=e.date(t.displayDate,{add:{m:-1}}):t.displayDate=e.date(t.displayDate,{add:{m:1}}),this.printDay(t.displayDate)):"month"==t.mode?("left"==i?t.displayDate=e.date(t.displayDate,{add:{y:-1}}):t.displayDate=e.date(t.displayDate,{add:{y:1}}),this.printMonth(t.displayDate)):"year"==t.mode&&("left"==i?t.displayDate=e.date(t.displayDate,{add:{y:-10}}):t.displayDate=e.date(t.displayDate,{add:{y:10}}),this.printYear(t.displayDate)))},this.changeMode=function(a,e){"undefined"!=typeof e&&(t.displayDate=e),t.mode=a,this.$.body.removeClass("fadein").addClass("fadeout"),setTimeout(function(){"day"==t.mode?this.printDay(t.displayDate):"month"==t.mode?this.printMonth(t.displayDate):"year"==t.mode&&this.printYear(t.displayDate),this.$.body.removeClass("fadeout").addClass("fadein")}.bind(this),t.animateTime)},this.setDisplayDate=function(a){t.displayDate=e.date(a),this.$.body.removeClass("fadein").addClass("fadeout"),setTimeout(function(){"day"==t.mode?this.printDay(t.displayDate):"month"==t.mode?this.printMonth(t.displayDate):"year"==t.mode&&this.printYear(t.displayDate),this.$.body.removeClass("fadeout").addClass("fadein")}.bind(this),t.animateTime)}};e.isFunction(a)&&(n.prototype=new a),t.calendar=n}(ax5.ui,ax5.ui.root);
\ No newline at end of file
+!function(t,e){var a=ax5.util,n=function(){var t,n=this,i=1;this.main=function(){e&&e.call(this),this.config={clickEventName:"click",theme:"default",mode:"day",dateFormat:"yyyy-mm-dd",displayDate:new Date,animateTime:250,dimensions:{controlHeight:"40px",controlButtonWidth:"40px",itemPadding:2},lang:{yearHeading:"Choose the year",monthHeading:"Choose the month",year:"%s",month:["January","February","March","April","May","June","July","August","September","October","November","December"],day:"%s"},multipleSelect:!1}}.apply(this,arguments),this.target=null,this.selection=[],t=this.config,this.printedDay={start:"",end:""},this.init=function(){t.target||console.log(ax5.info.getError("ax5calendar","401","setConfig")),this.target=jQuery(t.target),t.displayDate=a.date(t.displayDate),this.target.html(this.getFrame()),this.$={root:this.target.find('[data-calendar-els="root"]'),control:this.target.find('[data-calendar-els="control"]'),"control-display":this.target.find('[data-calendar-els="control-display"]'),body:this.target.find('[data-calendar-els="body"]')},t.control&&this.$.control.find("[data-calendar-move]").on(t.clickEventName,function(t){this.move(t||window.event)}.bind(this)),"day"===t.mode||"d"===t.mode?this.printDay(t.displayDate):"month"===t.mode||"m"===t.mode?this.printMonth(t.displayDate):("year"===t.mode||"y"===t.mode)&&this.printYear(t.displayDate)},this.getFrame=function(){var e=[];if(e.push(''),t.control){var n={},i={};i.height=n.height=a.cssNumber(t.dimensions.controlHeight),i["line-height"]=n["line-height"]=a.cssNumber(t.dimensions.controlHeight),i.width=a.cssNumber(t.dimensions.controlHeight),e.push('
")}return e.push('
'),e.push("
"),e.join("")},this.setDisplay=function(){if(t.control){var e=a.date(t.displayDate),n="",i="";if("day"==t.mode||"d"==t.mode)t.control.yearTmpl&&(n=t.control.yearTmpl.replace("%s",e.getFullYear())),t.control.monthTmpl&&(i=t.control.monthTmpl.replace("%s",t.lang.month[e.getMonth()])),this.$["control-display"].html(function(){return t.control.yearFirst?''+n+' '+i+" ":''+i+' '+n+" "}());else if("month"==t.mode||"m"==t.mode)t.control.yearTmpl&&(n=t.control.yearTmpl.replace("%s",e.getFullYear())),this.$["control-display"].html(''+n+" ");else if("year"==t.mode||"y"==t.mode){var d=t.control.yearTmpl.replace("%s",e.getFullYear()-10),s=t.control.yearTmpl.replace("%s",Number(e.getFullYear())+9);this.$["control-display"].html(d+" ~ "+s)}this.$["control-display"].find("[data-calendar-display]").on(t.clickEventName,function(t){if(target=a.findParentNode(t.target,function(t){return t.getAttribute("data-calendar-display")?!0:void 0}),target){var e=target.getAttribute("data-calendar-display");this.changeMode(e)}}.bind(this))}},this.printDay=function(e){var i,d,s,l=a.date(e),r=[],o=new Date(l.getFullYear(),l.getMonth(),1,12),h=t.displayDate,c=function(){var t=o.getDay();return 0==t&&(t=7),a.date(o,{add:{d:-t}})}(),p=l.getMonth(),u=(l.getDate(),{}),m=this.$.body.width(),y=Math.floor(m*(6/7));for(t.dimensions.height&&(y=a.number(t.dimensions.height)),u.height=Math.floor(y/6)-2*a.number(t.dimensions.itemPadding)+"px",u["line-height"]=u.height,u.padding=a.cssNumber(t.dimensions.itemPadding),r.push(''),r.push(""),r.push(""),s=0;7>s;)r.push(''),r.push(ax5.info.weekNames[s].label),r.push(" "),s++;for(r.push(" "),r.push(" "),r.push(""),i=c,d=0;6>d;){for(r.push(""),s=0;7>s;)r.push(''),r.push(' '+t.lang.day.replace("%s",i.getDate())+' '),r.push(" "),s++,i=a.date(i,{add:{d:1}});r.push(" "),d++}if(r.push(" "),r.push("
"),this.$.body.html(r.join("")),this.$.body.find("[data-calendar-item-date]").on(t.clickEventName,function(t){t=t||window.event,n.onclick(t);try{t.preventDefault&&t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.cancelBubble=!0}catch(t){}return!1}),this.printedDay={start:c,end:i},t.onStateChanged){var g={action:"printDay",printedDay:this.printedDay};t.onStateChanged.call(g,g)}this.setDisplay()},this.printMonth=function(e){var i,d,s,l=a.date(e),r=l.getMonth(),o=[],h={},c=this.$.body.width(),p=Math.floor(c*(6/7));for(t.dimensions.height&&(p=a.number(t.dimensions.height)),h.height=Math.floor(p/4)-2*a.number(t.dimensions.itemPadding)+"px",h["line-height"]=h.height,h.padding=a.cssNumber(t.dimensions.itemPadding),o.push(''),o.push(""),o.push(""),o.push(''+t.lang.monthHeading+" "),o.push(" "),o.push(" "),o.push(""),s=0,i=0;4>i;){for(o.push(""),d=0;3>d;)o.push(''),o.push(''+t.lang.month[s]+" "),o.push(" "),s++,d++;o.push(" "),i++}o.push(" "),o.push("
"),this.$.body.html(o.join("")),this.$.body.find("[data-calendar-item-month]").on(t.clickEventName,function(t){if(t=t||window.event,target=a.findParentNode(t.target,function(t){return t.getAttribute("data-calendar-item-month")?!0:void 0}),target){value=target.getAttribute("data-calendar-item-month"),n.changeMode("day",value);try{t.preventDefault&&t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.cancelBubble=!0}catch(t){}return!1}}),this.setDisplay()},this.printYear=function(e){var i,d,s=a.date(e),l=s.getFullYear(),r=[],o={},h=this.$.body.width(),c=Math.floor(h*(6/7));for(t.dimensions.height&&(c=a.number(t.dimensions.height)),o.height=Math.floor(c/5)-2*a.number(t.dimensions.itemPadding)+"px",o["line-height"]=o.height,o.padding=a.cssNumber(t.dimensions.itemPadding),r.push(''),r.push(""),r.push(""),r.push(''+t.lang.yearHeading+" "),r.push(" "),r.push(" "),r.push(""),y=l-10,i=0;5>i;){for(r.push(""),d=0;4>d;)r.push(''),r.push(''+t.lang.year.replace("%s",y)+" "),r.push(" "),y++,d++;r.push(" "),i++}r.push(" "),r.push("
"),this.$.body.html(r.join("")),this.$.body.find("[data-calendar-item-year]").on(t.clickEventName,function(t){if(t=t||window.event,target=a.findParentNode(t.target,function(t){return t.getAttribute("data-calendar-item-year")?!0:void 0}),target){value=target.getAttribute("data-calendar-item-year"),n.changeMode("month",value);try{t.preventDefault&&t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.cancelBubble=!0}catch(t){}return!1}}),this.setDisplay()},this.onclick=function(e,d,s){if(d=a.findParentNode(e.target,function(t){return t.getAttribute("data-calendar-item-date")?!0:void 0})){s=d.getAttribute("data-calendar-item-date");var l=a.date(s,{"return":t.dateFormat}),r=!0;if(t.selectable&&(t.selectable[l]||(r=!1)),r){if(i=t.multipleSelect?a.isNumber(t.multipleSelect)?t.multipleSelect:2:1,console.log(i),n.selection.length>=i){var o=n.selection.splice(0,n.selection.length-(i-1));o.forEach(function(e){n.$.body.find('[data-calendar-item-date="'+a.date(e,{"return":t.dateFormat})+'"]').removeClass("selected-day")})}jQuery(d).addClass("selected-day"),n.selection.push(s),t.onClick&&t.onClick.call({date:s,target:this.target,dateElement:d})}}},this.move=function(e,n,i){n=a.findParentNode(e.target,function(t){return t.getAttribute("data-calendar-move")?!0:void 0}),n&&(i=n.getAttribute("data-calendar-move"),"day"==t.mode?("left"==i?t.displayDate=a.date(t.displayDate,{add:{m:-1}}):t.displayDate=a.date(t.displayDate,{add:{m:1}}),this.printDay(t.displayDate)):"month"==t.mode?("left"==i?t.displayDate=a.date(t.displayDate,{add:{y:-1}}):t.displayDate=a.date(t.displayDate,{add:{y:1}}),this.printMonth(t.displayDate)):"year"==t.mode&&("left"==i?t.displayDate=a.date(t.displayDate,{add:{y:-10}}):t.displayDate=a.date(t.displayDate,{add:{y:10}}),this.printYear(t.displayDate)))},this.changeMode=function(e,a){"undefined"!=typeof a&&(t.displayDate=a),t.mode=e,this.$.body.removeClass("fadein").addClass("fadeout"),setTimeout(function(){"day"==t.mode?this.printDay(t.displayDate):"month"==t.mode?this.printMonth(t.displayDate):"year"==t.mode&&this.printYear(t.displayDate),this.$.body.removeClass("fadeout").addClass("fadein")}.bind(this),t.animateTime)},this.setDisplayDate=function(e){t.displayDate=a.date(e),this.$.body.removeClass("fadein").addClass("fadeout"),setTimeout(function(){"day"==t.mode?this.printDay(t.displayDate):"month"==t.mode?this.printMonth(t.displayDate):"year"==t.mode&&this.printYear(t.displayDate),this.$.body.removeClass("fadeout").addClass("fadein")}.bind(this),t.animateTime)},this.setSelection=function(e){return a.isArray(e)?(i=t.multipleSelect?a.isNumber(t.multipleSelect)?t.multipleSelect:2:1,this.selection=e.splice(0,i),this.selection.forEach(function(e){n.$.body.find('[data-calendar-item-date="'+a.date(e,{"return":t.dateFormat})+'"]').addClass("selected")}),this):this},this.getSelection=function(){return this.selection}};a.isFunction(e)&&(n.prototype=new e),t.calendar=n}(ax5.ui,ax5.ui.root);
\ No newline at end of file
diff --git a/src/ax5calendar.js b/src/ax5calendar.js
index 5712305..0dc3a65 100755
--- a/src/ax5calendar.js
+++ b/src/ax5calendar.js
@@ -257,7 +257,7 @@
}
})() + ' ' + (function () {
- return ""; //( U.date(loopDate, {"return":"yyyymmdd"}) == U.date(cfg.displayDate, {"return":"yyyymmdd"}) ) ? "hover" : "";
+ return "";
})() + '" data-calendar-item-date="' + U.date(loopDate, {"return": cfg.dateFormat}) + '"> '
+ cfg.lang.day.replace('%s', loopDate.getDate())
+ ' ');
@@ -493,16 +493,18 @@
if (selectable) {
selectableCount = (cfg.multipleSelect) ? (U.isNumber(cfg.multipleSelect)) ? cfg.multipleSelect : 2 : 1;
+
+ console.log(selectableCount);
+
if (self.selection.length >= selectableCount) {
var removed = self.selection.splice(0, self.selection.length - (selectableCount - 1));
removed.forEach(function (d) {
- self.$["body"].find('[data-calendar-item-date="' + U.date(d, {"return": cfg.dateFormat}) + '"]').removeClass("selected");
+ self.$["body"].find('[data-calendar-item-date="' + U.date(d, {"return": cfg.dateFormat}) + '"]').removeClass("selected-day");
});
}
- jQuery(target).addClass("selected");
+ jQuery(target).addClass("selected-day");
self.selection.push(value);
- // cfg.displayDate = value;
if (cfg.onClick)
{
diff --git a/src/scss/_ax5calendar.scss b/src/scss/_ax5calendar.scss
index e80173a..3a7eef9 100644
--- a/src/scss/_ax5calendar.scss
+++ b/src/scss/_ax5calendar.scss
@@ -181,7 +181,7 @@
}
}
}
- &.selected {
+ &.selected-day {
@include ax-background($ax5calendar-hover-bg);
color: $ax5calendar-hover-text-color !important;
span.addon {
diff --git a/test/index.html b/test/index.html
index ec9bb24..8bc2f01 100644
--- a/test/index.html
+++ b/test/index.html
@@ -1,6 +1,6 @@
-
+ㅔ목
Title
@@ -69,7 +69,7 @@
onStateChanged: function () {
console.log(this);
}
- //multipleSelect: 1
+ //, multipleSelect: 1
});
myCalendar.setSelection(['2016-01-11', '2016-01-12', '2016-01-13']);