Permalink
Browse files

minor bugs fixed with css

  • Loading branch information...
1 parent cfd0a49 commit f5b803410b8fb1f372144ab8365dc83e4ebac17e @ded committed Apr 23, 2013
Showing with 7 additions and 5 deletions.
  1. +3 −1 calender.css
  2. +1 −1 calender.js
  3. +1 −1 calender.min.js
  4. +1 −1 demo.html
  5. +1 −1 package.json
View
4 calender.css
@@ -54,6 +54,8 @@ div.calender-date table td.today {
div.calender-date table .inactive {
color: #555;
}
-div.calender-date-month-previous {
+div.calender-date .date-month-previous {
+ transform: rotate(180deg);
-webkit-transform: rotate(180deg);
+ -moz-transform: rotate(180deg);
}
View
2 calender.js
@@ -153,7 +153,7 @@
var now = new Date()
if (d.getMonth() == now.getMonth() && d.getFullYear() == now.getFullYear()) {
- this.$calendar.find('.date tbody.date-days td').each(function (el) {
+ this.$calendar.find('.calender-date tbody.date-days td').each(function (el) {
if (el.innerHTML == now.getDate() && !$(el).hasClass('inactive')) $(el).addClass('today')
})
}
View
2 calender.min.js
@@ -3,4 +3,4 @@
* copyright Dustin Diaz @ded 2011 | License MIT
* https://github.com/ded/calEnder
*/
-!function(e){function n(e){return e%4===0&&e%100!==0||e%400===0}function r(e,t){return[31,n(e)?29:28,31,30,31,30,31,31,30,31,30,31][t]}function i(n,r){var i=this;this.options=r||{},this.months=(this.options.months||"January February March April May June July August September October November December").split(" "),this.$input=e(n).first(),this.$calendar=e(t).appendTo("body"),this.$input.data("calender",this),this.formatDate=this.options.formatDate||function(e,t,n){return[t,n,e].join("-")},this.weekStart=this.options.weekStart||0;var s=(this.options.daysOfWeek||"S M T W T F S").split(" ");s=s.slice(this.weekStart).concat(s.slice(0,this.weekStart)),this.$calendar.find(".date-daysofweek").append("<th>"+s.join("</th><th>")+"</th>"),this.$calendar.delegate("tbody td","mouseover",function(){e(this).closest("tbody").find("td:nth-child("+(this.cellIndex+1)+")").addClass("hover")}),e(document).bind("click",function(e){i.$calendar.removeClass("active")}),this.$calendar.bind("mousedown click",function(e){e.stopPropagation(),e.preventDefault()});var o=function(e){return i.months.indexOf(e)+1};this.$calendar.delegate("tbody td","mouseout",function(){e(this).closest("tbody").find("td:nth-child("+(this.cellIndex+1)+")").removeClass("hover")}),this.$calendar.delegate("tbody td:not(.inactive)","click.day",function(t){var n=e(this).html();i.$input.val(i.formatDate(i.$calendar.find(".date-current-year").html(),o(i.$calendar.find(".date-current-month").html()),n)),i.$calendar.removeClass("active"),i.$input.trigger("change")}),this.$calendar.delegate(".date-month-previous","click",function(e){var t=parseFloat(i.$calendar.find(".date-current-year").html()),n=o(i.$calendar.find(".date-current-month").html())-1;--n==-1&&--t&&(n=11),i.setDate([t,n+1,1].join("-"))}),this.$calendar.delegate(".date-month-next","click",function(e){var t=parseFloat(i.$calendar.find(".date-current-year").html()),n=o(i.$calendar.find(".date-current-month").html());n==12&&++t&&(n=0),i.setDate([t,n+1,1].join("-"))}),this.setDate((this.options.date||new Date).toDateString())}var t="<div class='calender-date'> <table> <thead> <tr class='date-header'> <th class='date-nav date-month-previous'>&#8227;</th> <th colspan='5' class='date-month-year'> <span class='date-current-month'></span> <span class='date-current-year'></span></th> <th class='date-nav date-month-next'>&#8227;</th> </tr> <tr class='date-daysofweek'> </tr> </thead> <tbody class='date-days'></tbody> </table></div>";i.prototype.setDate=function(t){var n=new Date(t),i=(new Date(n.getFullYear(),n.getMonth(),1)).getDay(),s=r(n.getMonth()?n.getFullYear():n.getFullYear()-1,n.getMonth()?n.getMonth()-1:n.getMonth()),o=[],u=1,a=0,f=this.weekStart-(i<this.weekStart?7:0),l=s-i+f,c=r(n.getYear(),n.getMonth()),h=Math.floor((c+i-7-f)/7),p=0;this.$calendar.find(".date-current-year,.date-current-month,tbody.date-days").empty(),this.$calendar.find(".date-current-year").html(n.getFullYear()),this.$calendar.find(".date-current-month").html(this.months[n.getMonth()]),o.push("<tr>");while(l<s)o.push('<td class="inactive">'+ ++l+"</td>");while(i<7+f)o.push("<td>"+ ++a+"</td>"),i++;o.push("</tr>");for(;p<h;p++){o.push("<tr>");var d=0;while(d<7)o.push("<td>"+ ++a+"</td>"),d++;o.push("</tr>")}if(a<c){o.push("<tr>"),p=0;var v=a+7,m=0;while(p<7)a<c?o.push("<td>"+ ++a+"</td>"):o.push('<td class="inactive">'+ ++m+"</td>"),p++;o.push("</tr>")}this.$calendar.find("tbody.date-days").append(o.join(""));var g=new Date;n.getMonth()==g.getMonth()&&n.getFullYear()==g.getFullYear()&&this.$calendar.find(".date tbody.date-days td").each(function(t){t.innerHTML==g.getDate()&&!e(t).hasClass("inactive")&&e(t).addClass("today")})},e.ender({calender:function(t){e(this).forEach(function(n){var r=e(n),s=r.offset(),o=new i(n,t);r.bind("focus click",function(e){e.stopPropagation(),o.$calendar.css({left:s.left,top:s.top+s.height}).addClass("active")}).bind("keydown blur",function(e){(e.type=="blur"||e.keyCode==9)&&o.$calendar.removeClass("active")})})}},!0)}(ender)
+!function(e){function n(e){return e%4===0&&e%100!==0||e%400===0}function r(e,t){return[31,n(e)?29:28,31,30,31,30,31,31,30,31,30,31][t]}function i(n,r){var i=this;this.options=r||{},this.months=(this.options.months||"January February March April May June July August September October November December").split(" "),this.$input=e(n).first(),this.$calendar=e(t).appendTo("body"),this.$input.data("calender",this),this.formatDate=this.options.formatDate||function(e,t,n){return[t,n,e].join("-")},this.weekStart=this.options.weekStart||0;var s=(this.options.daysOfWeek||"S M T W T F S").split(" ");s=s.slice(this.weekStart).concat(s.slice(0,this.weekStart)),this.$calendar.find(".date-daysofweek").append("<th>"+s.join("</th><th>")+"</th>"),this.$calendar.delegate("tbody td","mouseover",function(){e(this).closest("tbody").find("td:nth-child("+(this.cellIndex+1)+")").addClass("hover")}),e(document).bind("click",function(e){i.$calendar.removeClass("active")}),this.$calendar.bind("mousedown click",function(e){e.stopPropagation(),e.preventDefault()});var o=function(e){return i.months.indexOf(e)+1};this.$calendar.delegate("tbody td","mouseout",function(){e(this).closest("tbody").find("td:nth-child("+(this.cellIndex+1)+")").removeClass("hover")}),this.$calendar.delegate("tbody td:not(.inactive)","click.day",function(t){var n=e(this).html();i.$input.val(i.formatDate(i.$calendar.find(".date-current-year").html(),o(i.$calendar.find(".date-current-month").html()),n)),i.$calendar.removeClass("active"),i.$input.trigger("change")}),this.$calendar.delegate(".date-month-previous","click",function(e){var t=parseFloat(i.$calendar.find(".date-current-year").html()),n=o(i.$calendar.find(".date-current-month").html())-1;--n==-1&&--t&&(n=11),i.setDate([t,n+1,1].join("-"))}),this.$calendar.delegate(".date-month-next","click",function(e){var t=parseFloat(i.$calendar.find(".date-current-year").html()),n=o(i.$calendar.find(".date-current-month").html());n==12&&++t&&(n=0),i.setDate([t,n+1,1].join("-"))}),this.setDate((this.options.date||new Date).toDateString())}var t="<div class='calender-date'> <table> <thead> <tr class='date-header'> <th class='date-nav date-month-previous'>&#8227;</th> <th colspan='5' class='date-month-year'> <span class='date-current-month'></span> <span class='date-current-year'></span></th> <th class='date-nav date-month-next'>&#8227;</th> </tr> <tr class='date-daysofweek'> </tr> </thead> <tbody class='date-days'></tbody> </table></div>";i.prototype.setDate=function(t){var n=new Date(t),i=(new Date(n.getFullYear(),n.getMonth(),1)).getDay(),s=r(n.getMonth()?n.getFullYear():n.getFullYear()-1,n.getMonth()?n.getMonth()-1:n.getMonth()),o=[],u=1,a=0,f=this.weekStart-(i<this.weekStart?7:0),l=s-i+f,c=r(n.getYear(),n.getMonth()),h=Math.floor((c+i-7-f)/7),p=0;this.$calendar.find(".date-current-year,.date-current-month,tbody.date-days").empty(),this.$calendar.find(".date-current-year").html(n.getFullYear()),this.$calendar.find(".date-current-month").html(this.months[n.getMonth()]),o.push("<tr>");while(l<s)o.push('<td class="inactive">'+ ++l+"</td>");while(i<7+f)o.push("<td>"+ ++a+"</td>"),i++;o.push("</tr>");for(;p<h;p++){o.push("<tr>");var d=0;while(d<7)o.push("<td>"+ ++a+"</td>"),d++;o.push("</tr>")}if(a<c){o.push("<tr>"),p=0;var v=a+7,m=0;while(p<7)a<c?o.push("<td>"+ ++a+"</td>"):o.push('<td class="inactive">'+ ++m+"</td>"),p++;o.push("</tr>")}this.$calendar.find("tbody.date-days").append(o.join(""));var g=new Date;n.getMonth()==g.getMonth()&&n.getFullYear()==g.getFullYear()&&this.$calendar.find(".calender-date tbody.date-days td").each(function(t){t.innerHTML==g.getDate()&&!e(t).hasClass("inactive")&&e(t).addClass("today")})},e.ender({calender:function(t){e(this).forEach(function(n){var r=e(n),s=new i(n,t);r.bind("focus click",function(e){e.stopPropagation(),offset=r.offset(),s.$calendar.css({left:offset.left,top:offset.top+offset.height}).addClass("active")}).bind("keydown blur",function(e){(e.type=="blur"||e.keyCode==9)&&s.$calendar.removeClass("active")})})}},!0)}(ender)
View
2 demo.html
@@ -28,7 +28,7 @@
months: 'Enero Febrero Marzo Abril Mayo Junio Julio Agosto Septiembre Octubre Noviembre Diciembre',
daysOfWeek: 'D L M X J V S',
formatDate: function(year, month, day) {
- return [ day, month, year].join('/')
+ return [day, month, year].join('/')
},
weekStart: 1
})
View
2 package.json
@@ -1,7 +1,7 @@
{
"name": "calender"
, "description": "Simple, themable, Datepicker for Ender"
- , "version": "1.0.0"
+ , "version": "1.0.1"
, "homepage": "https://github.com/ded/calEnder"
, "author": "Dustin Diaz <dustin@dustindiaz.com> (http://dustindiaz.com)"
, "keywords": ["ender", "calendar", "date", "datepicker", "datechooser"]

0 comments on commit f5b8034

Please sign in to comment.