Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updated combined and minified

  • Loading branch information...
commit e20178b59a615159d76a77e68af4e8b163b374a8 1 parent 97a5dbb
Jarvis Badgley authored
Showing with 10 additions and 10 deletions.
  1. +4 −4 build/kalendae.js
  2. +6 −6 build/kalendae.min.js
8 build/kalendae.js
View
@@ -454,7 +454,7 @@ Kalendae.prototype = {
var diff = -(moment().diff(month, 'months'));
if (opts.direction==='today-past' || opts.direction==='past') {
- if (diff <= 0) {
+ if (diff < 0) {
this.disableNextMonth = false;
util.removeClassName(this.container, classes.disableNextMonth);
} else {
@@ -464,7 +464,7 @@ Kalendae.prototype = {
} else if (opts.direction==='today-future' || opts.direction==='future') {
- if (diff > opts.months) {
+ if (diff >= opts.months) {
this.disablePreviousMonth = false;
util.removeClassName(this.container, classes.disablePreviousMonth);
} else {
@@ -476,7 +476,7 @@ Kalendae.prototype = {
if (opts.direction==='today-past' || opts.direction==='past') {
- if (month.add({Y:1}).diff(moment(), 'years') < 0) {
+ if (month.add({y:1}).diff(moment(), 'months') <= 0) {
this.disableNextYear = false;
util.removeClassName(this.container, classes.disableNextYear);
} else {
@@ -485,7 +485,7 @@ Kalendae.prototype = {
}
} else if (opts.direction==='today-future' || opts.direction==='future') {
- if (month.subtract({Y:1}).diff(moment(), 'years') > 0) {
+ if ((month.subtract({y:1}).diff(moment(), 'months') - (opts.months-1)) >= 0) {
this.disablePreviousYear = false;
util.removeClassName(this.container, classes.disablePreviousYear);
} else {
12 build/kalendae.min.js
View
@@ -19,12 +19,12 @@ h(a).yearDay();if(1>a||!this._sel||1>this._sel.length)return!1;switch(this.setti
c){return a.yearDay()-c.yearDay()});!1!==c&&this.draw()},addSelected:function(a,c){a=h(a).hours(12);switch(this.settings.mode){case "multiple":if(this.isSelected(a))return!1;this._sel.push(a);break;case "range":1!==this._sel.length?this._sel=[a]:a.yearDay()>this._sel[0].yearDay()?this._sel[1]=a:this._sel=[a,this._sel[0]];break;default:this._sel=[a]}this._sel.sort(function(a,c){return a.yearDay()-c.yearDay()});this.publish("change",this);!1!==c&&this.draw();return!0},removeSelected:function(a,c){for(var a=
h(a).yearDay(),b=this._sel.length;b--;)if(this._sel[b].yearDay()===a)return this._sel.splice(b,1),this.publish("change",this),!1!==c&&this.draw(),!0;return!1},draw:function(){var a=h(this.viewStartDate).hours(12),c,b=this.classes,d,e,u,m=0,q,n=0,s,j=this.settings;q=this.calendars.length;do{c=h(a).date(1);c.day(c.day()<this.settings.weekStart?this.settings.weekStart-7:this.settings.weekStart);d=this.calendars[m];d.caption.innerHTML=a.format(this.settings.titleFormat);n=0;do e=d.days[n],u=[],(s=this.isSelected(c))&&
u.push({"-1":b.dayInRange,1:b.daySelected,"true":b.daySelected}[s]),c.month()!=a.month()?u.push(b.dayOutOfMonth):(!this.blackout(c)&&!this.direction(c)||0<s)&&u.push(b.dayActive),c.yearDay()===k.yearDay()&&u.push(b.dayToday),s=c.format(this.settings.dayAttributeFormat),j.dateClassMap[s]&&u.push(j.dateClassMap[s]),e.innerHTML=c.format(j.dayNumberFormat),e.className=u.join(" "),e.setAttribute("data-date",s),c.add("days",1);while(42>++n);a.add("months",1)}while(++m<q);if(j.directionScrolling){c=-h().diff(a,
-"months");if("today-past"===j.direction||"past"===j.direction)0>=c?(this.disableNextMonth=!1,f.removeClassName(this.container,b.disableNextMonth)):(this.disableNextMonth=!0,f.addClassName(this.container,b.disableNextMonth));else if("today-future"===j.direction||"future"===j.direction)c>j.months?(this.disablePreviousMonth=!1,f.removeClassName(this.container,b.disablePreviousMonth)):(this.disablePreviousMonth=!0,f.addClassName(this.container,b.disablePreviousMonth));if("today-past"===j.direction||"past"===
-j.direction)0>a.add({Y:1}).diff(h(),"years")?(this.disableNextYear=!1,f.removeClassName(this.container,b.disableNextYear)):(this.disableNextYear=!0,f.addClassName(this.container,b.disableNextYear));else if("today-future"===j.direction||"future"===j.direction)0<a.subtract({Y:1}).diff(h(),"years")?(this.disablePreviousYear=!1,f.removeClassName(this.container,b.disablePreviousYear)):(this.disablePreviousYear=!0,f.addClassName(this.container,b.disablePreviousYear))}}};var v=function(a,c,b){var d=[];"string"===
-typeof a?a=a.split(c):f.isArray(a)||(a=[a]);c=a.length;i=0;do a[i]&&d.push(h(a[i],b).hours(12));while(++i<c);return d};window.Kalendae=m;var f=m.util={isIE8:function(){return!(!/msie 8./i.test(navigator.appVersion)||/opera/i.test(navigator.userAgent)||!window.ActiveXObject||!XDomainRequest||window.msPerformance)},$:function(a){return"string"==typeof a?document.getElementById(a):a},$$:function(a){return document.querySelectorAll(a)},make:function(a,c,b){var d,a=document.createElement(a);if(c)for(d in c)c.hasOwnProperty(d)&&
-a.setAttribute(d,c[d]);b&&b.appendChild(a);return a},isVisible:function(a){return 0<a.offsetWidth||0<a.offsetHeight},getStyle:function(a,c){var b;a.currentStyle?b=a.currentStyle[c]:window.getComputedStyle&&(b=window.getComputedStyle(a,null)[c]);return b},domReady:function(a){/in/.test(document.readyState)?setTimeout(function(){f.domReady(a)},9):a()},addEvent:function(a,c,b){var d=function(c){var c=c||window.event,d=b.apply(a,[c,c.target||c.srcElement]);!1===d&&(c.preventDefault?c.preventDefault():
-(c.returnValue=!1,c.cancelBubble=!0));return d};a.attachEvent?a.attachEvent("on"+c,d):a.addEventListener(c,d,!1);return d},removeEvent:function(a,c,b){a.detachEvent?a.detachEvent("on"+c,b):a.removeEventListener(c,b,!1)},hasClassName:function(a,c){if(!(a=f.$(a)))return!1;var b=a.className;return 0<b.length&&(b==c||RegExp("(^|\\s)"+c+"(\\s|$)").test(b))},addClassName:function(a,c){if((a=f.$(a))&&!f.hasClassName(a,c))a.className+=(a.className?" ":"")+c},removeClassName:function(a,c){if(a=f.$(a))a.className=
-f.trimString(a.className.replace(RegExp("(^|\\s+)"+c+"(\\s+|$)")," "))},isFixed:function(a){do if("fixed"===f.getStyle(a,"position"))return!0;while(a=a.offsetParent);return!1},getPosition:function(a,c){var b=a.offsetLeft,d=a.offsetTop,e={};if(!c)for(;a=a.offsetParent;)b+=a.offsetLeft,d+=a.offsetTop;e[0]=e.left=b;e[1]=e.top=d;return e},getHeight:function(a){return a.offsetHeight||a.scrollHeight},getWidth:function(a){return a.offsetWidth||a.scrollWidth},trimString:function(a){return a.replace(/^\s+/,
+"months");if("today-past"===j.direction||"past"===j.direction)0>c?(this.disableNextMonth=!1,f.removeClassName(this.container,b.disableNextMonth)):(this.disableNextMonth=!0,f.addClassName(this.container,b.disableNextMonth));else if("today-future"===j.direction||"future"===j.direction)c>=j.months?(this.disablePreviousMonth=!1,f.removeClassName(this.container,b.disablePreviousMonth)):(this.disablePreviousMonth=!0,f.addClassName(this.container,b.disablePreviousMonth));if("today-past"===j.direction||"past"===
+j.direction)0>=a.add({y:1}).diff(h(),"months")?(this.disableNextYear=!1,f.removeClassName(this.container,b.disableNextYear)):(this.disableNextYear=!0,f.addClassName(this.container,b.disableNextYear));else if("today-future"===j.direction||"future"===j.direction)0<=a.subtract({y:1}).diff(h(),"months")-(j.months-1)?(this.disablePreviousYear=!1,f.removeClassName(this.container,b.disablePreviousYear)):(this.disablePreviousYear=!0,f.addClassName(this.container,b.disablePreviousYear))}}};var v=function(a,
+c,b){var d=[];"string"===typeof a?a=a.split(c):f.isArray(a)||(a=[a]);c=a.length;i=0;do a[i]&&d.push(h(a[i],b).hours(12));while(++i<c);return d};window.Kalendae=m;var f=m.util={isIE8:function(){return!(!/msie 8./i.test(navigator.appVersion)||/opera/i.test(navigator.userAgent)||!window.ActiveXObject||!XDomainRequest||window.msPerformance)},$:function(a){return"string"==typeof a?document.getElementById(a):a},$$:function(a){return document.querySelectorAll(a)},make:function(a,c,b){var d,a=document.createElement(a);
+if(c)for(d in c)c.hasOwnProperty(d)&&a.setAttribute(d,c[d]);b&&b.appendChild(a);return a},isVisible:function(a){return 0<a.offsetWidth||0<a.offsetHeight},getStyle:function(a,c){var b;a.currentStyle?b=a.currentStyle[c]:window.getComputedStyle&&(b=window.getComputedStyle(a,null)[c]);return b},domReady:function(a){/in/.test(document.readyState)?setTimeout(function(){f.domReady(a)},9):a()},addEvent:function(a,c,b){var d=function(c){var c=c||window.event,d=b.apply(a,[c,c.target||c.srcElement]);!1===d&&
+(c.preventDefault?c.preventDefault():(c.returnValue=!1,c.cancelBubble=!0));return d};a.attachEvent?a.attachEvent("on"+c,d):a.addEventListener(c,d,!1);return d},removeEvent:function(a,c,b){a.detachEvent?a.detachEvent("on"+c,b):a.removeEventListener(c,b,!1)},hasClassName:function(a,c){if(!(a=f.$(a)))return!1;var b=a.className;return 0<b.length&&(b==c||RegExp("(^|\\s)"+c+"(\\s|$)").test(b))},addClassName:function(a,c){if((a=f.$(a))&&!f.hasClassName(a,c))a.className+=(a.className?" ":"")+c},removeClassName:function(a,
+c){if(a=f.$(a))a.className=f.trimString(a.className.replace(RegExp("(^|\\s+)"+c+"(\\s+|$)")," "))},isFixed:function(a){do if("fixed"===f.getStyle(a,"position"))return!0;while(a=a.offsetParent);return!1},getPosition:function(a,c){var b=a.offsetLeft,d=a.offsetTop,e={};if(!c)for(;a=a.offsetParent;)b+=a.offsetLeft,d+=a.offsetTop;e[0]=e.left=b;e[1]=e.top=d;return e},getHeight:function(a){return a.offsetHeight||a.scrollHeight},getWidth:function(a){return a.offsetWidth||a.scrollWidth},trimString:function(a){return a.replace(/^\s+/,
"").replace(/\s+$/,"")},merge:function(){for(var a=!0===arguments[0],c={},b=a?1:0;b<arguments.length;b++){var d=c,e=arguments[b];if("object"===typeof e){var f=void 0;for(f in e)e.hasOwnProperty(f)&&(a&&"object"===typeof d[f]&&"object"===typeof e[f]?_update(d[f],e[f]):d[f]=e[f])}}return c},isArray:function(a){return!(!a||!a.length||0===a.length||"object"!==typeof a||!a.constructor||a.nodeType||a.item)}};m.util.domReady(function(){for(var a=f.$$(".auto-kal"),c=a.length,b;c--;)b=a[c],"INPUT"===b.tagName?
new m.Input(b):new m({attachTo:b})});m.Input=function(a,c){var b=this.input=f.$(a),d;if(!b||"INPUT"!==b.tagName)throw"First argument for Kalendae.Input must be an <input> element or a valid element id.";var e=this,h=e.classes;opts=e.settings=f.merge(e.defaults,c);opts.attachTo=window.document.body;opts.selected?d=!0:opts.selected=b.value;m.call(e,opts);if(opts.closeButton){var k=f.make("a",{"class":h.closeButton},e.container);f.addEvent(k,"click",function(){b.blur()})}d&&(b.value=e.getSelected());
d=e.container;var q=!1;d.style.display="none";f.addClassName(d,h.positioned);f.addEvent(d,"mousedown",function(){q=true});f.addEvent(window.document,"mousedown",function(){q=false});f.addEvent(b,"focus",function(){e.setSelected(this.value);e.show()});f.addEvent(b,"blur",function(){if(q){q=false;b.focus()}else e.hide()});f.addEvent(b,"keyup",function(){e.setSelected(this.value)});e.subscribe("change",function(){b.value=e.getSelected()})};m.Input.prototype=f.merge(m.prototype,{defaults:f.merge(m.prototype.defaults,
Please sign in to comment.
Something went wrong with that request. Please try again.