Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

calender

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

calender - npm Package Compare versions

Comparing version 0.0.4 to 1.0.0

10

calender.js

@@ -9,3 +9,3 @@ /**

var template = "" +
"<div class='date'>" +
"<div class='calender-date'>" +
" <table>" +

@@ -42,4 +42,5 @@ " <thead>" +

this.$calendar = $(template).appendTo('body')
this.$input.data('calender', this)
this.formatDate = (this.options.formatDate || function(year, month, day) {
return [ month, day, year].join('-')
return [month, day, year].join('-')
})

@@ -80,2 +81,3 @@ this.weekStart = this.options.weekStart || 0

self.$calendar.removeClass('active')
self.$input.trigger('change')
})

@@ -174,4 +176,4 @@

})
.bind('keydown', function (e) {
if (e.keyCode == 9) {
.bind('keydown blur', function (e) {
if (e.type == 'blur' || e.keyCode == 9) {
calendar.$calendar.removeClass('active')

@@ -178,0 +180,0 @@ }

2

calender.min.js

@@ -6,2 +6,2 @@ /**

*/
!function(a){function c(a){return a%4===0&&a%100!==0||a%400===0}function d(a,b){return[31,c(a)?29:28,31,30,31,30,31,31,30,31,30,31][b]}function e(c,d){var e=this;this.options=d||{},this.months=(this.options.months||"January February March April May June July August September October November December").split(" "),this.$input=a(c).first(),this.$calendar=a(b).appendTo("body"),this.formatDate=this.options.formatDate||function(a,b,c){return[b,c,a].join("-")},this.weekStart=this.options.weekStart||0;var f=(this.options.daysOfWeek||"S M T W T F S").split(" ");f=f.slice(this.weekStart).concat(f.slice(0,this.weekStart)),this.$calendar.find(".date-daysofweek").append("<th>"+f.join("</th><th>")+"</th>"),this.$calendar.delegate("tbody td","mouseover",function(){a(this).closest("tbody").find("td:nth-child("+(this.cellIndex+1)+")").addClass("hover")}),a(document).bind("click",function(a){e.$calendar.removeClass("active")}),this.$calendar.bind("mousedown click",function(a){a.stopPropagation(),a.preventDefault()});var g=function(a){return e.months.indexOf(a)+1};this.$calendar.delegate("tbody td","mouseout",function(){a(this).closest("tbody").find("td:nth-child("+(this.cellIndex+1)+")").removeClass("hover")}),this.$calendar.delegate("tbody td:not(.inactive)","click.day",function(b){var c=a(this).html();e.$input.val(e.formatDate(e.$calendar.find(".date-current-year").html(),g(e.$calendar.find(".date-current-month").html()),c)),e.$calendar.removeClass("active")}),this.$calendar.delegate(".date-month-previous","click",function(a){var b=parseFloat(e.$calendar.find(".date-current-year").html()),c=g(e.$calendar.find(".date-current-month").html())-1;--c==-1&&--b&&(c=11),e.setDate([b,c+1,1].join("-"))}),this.$calendar.delegate(".date-month-next","click",function(a){var b=parseFloat(e.$calendar.find(".date-current-year").html()),c=g(e.$calendar.find(".date-current-month").html());c==12&&++b&&(c=0),e.setDate([b,c+1,1].join("-"))}),this.setDate((this.options.date||new Date).toDateString())}var b="<div class='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>";e.prototype.setDate=function(b){var c=new Date(b),e=(new Date(c.getFullYear(),c.getMonth(),1)).getDay(),f=d(c.getMonth()?c.getFullYear():c.getFullYear()-1,c.getMonth()?c.getMonth()-1:c.getMonth()),g=[],h=1,i=0,j=this.weekStart-(e<this.weekStart?7:0),k=f-e+j,l=d(c.getYear(),c.getMonth()),m=Math.floor((l+e-7-j)/7),n=0;this.$calendar.find(".date-current-year,.date-current-month,tbody.date-days").empty(),this.$calendar.find(".date-current-year").html(c.getFullYear()),this.$calendar.find(".date-current-month").html(this.months[c.getMonth()]),g.push("<tr>");while(k<f)g.push('<td class="inactive">'+ ++k+"</td>");while(e<7+j)g.push("<td>"+ ++i+"</td>"),e++;g.push("</tr>");for(;n<m;n++){g.push("<tr>");var o=0;while(o<7)g.push("<td>"+ ++i+"</td>"),o++;g.push("</tr>")}if(i<l){g.push("<tr>"),n=0;var p=i+7,q=0;while(n<7)i<l?g.push("<td>"+ ++i+"</td>"):g.push('<td class="inactive">'+ ++q+"</td>"),n++;g.push("</tr>")}this.$calendar.find("tbody.date-days").append(g.join(""));var r=new Date;c.getMonth()==r.getMonth()&&c.getFullYear()==r.getFullYear()&&this.$calendar.find(".date tbody.date-days td").each(function(b){b.innerHTML==r.getDate()&&!a(b).hasClass("inactive")&&a(b).addClass("today")})},a.ender({calender:function(b){a(this).forEach(function(c){var d=a(c),f=d.offset(),g=new e(c,b);d.bind("focus click",function(a){a.stopPropagation(),g.$calendar.css({left:f.left,top:f.top+f.height}).addClass("active")}).bind("keydown",function(a){a.keyCode==9&&g.$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(".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)

@@ -20,7 +20,7 @@ {

, "indent": 2
, "whitespace": true
, "asi": true
, "laxbreak": true
, "plusplus": false
, "laxcomma": true
}
}
{
"name": "calender"
, "description": "Simple, themable, Datepicker for Ender"
, "version": "0.0.4"
, "version": "1.0.0"
, "homepage": "https://github.com/ded/calEnder"

@@ -17,5 +17,9 @@ , "author": "Dustin Diaz <dustin@dustindiaz.com> (http://dustindiaz.com)"

}
, "devDependencies": {
"smoosh": "*"
, "console-browserify": "*"
}
, "scripts": {
"build": "node Makefile.js"
"build": "smoosh make Makefile.js"
}
}
# CalEnder
A basic, themeable calendar datepicker for [Ender](http://ender.no.de)
![calender](http://dustindiaz.com/basement/img/calender.png)
![calender](http://f.cl.ly/items/2k2j2c2I1R3z391x343f/Screen%20Shot%202013-04-07%20at%209.18.05%20AM.png)

@@ -26,2 +26,2 @@ Currently, this depends on Enders minimal starter pack [The Jeesh](https://github.com/ender-js/jeesh)

Enjoy!
Enjoy!

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc