zebra-datepicker-rails 1.8.7 → 1.8.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +21 -2
- data/lib/zebra-datepicker-rails/version.rb +1 -1
- data/vendor/assets/javascripts/zebra-datepicker/zebra_datepicker.js +1 -1
- data/vendor/assets/javascripts/zebra-datepicker/zebra_datepicker.src.js +190 -125
- data/vendor/assets/stylesheets/zebra-datepicker/{bootstrap.css → bootstrap.css.scss} +8 -4
- data/vendor/assets/stylesheets/zebra-datepicker/{default.css → default.css.scss} +8 -4
- data/vendor/assets/stylesheets/zebra-datepicker/{metallic.css → metallic.css.scss} +8 -4
- metadata +17 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be056c8cd0e7e7e6717bdda3883c456e0ccce09f
|
4
|
+
data.tar.gz: e2d3dca9a10f5e1b87804a129f3707396387298d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df1df9a18b1758af528cbfe037bdf71a142310aacb153384a49c29975f33200e3b17e4c285113681aea579617e9522a4b8cc76340b0612d66f2cde0e93810c37
|
7
|
+
data.tar.gz: 417bf42d47ed75260fa728cc6d7de7365203ae4a8a55a8f365af181c197cd1450534087316da1ba3e6571ae40aaf8f630c44708a830c81a0c2c95c030136286e
|
data/Rakefile
CHANGED
@@ -3,11 +3,30 @@ require "bundler/gem_tasks"
|
|
3
3
|
desc "Change css url calls to use sass-rails' asset-url"
|
4
4
|
task :change_css_url do
|
5
5
|
Dir.chdir('vendor/assets/stylesheets/zebra-datepicker/')
|
6
|
-
Dir.glob('*.css').each do |filename|
|
6
|
+
Dir.glob('*.css.scss').each do |filename|
|
7
7
|
content = File.read(filename).gsub!(" url('", " asset-url('zebra-datepicker/")
|
8
8
|
file = File.open(filename, 'w')
|
9
9
|
file.write(content)
|
10
10
|
file.close
|
11
11
|
end
|
12
|
-
|
13
12
|
end
|
13
|
+
|
14
|
+
desc 'Copy Assets from Zebra_Datepicker'
|
15
|
+
|
16
|
+
task :copy do
|
17
|
+
{
|
18
|
+
'public/css/bootstrap.css' => 'vendor/assets/stylesheets/zebra-datepicker/bootstrap.css.scss',
|
19
|
+
'public/css/default.css' => 'vendor/assets/stylesheets/zebra-datepicker/default.css.scss',
|
20
|
+
'public/css/metallic.css' => 'vendor/assets/stylesheets/zebra-datepicker/metallic.css.scss',
|
21
|
+
|
22
|
+
'public/css/metallic/' => 'vendor/assets/images/zebra-datepicker/',
|
23
|
+
'public/css/calendar-disabled.png' => 'vendor/assets/images/zebra-datepicker/',
|
24
|
+
'public/css/calendar.png' => 'vendor/assets/images/zebra-datepicker/',
|
25
|
+
|
26
|
+
'public/javascript/zebra_datepicker.js' => 'vendor/assets/javascripts/zebra-datepicker/',
|
27
|
+
'public/javascript/zebra_datepicker.src.js' => 'vendor/assets/javascripts/zebra-datepicker/'
|
28
|
+
}.each do |src, dest|
|
29
|
+
FileUtils.cp_r("../Zebra_Datepicker/#{src}", dest)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
@@ -1 +1 @@
|
|
1
|
-
(function(c){c.Zebra_DatePicker=function(ga,ha){var ka={always_visible:!1,days:"Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),days_abbr:!1,direction:0,disabled_dates:!1,enabled_dates:!1,first_day_of_week:1,format:"Y-m-d",header_navigation:["«","»"],inside:!0,lang_clear_date:"Clear date",months:"January February March April May June July August September October November December".split(" "),months_abbr:!1,offset:[5,-5],pair:!1,readonly_element:!0,select_other_months:!1, show_clear_date:0,show_icon:!0,show_other_months:!0,show_select_today:"Today",show_week_number:!1,start_date:!1,strict:!1,view:"days",weekend_days:[0,6],zero_pad:!1,onChange:null,onClear:null,onSelect:null},t,h,w,C,D,G,H,S,T,N,Z,g,q,y,u,p,U,J,K,V,F,$,r,v,aa,O,W,la,ma,na,A,ia,ba,X,ca,oa,a=this;a.settings={};var d=c(ga),ra=function(e){if(!e){a.settings=c.extend({},ka,ha);for(var b in d.data())0===b.indexOf("zdp_")&&(b=b.replace(/^zdp\_/,""),void 0!==ka[b]&&(a.settings[b]=d.data("zdp_"+b)))}a.settings.readonly_element&& d.attr("readonly","readonly");b={days:["d","j","D"],months:["F","m","M","n","t"],years:["o","Y","y"]};var z=!1,f=!1,k=!1,E=null;for(E in b)c.each(b[E],function(c,b){-1<a.settings.format.indexOf(b)&&("days"==E?z=!0:"months"==E?f=!0:"years"==E&&(k=!0))});A=z&&f&&k?["years","months","days"]:!z&&f&&k?["years","months"]:z||f||!k?z||!f||k?["years","months","days"]:["months"]:["years"];-1==c.inArray(a.settings.view,A)&&(a.settings.view=A[A.length-1]);F=[];V=[];for(var n=0;2>n;n++)b=0===n?a.settings.disabled_dates: a.settings.enabled_dates,c.isArray(b)&&0<b.length&&c.each(b,function(){for(var a=this.split(" "),b=0;4>b;b++){a[b]||(a[b]="*");a[b]=-1<a[b].indexOf(",")?a[b].split(","):Array(a[b]);for(var e=0;e<a[b].length;e++)if(-1<a[b][e].indexOf("-")){var z=a[b][e].match(/^([0-9]+)\-([0-9]+)/);if(null!==z){for(var f=s(z[1]);f<=s(z[2]);f++)-1==c.inArray(f,a[b])&&a[b].push(f+"");a[b].splice(e,1)}}for(e=0;e<a[b].length;e++)a[b][e]=isNaN(s(a[b][e]))?a[b][e]:s(a[b][e])}0===n?F.push(a):V.push(a)});b=new Date;var m= a.settings.reference_date?a.settings.reference_date:d.data("zdp_reference_date")&&void 0!==d.data("zdp_reference_date")?d.data("zdp_reference_date"):b,l,L;v=r=void 0;g=m.getMonth();T=b.getMonth();q=m.getFullYear();N=b.getFullYear();y=m.getDate();Z=b.getDate();if(!0===a.settings.direction)r=m;else if(!1===a.settings.direction)v=m,W=v.getMonth(),O=v.getFullYear(),aa=v.getDate();else if(!c.isArray(a.settings.direction)&&Y(a.settings.direction)&&0<s(a.settings.direction)||c.isArray(a.settings.direction)&& ((l=da(a.settings.direction[0]))||!0===a.settings.direction[0]||Y(a.settings.direction[0])&&0<a.settings.direction[0])&&((L=da(a.settings.direction[1]))||!1===a.settings.direction[1]||Y(a.settings.direction[1])&&0<=a.settings.direction[1]))r=l?l:new Date(q,g,y+(c.isArray(a.settings.direction)?s(!0===a.settings.direction[0]?0:a.settings.direction[0]):s(a.settings.direction))),g=r.getMonth(),q=r.getFullYear(),y=r.getDate(),L&&+L>=+r?v=L:!L&&!1!==a.settings.direction[1]&&c.isArray(a.settings.direction)&& (v=new Date(q,g,y+s(a.settings.direction[1]))),v&&(W=v.getMonth(),O=v.getFullYear(),aa=v.getDate());else if(!c.isArray(a.settings.direction)&&Y(a.settings.direction)&&0>s(a.settings.direction)||c.isArray(a.settings.direction)&&(!1===a.settings.direction[0]||Y(a.settings.direction[0])&&0>a.settings.direction[0])&&((l=da(a.settings.direction[1]))||Y(a.settings.direction[1])&&0<=a.settings.direction[1]))v=new Date(q,g,y+(c.isArray(a.settings.direction)?s(!1===a.settings.direction[0]?0:a.settings.direction[0]): s(a.settings.direction))),W=v.getMonth(),O=v.getFullYear(),aa=v.getDate(),l&&+l<+v?r=l:!l&&c.isArray(a.settings.direction)&&(r=new Date(O,W,aa-s(a.settings.direction[1]))),r&&(g=r.getMonth(),q=r.getFullYear(),y=r.getDate());else if(c.isArray(a.settings.disabled_dates)&&0<a.settings.disabled_dates.length)for(var P in F)if("*"==F[P][0]&&"*"==F[P][1]&&"*"==F[P][2]&&"*"==F[P][3]){var fa=[];c.each(V,function(){"*"!=this[2][0]&&fa.push(parseInt(this[2][0]+("*"==this[1][0]?"12":x(this[1][0],2))+("*"==this[0][0]? "*"==this[1][0]?"31":(new Date(this[2][0],this[1][0],0)).getDate():x(this[0][0],2)),10))});fa.sort();if(0<fa.length){var Q=(fa[0]+"").match(/([0-9]{4})([0-9]{2})([0-9]{2})/);q=parseInt(Q[1],10);g=parseInt(Q[2],10)-1;y=parseInt(Q[3],10)}break}if(B(q,g,y)){for(;B(q);)r?(q++,g=0):(q--,g=11);for(;B(q,g);)r?(g++,y=1):(g--,y=(new Date(q,g+1,0)).getDate()),11<g?(q++,g=0,y=1):0>g&&(q--,g=11,y=(new Date(q,g+1,0)).getDate());for(;B(q,g,y);)r?y++:y--,b=new Date(q,g,y),q=b.getFullYear(),g=b.getMonth(),y=b.getDate(); b=new Date(q,g,y);q=b.getFullYear();g=b.getMonth();y=b.getDate()}(l=da(d.val()||(a.settings.start_date?a.settings.start_date:"")))&&a.settings.strict&&B(l.getFullYear(),l.getMonth(),l.getDate())&&d.val("");e||pa(r);if(!a.settings.always_visible&&(e||(a.settings.show_icon?("firefox"==M.name&&d.is('input[type="text"]')&&"inline"==d.css("display")&&d.css("display","inline-block"),l=jQuery('<span class="Zebra_DatePicker_Icon_Wrapper"></span>').css({display:d.css("display"),position:"static"==d.css("position")? "relative":d.css("position"),"float":d.css("float"),top:d.css("top"),right:d.css("right"),bottom:d.css("bottom"),left:d.css("left")}),d.wrap(l).css({position:"relative",top:"auto",right:"auto",bottom:"auto",left:"auto"}),w=jQuery('<button type="button" class="Zebra_DatePicker_Icon'+("disabled"==d.attr("disabled")?" Zebra_DatePicker_Icon_Disabled":"")+'">Pick a date</button>'),a.icon=w,ia=w.add(d)):ia=d,ia.bind("click",function(b){b.preventDefault();d.attr("disabled")||("none"!=h.css("display")?a.hide(): a.show())}),void 0!==w&&w.insertAfter(d)),void 0!==w)){w.attr("style","");a.settings.inside&&w.addClass("Zebra_DatePicker_Icon_Inside");l=d.outerWidth();L=d.outerHeight();P=parseInt(d.css("marginLeft"),10)||0;b=parseInt(d.css("marginTop"),10)||0;var m=w.outerWidth(),qa=w.outerHeight(),ua=parseInt(w.css("marginLeft"),10)||0,va=parseInt(w.css("marginRight"),10)||0;a.settings.inside?w.css({top:b+(L-qa)/2,left:P+(l-m-va)}):w.css({top:b+(L-qa)/2,left:P+l+ua})}ca=!1!==a.settings.show_select_today&&-1<c.inArray("days", A)&&!B(N,T,Z)?a.settings.show_select_today:!1;e||(c(window).bind("resize.Zebra_DatePicker",function(){a.hide();void 0!==w&&(clearTimeout(oa),oa=setTimeout(function(){a.update()},100))}),h=c('<div class="Zebra_DatePicker"><table class="dp_header"><tr><td class="dp_previous">'+a.settings.header_navigation[0]+'</td><td class="dp_caption"> </td><td class="dp_next">'+a.settings.header_navigation[1]+'</td></tr></table><table class="dp_daypicker"></table><table class="dp_monthpicker"></table><table class="dp_yearpicker"></table><table class="dp_footer"><tr><td class="dp_today"'+ (!1!==a.settings.show_clear_date?' style="width:50%"':"")+">"+ca+'</td><td class="dp_clear"'+(!1!==ca?' style="width:50%"':"")+">"+a.settings.lang_clear_date+"</td></tr></table></div>"),a.datepicker=h,C=c("table.dp_header",h),D=c("table.dp_daypicker",h),G=c("table.dp_monthpicker",h),H=c("table.dp_yearpicker",h),X=c("table.dp_footer",h),ba=c("td.dp_today",X),S=c("td.dp_clear",X),a.settings.always_visible?d.attr("disabled")||(a.settings.always_visible.append(h),a.show()):c("body").append(h),h.delegate("td:not(.dp_disabled, .dp_weekend_disabled, .dp_not_in_month, .dp_blocked, .dp_week_number)", "mouseover",function(){c(this).addClass("dp_hover")}).delegate("td:not(.dp_disabled, .dp_weekend_disabled, .dp_not_in_month, .dp_blocked, .dp_week_number)","mouseout",function(){c(this).removeClass("dp_hover")}),wa(c("td",C)),c(".dp_previous",C).bind("click",function(){c(this).hasClass("dp_blocked")||("months"==t?p--:"years"==t?p-=12:0>--u&&(u=11,p--),R())}),c(".dp_caption",C).bind("click",function(){t="days"==t?-1<c.inArray("months",A)?"months":-1<c.inArray("years",A)?"years":"days":"months"==t? -1<c.inArray("years",A)?"years":-1<c.inArray("days",A)?"days":"months":-1<c.inArray("days",A)?"days":-1<c.inArray("months",A)?"months":"years";R()}),c(".dp_next",C).bind("click",function(){c(this).hasClass("dp_blocked")||("months"==t?p++:"years"==t?p+=12:12==++u&&(u=0,p++),R())}),D.delegate("td:not(.dp_disabled, .dp_weekend_disabled, .dp_not_in_month, .dp_week_number)","click",function(){a.settings.select_other_months&&null!==(Q=c(this).attr("class").match(/date\_([0-9]{4})(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])/))? ea(Q[1],Q[2]-1,Q[3],"days",c(this)):ea(p,u,s(c(this).html()),"days",c(this))}),G.delegate("td:not(.dp_disabled)","click",function(){var b=c(this).attr("class").match(/dp\_month\_([0-9]+)/);u=s(b[1]);-1==c.inArray("days",A)?ea(p,u,1,"months",c(this)):(t="days",a.settings.always_visible&&d.val(""),R())}),H.delegate("td:not(.dp_disabled)","click",function(){p=s(c(this).html());-1==c.inArray("months",A)?ea(p,1,1,"years",c(this)):(t="months",a.settings.always_visible&&d.val(""),R())}),c(ba).bind("click", function(b){b.preventDefault();ea(N,T,Z,"days",c(".dp_current",D));a.settings.always_visible&&a.show();a.hide()}),c(S).bind("click",function(b){b.preventDefault();d.val("");a.settings.always_visible?(K=J=U=null,c("td.dp_selected",h).removeClass("dp_selected")):p=u=K=J=U=null;a.hide();if(a.settings.onClear&&"function"==typeof a.settings.onClear)a.settings.onClear(d)}),a.settings.always_visible||c(document).bind({"mousedown.Zebra_DatePicker":function(b){if("block"==h.css("display")){if(a.settings.show_icon&& c(b.target).get(0)===w.get(0))return!0;0===c(b.target).parents().filter(".Zebra_DatePicker").length&&a.hide()}},"keyup.Zebra_DatePicker":function(b){"block"!=h.css("display")&&27!=b.which||a.hide()}}),R())};a.destroy=function(){void 0!==a.icon&&a.icon.remove();a.datepicker.remove();c(document).unbind("keyup.Zebra_DatePicker");c(document).unbind("mousedown.Zebra_DatePicker");c(window).unbind("resize.Zebra_DatePicker");d.removeData("Zebra_DatePicker");delete a};a.hide=function(){a.settings.always_visible|| (sa("hide"),h.hide())};a.show=function(){t=a.settings.view;var e=da(d.val()||(a.settings.start_date?a.settings.start_date:""));e?(J=e.getMonth(),u=e.getMonth(),K=e.getFullYear(),p=e.getFullYear(),U=e.getDate(),B(K,J,U)&&(a.settings.strict&&d.val(""),u=g,p=q)):(u=g,p=q);R();if(a.settings.always_visible)h.show();else{var e=h.outerWidth(),b=h.outerHeight(),z=(void 0!==w?w.offset().left+w.outerWidth(!0):d.offset().left+d.outerWidth(!0))+a.settings.offset[0],f=(void 0!==w?w.offset().top:d.offset().top)- b+a.settings.offset[1],k=c(window).width(),E=c(window).height(),n=c(window).scrollTop(),m=c(window).scrollLeft();z+e>m+k&&(z=m+k-e);z<m&&(z=m);f+b>n+E&&(f=n+E-b);f<n&&(f=n);h.css({left:z,top:f});h.fadeIn("explorer"==M.name&&9>M.version?0:150,"linear");sa()}};a.update=function(e){a.original_direction&&(a.original_direction=a.direction);a.settings=c.extend(a.settings,e);ra(!0)};var da=function(e){e+="";if(""!==c.trim(e)){for(var b=a.settings.format.replace(/([-.,*+?^${}()|[\]\/\\])/g,"\\$1"),z="dDjlNSwFmMnYy".split(""), f=[],k=[],E=null,n=null,m=0;m<z.length;m++)-1<(E=b.indexOf(z[m]))&&f.push({character:z[m],position:E});f.sort(function(a,b){return a.position-b.position});c.each(f,function(a,b){switch(b.character){case "d":k.push("0[1-9]|[12][0-9]|3[01]");break;case "D":k.push("[a-z]{3}");break;case "j":k.push("[1-9]|[12][0-9]|3[01]");break;case "l":k.push("[a-z]+");break;case "N":k.push("[1-7]");break;case "S":k.push("st|nd|rd|th");break;case "w":k.push("[0-6]");break;case "F":k.push("[a-z]+");break;case "m":k.push("0[1-9]|1[012]+"); break;case "M":k.push("[a-z]{3}");break;case "n":k.push("[1-9]|1[012]");break;case "Y":k.push("[0-9]{4}");break;case "y":k.push("[0-9]{2}")}});if(k.length&&(f.reverse(),c.each(f,function(a,c){b=b.replace(c.character,"("+k[k.length-a-1]+")")}),k=RegExp("^"+b+"$","ig"),n=k.exec(e))){e=new Date;var l=e.getDate(),d=e.getMonth()+1,p=e.getFullYear(),g="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),h="January February March April May June July August September October November December".split(" "), q,u=!0;f.reverse();c.each(f,function(b,e){if(!u)return!0;switch(e.character){case "m":case "n":d=s(n[b+1]);break;case "d":case "j":l=s(n[b+1]);break;case "D":case "l":case "F":case "M":q="D"==e.character||"l"==e.character?a.settings.days:a.settings.months;u=!1;c.each(q,function(a,c){if(u)return!0;if(n[b+1].toLowerCase()==c.substring(0,"D"==e.character||"M"==e.character?3:c.length).toLowerCase()){switch(e.character){case "D":n[b+1]=g[a].substring(0,3);break;case "l":n[b+1]=g[a];break;case "F":n[b+ 1]=h[a];d=a+1;break;case "M":n[b+1]=h[a].substring(0,3),d=a+1}u=!0}});break;case "Y":p=s(n[b+1]);break;case "y":p="19"+s(n[b+1])}});if(u&&(f=new Date(p,(d||1)-1,l||1),f.getFullYear()==p&&f.getDate()==(l||1)&&f.getMonth()==(d||1)-1))return f}return!1}},wa=function(a){"firefox"==M.name?a.css("MozUserSelect","none"):"explorer"==M.name?a.bind("selectstart",function(){return!1}):a.mousedown(function(){return!1})},ta=function(){var e=(new Date(p,u+1,0)).getDate(),b=(new Date(p,u,1)).getDay(),z=(new Date(p, u,0)).getDate(),b=b-a.settings.first_day_of_week,b=0>b?7+b:b;ja(a.settings.months[u]+", "+p);var f="<tr>";a.settings.show_week_number&&(f+="<th>"+a.settings.show_week_number+"</th>");for(var k=0;7>k;k++)f+="<th>"+(c.isArray(a.settings.days_abbr)&&void 0!==a.settings.days_abbr[(a.settings.first_day_of_week+k)%7]?a.settings.days_abbr[(a.settings.first_day_of_week+k)%7]:a.settings.days[(a.settings.first_day_of_week+k)%7].substr(0,2))+"</th>";f+="</tr><tr>";for(k=0;42>k;k++){0<k&&0===k%7&&(f+="</tr><tr>"); if(0===k%7&&a.settings.show_week_number){var d=new Date(p,u,k-b+1),n=d.getFullYear(),m=d.getMonth()+1,d=d.getDate(),l=void 0,g=void 0,h=void 0,s=h=void 0,q=void 0,h=g=l=void 0;3>m?(l=n-1,g=(l/4|0)-(l/100|0)+(l/400|0),h=((l-1)/4|0)-((l-1)/100|0)+((l-1)/400|0),h=g-h,s=0,q=d-1+31*(m-1)):(l=n,g=(l/4|0)-(l/100|0)+(l/400|0),h=((l-1)/4|0)-((l-1)/100|0)+((l-1)/400|0),h=g-h,s=h+1,q=d+((153*(m-3)+2)/5|0)+58+h);l=(l+g)%7;d=(q+l-s)%7;g=q+3-d;h=0>g?53-((l-h)/5|0):g>364+h?1:(g/7|0)+1;f+='<td class="dp_week_number">'+ h+"</td>"}n=k-b+1;if(a.settings.select_other_months&&(k<b||n>e))var r=new Date(p,u,n),v=r.getFullYear(),t=r.getMonth(),w=r.getDate(),r=v+x(t+1,2)+x(w,2);k<b?f+='<td class="'+(a.settings.select_other_months&&!B(v,t,w)?"dp_not_in_month_selectable date_"+r:"dp_not_in_month")+'">'+(a.settings.select_other_months||a.settings.show_other_months?x(z-b+k+1,a.settings.zero_pad?2:0):" ")+"</td>":n>e?f+='<td class="'+(a.settings.select_other_months&&!B(v,t,w)?"dp_not_in_month_selectable date_"+r:"dp_not_in_month")+ '">'+(a.settings.select_other_months||a.settings.show_other_months?x(n-e,a.settings.zero_pad?2:0):" ")+"</td>":(m=(a.settings.first_day_of_week+k)%7,d="",B(p,u,n)?(d=-1<c.inArray(m,a.settings.weekend_days)?"dp_weekend_disabled":d+" dp_disabled",u==T&&p==N&&Z==n&&(d+=" dp_disabled_current")):(-1<c.inArray(m,a.settings.weekend_days)&&(d="dp_weekend"),u==J&&p==K&&U==n&&(d+=" dp_selected"),u==T&&p==N&&Z==n&&(d+=" dp_current")),f+="<td"+(""!==d?' class="'+c.trim(d)+'"':"")+">"+(a.settings.zero_pad? x(n,2):n)+"</td>")}D.html(c(f+"</tr>"));a.settings.always_visible&&(la=c("td:not(.dp_disabled, .dp_weekend_disabled, .dp_not_in_month, .dp_blocked, .dp_week_number)",D));D.show()},xa=function(){ja(p);for(var e="<tr>",b=0;12>b;b++){0<b&&0===b%3&&(e+="</tr><tr>");var d="dp_month_"+b;B(p,b)?d+=" dp_disabled":!1!==J&&J==b?d+=" dp_selected":T==b&&N==p&&(d+=" dp_current");e+='<td class="'+c.trim(d)+'">'+(c.isArray(a.settings.months_abbr)&&void 0!==a.settings.months_abbr[b]?a.settings.months_abbr[b]:a.settings.months[b].substr(0, 3))+"</td>"}G.html(c(e+"</tr>"));a.settings.always_visible&&(ma=c("td:not(.dp_disabled)",G));G.show()},ya=function(){ja(p-7+" - "+(p+4));for(var e="<tr>",b=0;12>b;b++){0<b&&0===b%3&&(e+="</tr><tr>");var d="";B(p-7+b)?d+=" dp_disabled":K&&K==p-7+b?d+=" dp_selected":N==p-7+b&&(d+=" dp_current");e+="<td"+(""!==c.trim(d)?' class="'+c.trim(d)+'"':"")+">"+(p-7+b)+"</td>"}H.html(c(e+"</tr>"));a.settings.always_visible&&(na=c("td:not(.dp_disabled)",H));H.show()},sa=function(a){if("explorer"==M.name&&6==M.version){if(!$){var b= s(h.css("zIndex"))-1;$=jQuery("<iframe>",{src:'javascript:document.write("")',scrolling:"no",frameborder:0,allowtransparency:"true",css:{zIndex:b,position:"absolute",top:-1E3,left:-1E3,width:h.outerWidth(),height:h.outerHeight(),filter:"progid:DXImageTransform.Microsoft.Alpha(opacity=0)",display:"none"}});c("body").append($)}switch(a){case "hide":$.hide();break;default:a=h.offset(),$.css({top:a.top,left:a.left,display:"block"})}}},B=function(e,b,d){if((void 0===e||isNaN(e))&&(void 0===b||isNaN(b))&& (void 0===d||isNaN(d)))return!1;if(c.isArray(a.settings.direction)||0!==s(a.settings.direction)){var f=s(I(e,"undefined"!=typeof b?x(b,2):"","undefined"!=typeof d?x(d,2):"")),k=(f+"").length;if(8==k&&("undefined"!=typeof r&&f<s(I(q,x(g,2),x(y,2)))||"undefined"!=typeof v&&f>s(I(O,x(W,2),x(aa,2))))||6==k&&("undefined"!=typeof r&&f<s(I(q,x(g,2)))||"undefined"!=typeof v&&f>s(I(O,x(W,2))))||4==k&&("undefined"!=typeof r&&f<q||"undefined"!=typeof v&&f>O))return!0}"undefined"!=typeof b&&(b+=1);var h=!1,n= !1;F&&c.each(F,function(){if(!h&&(-1<c.inArray(e,this[2])||-1<c.inArray("*",this[2]))&&("undefined"!=typeof b&&-1<c.inArray(b,this[1])||-1<c.inArray("*",this[1]))&&("undefined"!=typeof d&&-1<c.inArray(d,this[0])||-1<c.inArray("*",this[0]))){if("*"==this[3])return h=!0;var a=(new Date(e,b-1,d)).getDay();if(-1<c.inArray(a,this[3]))return h=!0}});V&&c.each(V,function(){if(!n&&(-1<c.inArray(e,this[2])||-1<c.inArray("*",this[2]))&&(n=!0,"undefined"!=typeof b))if(n=!0,-1<c.inArray(b,this[1])||-1<c.inArray("*", this[1])){if("undefined"!=typeof d){n=!0;if(-1<c.inArray(d,this[0])||-1<c.inArray("*",this[0])){if("*"==this[3])return n=!0;var a=(new Date(e,b-1,d)).getDay();if(-1<c.inArray(a,this[3]))return n=!0}n=!1}}else n=!1});return V&&n||!F||!h?!1:!0},Y=function(a){return(a+"").match(/^\-?[0-9]+$/)?!0:!1},ja=function(e){c(".dp_caption",C).html(e);if(c.isArray(a.settings.direction)||0!==s(a.settings.direction)||1==A.length&&"months"==A[0]){e=p;var b=u,d,f;if("days"==t)f=!B(0>b-1?I(e-1,"11"):I(e,x(b-1,2))), d=!B(11<b+1?I(e+1,"00"):I(e,x(b+1,2)));else if("months"==t){if(!r||r.getFullYear()<=e-1)f=!0;if(!v||v.getFullYear()>=e+1)d=!0}else if("years"==t){if(!r||r.getFullYear()<e-7)f=!0;if(!v||v.getFullYear()>e+4)d=!0}f?c(".dp_previous",C).removeClass("dp_blocked"):(c(".dp_previous",C).addClass("dp_blocked"),c(".dp_previous",C).removeClass("dp_hover"));d?c(".dp_next",C).removeClass("dp_blocked"):(c(".dp_next",C).addClass("dp_blocked"),c(".dp_next",C).removeClass("dp_hover"))}},R=function(){if(""===D.text()|| "days"==t){if(""===D.text()){a.settings.always_visible||h.css("left",-1E3);h.show();ta();var e=D.outerWidth(),b=D.outerHeight();G.css({width:e,height:b});H.css({width:e,height:b});C.css("width",e);X.css("width",e);h.hide()}else ta();G.hide();H.hide()}else"months"==t?(xa(),D.hide(),H.hide()):"years"==t&&(ya(),D.hide(),G.hide());a.settings.onChange&&"function"==typeof a.settings.onChange&&void 0!==t&&(e="days"==t?D.find("td:not(.dp_disabled, .dp_weekend_disabled, .dp_not_in_month, .dp_blocked)"):"months"== t?G.find("td:not(.dp_disabled, .dp_weekend_disabled, .dp_not_in_month, .dp_blocked)"):H.find("td:not(.dp_disabled, .dp_weekend_disabled, .dp_not_in_month, .dp_blocked)"),e.each(function(){if("days"==t)if(c(this).hasClass("dp_not_in_month_selectable")){var a=c(this).attr("class").match(/date\_([0-9]{4})(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])/);c(this).data("date",a[1]+"-"+a[2]+"-"+a[3])}else c(this).data("date",p+"-"+x(u+1,2)+"-"+x(s(c(this).text()),2));else"months"==t?(a=c(this).attr("class").match(/dp\_month\_([0-9]+)/), c(this).data("date",p+"-"+x(s(a[1])+1,2))):c(this).data("date",s(c(this).text()))}),a.settings.onChange(t,e,d));X.show();!0===a.settings.show_clear_date||0===a.settings.show_clear_date&&""!==d.val()||a.settings.always_visible&&!1!==a.settings.show_clear_date?(S.show(),ca?(ba.css("width","50%"),S.css("width","50%")):(ba.hide(),S.css("width","100%"))):(S.hide(),ca?ba.show().css("width","100%"):X.hide())},ea=function(e,b,h,f,k){var g=new Date(e,b,h,12,0,0),n="days"==f?la:"months"==f?ma:na,m;m="";for(var l= g.getDate(),q=g.getDay(),s=a.settings.days[q],r=g.getMonth()+1,v=a.settings.months[r-1],t=g.getFullYear()+"",w=0;w<a.settings.format.length;w++){var y=a.settings.format.charAt(w);switch(y){case "y":t=t.substr(2);case "Y":m+=t;break;case "m":r=x(r,2);case "n":m+=r;break;case "M":v=c.isArray(a.settings.months_abbr)&&void 0!==a.settings.months_abbr[r-1]?a.settings.months_abbr[r-1]:a.settings.months[r-1].substr(0,3);case "F":m+=v;break;case "d":l=x(l,2);case "j":m+=l;break;case "D":s=c.isArray(a.settings.days_abbr)&& void 0!==a.settings.days_abbr[q]?a.settings.days_abbr[q]:a.settings.days[q].substr(0,3);case "l":m+=s;break;case "N":q++;case "w":m+=q;break;case "S":m=1==l%10&&"11"!=l?m+"st":2==l%10&&"12"!=l?m+"nd":3==l%10&&"13"!=l?m+"rd":m+"th";break;default:m+=y}}d.val(m);a.settings.always_visible&&(J=g.getMonth(),u=g.getMonth(),K=g.getFullYear(),p=g.getFullYear(),U=g.getDate(),n.removeClass("dp_selected"),k.addClass("dp_selected"),"days"==f&&k.hasClass("dp_not_in_month_selectable")&&a.show());a.hide();pa(g); if(a.settings.onSelect&&"function"==typeof a.settings.onSelect)a.settings.onSelect(m,e+"-"+x(b+1,2)+"-"+x(h,2),g,d);d.focus()},I=function(){for(var a="",b=0;b<arguments.length;b++)a+=arguments[b]+"";return a},x=function(a,b){for(a+="";a.length<b;)a="0"+a;return a},s=function(a){return parseInt(a,10)},pa=function(e){a.settings.pair&&c.each(a.settings.pair,function(){var a=c(this);a.data&&a.data("Zebra_DatePicker")?(a=a.data("Zebra_DatePicker"),a.update({reference_date:e,direction:0===a.settings.direction? 1:a.settings.direction}),a.settings.always_visible&&a.show()):a.data("zdp_reference_date",e)})},M={init:function(){this.name=this.searchString(this.dataBrowser)||"";this.version=this.searchVersion(navigator.userAgent)||this.searchVersion(navigator.appVersion)||""},searchString:function(a){for(var b=0;b<a.length;b++){var c=a[b].string,d=a[b].prop;this.versionSearchString=a[b].versionSearch||a[b].identity;if(c){if(-1!=c.indexOf(a[b].subString))return a[b].identity}else if(d)return a[b].identity}},searchVersion:function(a){var b= a.indexOf(this.versionSearchString);if(-1!=b)return parseFloat(a.substring(b+this.versionSearchString.length+1))},dataBrowser:[{string:navigator.userAgent,subString:"Firefox",identity:"firefox"},{string:navigator.userAgent,subString:"MSIE",identity:"explorer",versionSearch:"MSIE"}]};M.init();ra()};c.fn.Zebra_DatePicker=function(ga){return this.each(function(){void 0!==c(this).data("Zebra_DatePicker")&&c(this).data("Zebra_DatePicker").destroy();var ha=new c.Zebra_DatePicker(this,ga);c(this).data("Zebra_DatePicker", ha)})}})(jQuery);
|
1
|
+
!function(a){"use strict";a.Zebra_DatePicker=function(b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N={always_visible:!1,days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],days_abbr:!1,default_position:"above",direction:0,disabled_dates:!1,enabled_dates:!1,first_day_of_week:1,format:"Y-m-d",header_captions:{days:"F, Y",months:"Y",years:"Y1 - Y2"},header_navigation:["«","»"],inside:!0,lang_clear_date:"Clear date",months:["January","February","March","April","May","June","July","August","September","October","November","December"],months_abbr:!1,offset:[5,-5],pair:!1,readonly_element:!0,select_other_months:!1,show_clear_date:0,show_icon:!0,show_other_months:!0,show_select_today:"Today",show_week_number:!1,start_date:!1,strict:!1,view:"days",weekend_days:[0,6],zero_pad:!1,onChange:null,onClear:null,onOpen:null,onSelect:null},O=this;O.settings={};var P=a(b),Q=function(b){if(!b){O.settings=a.extend({},N,c);for(var y in P.data())0===y.indexOf("zdp_")&&(y=y.replace(/^zdp\_/,""),void 0!==N[y]&&(O.settings[y]="pair"==y?a(P.data("zdp_"+y)):P.data("zdp_"+y)))}O.settings.readonly_element&&P.attr("readonly","readonly");var E={days:["d","j","D"],months:["F","m","M","n","t"],years:["o","Y","y"]},F=!1,G=!1,Q=!1,T=null;for(T in E)a.each(E[T],function(a,b){O.settings.format.indexOf(b)>-1&&("days"==T?F=!0:"months"==T?G=!0:"years"==T&&(Q=!0))});H=F&&G&&Q?["years","months","days"]:!F&&G&&Q?["years","months"]:F&&G&&!Q?["months","days"]:F||G||!Q?F||!G||Q?["years","months","days"]:["months"]:["years"],-1==a.inArray(O.settings.view,H)&&(O.settings.view=H[H.length-1]),x=[],w=[];for(var U,V=0;2>V;V++)U=0===V?O.settings.disabled_dates:O.settings.enabled_dates,a.isArray(U)&&U.length>0&&a.each(U,function(){for(var b=this.split(" "),c=0;4>c;c++){b[c]||(b[c]="*"),b[c]=b[c].indexOf(",")>-1?b[c].split(","):new Array(b[c]);for(var d=0;d<b[c].length;d++)if(b[c][d].indexOf("-")>-1){var e=b[c][d].match(/^([0-9]+)\-([0-9]+)/);if(null!==e){for(var f=eb(e[1]);f<=eb(e[2]);f++)-1==a.inArray(f,b[c])&&b[c].push(f+"");b[c].splice(d,1)}}for(d=0;d<b[c].length;d++)b[c][d]=isNaN(eb(b[c][d]))?b[c][d]:eb(b[c][d])}0===V?x.push(b):w.push(b)});var W,X,Y=new Date,_=O.settings.reference_date?O.settings.reference_date:P.data("zdp_reference_date")&&void 0!==P.data("zdp_reference_date")?P.data("zdp_reference_date"):Y;if(z=void 0,A=void 0,o=_.getMonth(),l=Y.getMonth(),p=_.getFullYear(),m=Y.getFullYear(),q=_.getDate(),n=Y.getDate(),O.settings.direction===!0)z=_;else if(O.settings.direction===!1)A=_,D=A.getMonth(),C=A.getFullYear(),B=A.getDate();else if(!a.isArray(O.settings.direction)&&$(O.settings.direction)&&eb(O.settings.direction)>0||a.isArray(O.settings.direction)&&((W=R(O.settings.direction[0]))||O.settings.direction[0]===!0||$(O.settings.direction[0])&&O.settings.direction[0]>0)&&((X=R(O.settings.direction[1]))||O.settings.direction[1]===!1||$(O.settings.direction[1])&&O.settings.direction[1]>=0))z=W?W:new Date(p,o,q+(a.isArray(O.settings.direction)?eb(O.settings.direction[0]===!0?0:O.settings.direction[0]):eb(O.settings.direction))),o=z.getMonth(),p=z.getFullYear(),q=z.getDate(),X&&+X>=+z?A=X:!X&&O.settings.direction[1]!==!1&&a.isArray(O.settings.direction)&&(A=new Date(p,o,q+eb(O.settings.direction[1]))),A&&(D=A.getMonth(),C=A.getFullYear(),B=A.getDate());else if(!a.isArray(O.settings.direction)&&$(O.settings.direction)&&eb(O.settings.direction)<0||a.isArray(O.settings.direction)&&(O.settings.direction[0]===!1||$(O.settings.direction[0])&&O.settings.direction[0]<0)&&((W=R(O.settings.direction[1]))||$(O.settings.direction[1])&&O.settings.direction[1]>=0))A=new Date(p,o,q+(a.isArray(O.settings.direction)?eb(O.settings.direction[0]===!1?0:O.settings.direction[0]):eb(O.settings.direction))),D=A.getMonth(),C=A.getFullYear(),B=A.getDate(),W&&+A>+W?z=W:!W&&a.isArray(O.settings.direction)&&(z=new Date(C,D,B-eb(O.settings.direction[1]))),z&&(o=z.getMonth(),p=z.getFullYear(),q=z.getDate());else if(a.isArray(O.settings.disabled_dates)&&O.settings.disabled_dates.length>0)for(var cb in x)if("*"==x[cb][0]&&"*"==x[cb][1]&&"*"==x[cb][2]&&"*"==x[cb][3]){var gb=[];if(a.each(w,function(){var a=this;"*"!=a[2][0]&&gb.push(parseInt(a[2][0]+("*"==a[1][0]?"12":db(a[1][0],2))+("*"==a[0][0]?"*"==a[1][0]?"31":new Date(a[2][0],a[1][0],0).getDate():db(a[0][0],2)),10))}),gb.sort(),gb.length>0){var ib=(gb[0]+"").match(/([0-9]{4})([0-9]{2})([0-9]{2})/);p=parseInt(ib[1],10),o=parseInt(ib[2],10)-1,q=parseInt(ib[3],10)}break}if(Z(p,o,q)){for(;Z(p);)z?(p++,o=0):(p--,o=11);for(;Z(p,o);)z?(o++,q=1):(o--,q=new Date(p,o+1,0).getDate()),o>11?(p++,o=0,q=1):0>o&&(p--,o=11,q=new Date(p,o+1,0).getDate());for(;Z(p,o,q);)z?q++:q--,Y=new Date(p,o,q),p=Y.getFullYear(),o=Y.getMonth(),q=Y.getDate();Y=new Date(p,o,q),p=Y.getFullYear(),o=Y.getMonth(),q=Y.getDate()}var jb=R(P.val()||(O.settings.start_date?O.settings.start_date:""));if(jb&&O.settings.strict&&Z(jb.getFullYear(),jb.getMonth(),jb.getDate())&&P.val(""),b||void 0===z&&void 0===jb||fb(void 0!==z?z:jb),!O.settings.always_visible){if(!b){if(O.settings.show_icon){"firefox"==hb.name&&P.is('input[type="text"]')&&"inline"==P.css("display")&&P.css("display","inline-block");var kb=a('<span class="Zebra_DatePicker_Icon_Wrapper"></span>').css({display:P.css("display"),position:"static"==P.css("position")?"relative":P.css("position"),"float":P.css("float"),top:P.css("top"),right:P.css("right"),bottom:P.css("bottom"),left:P.css("left")});P.wrap(kb).css({position:"relative",top:"auto",right:"auto",bottom:"auto",left:"auto"}),f=a('<button type="button" class="Zebra_DatePicker_Icon'+("disabled"==P.attr("disabled")?" Zebra_DatePicker_Icon_Disabled":"")+'">Pick a date</button>'),O.icon=f,I=f.add(P)}else I=P;I.bind("click",function(a){a.preventDefault(),P.attr("disabled")||(e.hasClass("dp_visible")?O.hide():O.show())}),void 0!==f&&f.insertAfter(P)}if(void 0!==f){f.attr("style",""),O.settings.inside&&f.addClass("Zebra_DatePicker_Icon_Inside");var lb=P.outerWidth(),mb=P.outerHeight(),nb=parseInt(P.css("marginLeft"),10)||0,ob=parseInt(P.css("marginTop"),10)||0,pb=f.outerWidth(),qb=f.outerHeight(),rb=parseInt(f.css("marginLeft"),10)||0,sb=parseInt(f.css("marginRight"),10)||0;O.settings.inside?f.css({top:ob+(mb-qb)/2,left:nb+(lb-pb-sb)}):f.css({top:ob+(mb-qb)/2,left:nb+lb+rb}),f.removeClass(" Zebra_DatePicker_Icon_Disabled"),"disabled"==P.attr("disabled")&&f.addClass("Zebra_DatePicker_Icon_Disabled")}}if(L=O.settings.show_select_today!==!1&&a.inArray("days",H)>-1&&!Z(m,l,n)?O.settings.show_select_today:!1,!b){a(window).bind("resize.Zebra_DatePicker",function(){O.hide(),void 0!==f&&(clearTimeout(M),M=setTimeout(function(){O.update()},100))});var tb='<div class="Zebra_DatePicker"><table class="dp_header"><tr><td class="dp_previous">'+O.settings.header_navigation[0]+'</td><td class="dp_caption"> </td><td class="dp_next">'+O.settings.header_navigation[1]+'</td></tr></table><table class="dp_daypicker"></table><table class="dp_monthpicker"></table><table class="dp_yearpicker"></table><table class="dp_footer"><tr><td class="dp_today"'+(O.settings.show_clear_date!==!1?' style="width:50%"':"")+">"+L+'</td><td class="dp_clear"'+(L!==!1?' style="width:50%"':"")+">"+O.settings.lang_clear_date+"</td></tr></table></div>";e=a(tb),O.datepicker=e,g=a("table.dp_header",e),h=a("table.dp_daypicker",e),i=a("table.dp_monthpicker",e),j=a("table.dp_yearpicker",e),K=a("table.dp_footer",e),J=a("td.dp_today",K),k=a("td.dp_clear",K),O.settings.always_visible?P.attr("disabled")||(O.settings.always_visible.append(e),O.show()):a("body").append(e),e.delegate("td:not(.dp_disabled, .dp_weekend_disabled, .dp_not_in_month, .dp_week_number)","mouseover",function(){a(this).addClass("dp_hover")}).delegate("td:not(.dp_disabled, .dp_weekend_disabled, .dp_not_in_month, .dp_week_number)","mouseout",function(){a(this).removeClass("dp_hover")}),S(a("td",g)),a(".dp_previous",g).bind("click",function(){"months"==d?s--:"years"==d?s-=12:--r<0&&(r=11,s--),ab()}),a(".dp_caption",g).bind("click",function(){d="days"==d?a.inArray("months",H)>-1?"months":a.inArray("years",H)>-1?"years":"days":"months"==d?a.inArray("years",H)>-1?"years":a.inArray("days",H)>-1?"days":"months":a.inArray("days",H)>-1?"days":a.inArray("months",H)>-1?"months":"years",ab()}),a(".dp_next",g).bind("click",function(){"months"==d?s++:"years"==d?s+=12:12==++r&&(r=0,s++),ab()}),h.delegate("td:not(.dp_disabled, .dp_weekend_disabled, .dp_not_in_month, .dp_week_number)","click",function(){O.settings.select_other_months&&null!==(ib=a(this).attr("class").match(/date\_([0-9]{4})(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])/))?bb(ib[1],ib[2]-1,ib[3],"days",a(this)):bb(s,r,eb(a(this).html()),"days",a(this))}),i.delegate("td:not(.dp_disabled)","click",function(){var b=a(this).attr("class").match(/dp\_month\_([0-9]+)/);r=eb(b[1]),-1==a.inArray("days",H)?bb(s,r,1,"months",a(this)):(d="days",O.settings.always_visible&&P.val(""),ab())}),j.delegate("td:not(.dp_disabled)","click",function(){s=eb(a(this).html()),-1==a.inArray("months",H)?bb(s,1,1,"years",a(this)):(d="months",O.settings.always_visible&&P.val(""),ab())}),a(J).bind("click",function(b){b.preventDefault(),bb(m,l,n,"days",a(".dp_current",h)),O.settings.always_visible&&O.show(),O.hide()}),a(k).bind("click",function(b){b.preventDefault(),P.val(""),O.settings.always_visible?(t=null,u=null,v=null,a("td.dp_selected",e).removeClass("dp_selected")):(t=null,u=null,v=null,r=null,s=null),O.hide(),O.settings.onClear&&"function"==typeof O.settings.onClear&&O.settings.onClear.call(P,P)}),O.settings.always_visible||a(document).bind({"mousedown.Zebra_DatePicker":function(b){if(e.hasClass("dp_visible")){if(O.settings.show_icon&&a(b.target).get(0)===f.get(0))return!0;0===a(b.target).parents().filter(".Zebra_DatePicker").length&&O.hide()}},"keyup.Zebra_DatePicker":function(a){e.hasClass("dp_visible")&&27==a.which&&O.hide()}}),ab()}};O.destroy=function(){void 0!==O.icon&&O.icon.remove(),O.datepicker.remove(),a(document).unbind("keyup.Zebra_DatePicker"),a(document).unbind("mousedown.Zebra_DatePicker"),a(window).unbind("resize.Zebra_DatePicker"),P.removeData("Zebra_DatePicker")},O.hide=function(){O.settings.always_visible||(Y("hide"),e.removeClass("dp_visible").addClass("dp_hidden"))},O.show=function(){d=O.settings.view;var b=R(P.val()||(O.settings.start_date?O.settings.start_date:""));if(b?(u=b.getMonth(),r=b.getMonth(),v=b.getFullYear(),s=b.getFullYear(),t=b.getDate(),Z(v,u,t)&&(O.settings.strict&&P.val(""),r=o,s=p)):(r=o,s=p),ab(),O.settings.always_visible)e.removeClass("dp_hidden").addClass("dp_visible");else{var c=e.outerWidth(),g=e.outerHeight(),h=(void 0!==f?f.offset().left+f.outerWidth(!0):P.offset().left+P.outerWidth(!0))+O.settings.offset[0],i=(void 0!==f?f.offset().top:P.offset().top)-g+O.settings.offset[1],j=a(window).width(),k=a(window).height(),l=a(window).scrollTop(),m=a(window).scrollLeft();"below"==O.settings.default_position&&(i=(void 0!==f?f.offset().top:P.offset().top)+O.settings.offset[1]),h+c>m+j&&(h=m+j-c),m>h&&(h=m),i+g>l+k&&(i=l+k-g),l>i&&(i=l),e.css({left:h,top:i}),e.removeClass("dp_hidden").addClass("dp_visible"),Y()}O.settings.onOpen&&"function"==typeof O.settings.onOpen&&O.settings.onOpen.call(P,P)},O.update=function(b){O.original_direction&&(O.original_direction=O.direction),O.settings=a.extend(O.settings,b),Q(!0)};var R=function(b){if(b+="",""!==a.trim(b)){for(var c=T(O.settings.format),d=["d","D","j","l","N","S","w","F","m","M","n","Y","y"],e=[],f=[],g=null,h=null,i=0;i<d.length;i++)(g=c.indexOf(d[i]))>-1&&e.push({character:d[i],position:g});if(e.sort(function(a,b){return a.position-b.position}),a.each(e,function(a,b){switch(b.character){case"d":f.push("0[1-9]|[12][0-9]|3[01]");break;case"D":f.push("[a-z]{3}");break;case"j":f.push("[1-9]|[12][0-9]|3[01]");break;case"l":f.push("[a-z]+");break;case"N":f.push("[1-7]");break;case"S":f.push("st|nd|rd|th");break;case"w":f.push("[0-6]");break;case"F":f.push("[a-z]+");break;case"m":f.push("0[1-9]|1[012]+");break;case"M":f.push("[a-z]{3}");break;case"n":f.push("[1-9]|1[012]");break;case"Y":f.push("[0-9]{4}");break;case"y":f.push("[0-9]{2}")}}),f.length&&(e.reverse(),a.each(e,function(a,b){c=c.replace(b.character,"("+f[f.length-a-1]+")")}),f=new RegExp("^"+c+"$","ig"),h=f.exec(b))){var j,k=new Date,l=1,m=k.getMonth()+1,n=k.getFullYear(),o=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],p=["January","February","March","April","May","June","July","August","September","October","November","December"],q=!0;if(e.reverse(),a.each(e,function(b,c){if(!q)return!0;switch(c.character){case"m":case"n":m=eb(h[b+1]);break;case"d":case"j":l=eb(h[b+1]);break;case"D":case"l":case"F":case"M":j="D"==c.character||"l"==c.character?O.settings.days:O.settings.months,q=!1,a.each(j,function(a,d){if(q)return!0;if(h[b+1].toLowerCase()==d.substring(0,"D"==c.character||"M"==c.character?3:d.length).toLowerCase()){switch(c.character){case"D":h[b+1]=o[a].substring(0,3);break;case"l":h[b+1]=o[a];break;case"F":h[b+1]=p[a],m=a+1;break;case"M":h[b+1]=p[a].substring(0,3),m=a+1}q=!0}});break;case"Y":n=eb(h[b+1]);break;case"y":n="19"+eb(h[b+1])}}),q){var r=new Date(n,(m||1)-1,l||1);if(r.getFullYear()==n&&r.getDate()==(l||1)&&r.getMonth()==(m||1)-1)return r}}return!1}},S=function(a){"firefox"==hb.name?a.css("MozUserSelect","none"):"explorer"==hb.name?a.bind("selectstart",function(){return!1}):a.mousedown(function(){return!1})},T=function(a){return a.replace(/([-.,*+?^${}()|[\]\/\\])/g,"\\$1")},U=function(b){for(var c="",d=b.getDate(),e=b.getDay(),f=O.settings.days[e],g=b.getMonth()+1,h=O.settings.months[g-1],i=b.getFullYear()+"",j=0;j<O.settings.format.length;j++){var k=O.settings.format.charAt(j);switch(k){case"y":i=i.substr(2);case"Y":c+=i;break;case"m":g=db(g,2);case"n":c+=g;break;case"M":h=a.isArray(O.settings.months_abbr)&&void 0!==O.settings.months_abbr[g-1]?O.settings.months_abbr[g-1]:O.settings.months[g-1].substr(0,3);case"F":c+=h;break;case"d":d=db(d,2);case"j":c+=d;break;case"D":f=a.isArray(O.settings.days_abbr)&&void 0!==O.settings.days_abbr[e]?O.settings.days_abbr[e]:O.settings.days[e].substr(0,3);case"l":c+=f;break;case"N":e++;case"w":c+=e;break;case"S":c+=d%10==1&&"11"!=d?"st":d%10==2&&"12"!=d?"nd":d%10==3&&"13"!=d?"rd":"th";break;default:c+=k}}return c},V=function(){var b=new Date(s,r+1,0).getDate(),c=new Date(s,r,1).getDay(),d=new Date(s,r,0).getDate(),e=c-O.settings.first_day_of_week;e=0>e?7+e:e,_(O.settings.header_captions.days);var f="<tr>";O.settings.show_week_number&&(f+="<th>"+O.settings.show_week_number+"</th>");for(var g=0;7>g;g++)f+="<th>"+(a.isArray(O.settings.days_abbr)&&void 0!==O.settings.days_abbr[(O.settings.first_day_of_week+g)%7]?O.settings.days_abbr[(O.settings.first_day_of_week+g)%7]:O.settings.days[(O.settings.first_day_of_week+g)%7].substr(0,2))+"</th>";for(f+="</tr><tr>",g=0;42>g;g++){g>0&&g%7===0&&(f+="</tr><tr>"),g%7===0&&O.settings.show_week_number&&(f+='<td class="dp_week_number">'+gb(new Date(s,r,g-e+1))+"</td>");var i=g-e+1;if(O.settings.select_other_months&&(e>g||i>b)){var j=new Date(s,r,i),k=j.getFullYear(),o=j.getMonth(),p=j.getDate();j=k+db(o+1,2)+db(p,2)}if(e>g)f+='<td class="'+(O.settings.select_other_months&&!Z(k,o,p)?"dp_not_in_month_selectable date_"+j:"dp_not_in_month")+'">'+(O.settings.select_other_months||O.settings.show_other_months?db(d-e+g+1,O.settings.zero_pad?2:0):" ")+"</td>";else if(i>b)f+='<td class="'+(O.settings.select_other_months&&!Z(k,o,p)?"dp_not_in_month_selectable date_"+j:"dp_not_in_month")+'">'+(O.settings.select_other_months||O.settings.show_other_months?db(i-b,O.settings.zero_pad?2:0):" ")+"</td>";else{var q=(O.settings.first_day_of_week+g)%7,w="";Z(s,r,i)?(a.inArray(q,O.settings.weekend_days)>-1?w="dp_weekend_disabled":w+=" dp_disabled",r==l&&s==m&&n==i&&(w+=" dp_disabled_current")):(a.inArray(q,O.settings.weekend_days)>-1&&(w="dp_weekend"),r==u&&s==v&&t==i&&(w+=" dp_selected"),r==l&&s==m&&n==i&&(w+=" dp_current")),f+="<td"+(""!==w?' class="'+a.trim(w)+'"':"")+">"+(O.settings.zero_pad?db(i,2):i)+"</td>"}}f+="</tr>",h.html(a(f)),O.settings.always_visible&&(E=a("td:not(.dp_disabled, .dp_weekend_disabled, .dp_not_in_month, .dp_week_number)",h)),h.show()},W=function(){_(O.settings.header_captions.months);for(var b="<tr>",c=0;12>c;c++){c>0&&c%3===0&&(b+="</tr><tr>");var d="dp_month_"+c;Z(s,c)?d+=" dp_disabled":u!==!1&&u==c&&s==v?d+=" dp_selected":l==c&&m==s&&(d+=" dp_current"),b+='<td class="'+a.trim(d)+'">'+(a.isArray(O.settings.months_abbr)&&void 0!==O.settings.months_abbr[c]?O.settings.months_abbr[c]:O.settings.months[c].substr(0,3))+"</td>"}b+="</tr>",i.html(a(b)),O.settings.always_visible&&(F=a("td:not(.dp_disabled)",i)),i.show()},X=function(){_(O.settings.header_captions.years);for(var b="<tr>",c=0;12>c;c++){c>0&&c%3===0&&(b+="</tr><tr>");var d="";Z(s-7+c)?d+=" dp_disabled":v&&v==s-7+c?d+=" dp_selected":m==s-7+c&&(d+=" dp_current"),b+="<td"+(""!==a.trim(d)?' class="'+a.trim(d)+'"':"")+">"+(s-7+c)+"</td>"}b+="</tr>",j.html(a(b)),O.settings.always_visible&&(G=a("td:not(.dp_disabled)",j)),j.show()},Y=function(b){if("explorer"==hb.name&&6==hb.version){if(!y){var c=eb(e.css("zIndex"))-1;y=a("<iframe>",{src:'javascript:document.write("")',scrolling:"no",frameborder:0,css:{zIndex:c,position:"absolute",top:-1e3,left:-1e3,width:e.outerWidth(),height:e.outerHeight(),filter:"progid:DXImageTransform.Microsoft.Alpha(opacity=0)",display:"none"}}),a("body").append(y)}switch(b){case"hide":y.hide();break;default:var d=e.offset();y.css({top:d.top,left:d.left,display:"block"})}}},Z=function(b,c,d){if((void 0===b||isNaN(b))&&(void 0===c||isNaN(c))&&(void 0===d||isNaN(d)))return!1;if(a.isArray(O.settings.direction)||0!==eb(O.settings.direction)){var e=eb(cb(b,"undefined"!=typeof c?db(c,2):"","undefined"!=typeof d?db(d,2):"")),f=(e+"").length;if(8==f&&("undefined"!=typeof z&&e<eb(cb(p,db(o,2),db(q,2)))||"undefined"!=typeof A&&e>eb(cb(C,db(D,2),db(B,2)))))return!0;if(6==f&&("undefined"!=typeof z&&e<eb(cb(p,db(o,2)))||"undefined"!=typeof A&&e>eb(cb(C,db(D,2)))))return!0;if(4==f&&("undefined"!=typeof z&&p>e||"undefined"!=typeof A&&e>C))return!0}"undefined"!=typeof c&&(c+=1);var g=!1,h=!1;return x&&a.each(x,function(){if(!g){var e=this;if((a.inArray(b,e[2])>-1||a.inArray("*",e[2])>-1)&&("undefined"!=typeof c&&a.inArray(c,e[1])>-1||a.inArray("*",e[1])>-1)&&("undefined"!=typeof d&&a.inArray(d,e[0])>-1||a.inArray("*",e[0])>-1)){if("*"==e[3])return g=!0;var f=new Date(b,c-1,d).getDay();if(a.inArray(f,e[3])>-1)return g=!0}}}),w&&a.each(w,function(){if(!h){var e=this;if((a.inArray(b,e[2])>-1||a.inArray("*",e[2])>-1)&&(h=!0,"undefined"!=typeof c))if(h=!0,a.inArray(c,e[1])>-1||a.inArray("*",e[1])>-1){if("undefined"!=typeof d)if(h=!0,a.inArray(d,e[0])>-1||a.inArray("*",e[0])>-1){if("*"==e[3])return h=!0;var f=new Date(b,c-1,d).getDay();if(a.inArray(f,e[3])>-1)return h=!0;h=!1}else h=!1}else h=!1}}),w&&h?!1:x&&g?!0:!1},$=function(a){return(a+"").match(/^\-?[0-9]+$/)?!0:!1},_=function(b){!isNaN(parseFloat(r))&&isFinite(r)&&(b=b.replace(/\bm\b|\bn\b|\bF\b|\bM\b/,function(b){switch(b){case"m":return db(r+1,2);case"n":return r+1;case"F":return O.settings.months[r];case"M":return a.isArray(O.settings.months_abbr)&&void 0!==O.settings.months_abbr[r]?O.settings.months_abbr[r]:O.settings.months[r].substr(0,3);default:return b}})),!isNaN(parseFloat(s))&&isFinite(s)&&(b=b.replace(/\bY\b/,s).replace(/\by\b/,(s+"").substr(2)).replace(/\bY1\b/i,s-7).replace(/\bY2\b/i,s+4)),a(".dp_caption",g).html(b)},ab=function(){if(""===h.text()||"days"==d){if(""===h.text()){O.settings.always_visible||e.css("left",-1e3),e.css("visibility","visible"),V();var b=h.outerWidth(),c=h.outerHeight();i.css({width:b,height:c}),j.css({width:b,height:c}),g.css("width",b),K.css("width",b),e.css("visibility","").addClass("dp_hidden")}else V();i.hide(),j.hide()}else"months"==d?(W(),h.hide(),j.hide()):"years"==d&&(X(),h.hide(),i.hide());if(O.settings.onChange&&"function"==typeof O.settings.onChange&&void 0!==d){var f="days"==d?h.find("td:not(.dp_disabled, .dp_weekend_disabled, .dp_not_in_month)"):"months"==d?i.find("td:not(.dp_disabled, .dp_weekend_disabled, .dp_not_in_month)"):j.find("td:not(.dp_disabled, .dp_weekend_disabled, .dp_not_in_month)");f.each(function(){if("days"==d)if(a(this).hasClass("dp_not_in_month_selectable")){var b=a(this).attr("class").match(/date\_([0-9]{4})(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])/);a(this).data("date",b[1]+"-"+b[2]+"-"+b[3])}else a(this).data("date",s+"-"+db(r+1,2)+"-"+db(eb(a(this).text()),2));else if("months"==d){var b=a(this).attr("class").match(/dp\_month\_([0-9]+)/);a(this).data("date",s+"-"+db(eb(b[1])+1,2))}else a(this).data("date",eb(a(this).text()))}),O.settings.onChange.call(P,d,f,P)}K.show(),O.settings.show_clear_date===!0||0===O.settings.show_clear_date&&""!==P.val()||O.settings.always_visible&&O.settings.show_clear_date!==!1?(k.show(),L?(J.css("width","50%"),k.css("width","50%")):(J.hide(),k.css("width","100%"))):(k.hide(),L?J.show().css("width","100%"):K.hide())},bb=function(a,b,c,d,e){var f=new Date(a,b,c,12,0,0),g="days"==d?E:"months"==d?F:G,h=U(f);P.val(h),O.settings.always_visible&&(u=f.getMonth(),r=f.getMonth(),v=f.getFullYear(),s=f.getFullYear(),t=f.getDate(),g.removeClass("dp_selected"),e.addClass("dp_selected"),"days"==d&&e.hasClass("dp_not_in_month_selectable")&&O.show()),O.hide(),fb(f),O.settings.onSelect&&"function"==typeof O.settings.onSelect&&O.settings.onSelect.call(P,h,a+"-"+db(b+1,2)+"-"+db(c,2),f,P,gb(f)),P.focus()},cb=function(){for(var a="",b=0;b<arguments.length;b++)a+=arguments[b]+"";return a},db=function(a,b){for(a+="";a.length<b;)a="0"+a;return a},eb=function(a){return parseInt(a,10)},fb=function(b){O.settings.pair&&a.each(O.settings.pair,function(){var c=a(this);if(c.data&&c.data("Zebra_DatePicker")){var d=c.data("Zebra_DatePicker");d.update({reference_date:b,direction:0===d.settings.direction?1:d.settings.direction}),d.settings.always_visible&&d.show()}else c.data("zdp_reference_date",b)})},gb=function(a){var b,c,d,e,f,g,h,i,j,k=a.getFullYear(),l=a.getMonth()+1,m=a.getDate();return 3>l?(b=k-1,c=(b/4|0)-(b/100|0)+(b/400|0),d=((b-1)/4|0)-((b-1)/100|0)+((b-1)/400|0),e=c-d,f=0,g=m-1+31*(l-1)):(b=k,c=(b/4|0)-(b/100|0)+(b/400|0),d=((b-1)/4|0)-((b-1)/100|0)+((b-1)/400|0),e=c-d,f=e+1,g=m+((153*(l-3)+2)/5|0)+58+e),h=(b+c)%7,m=(g+h-f)%7,i=g+3-m,j=0>i?53-((h-e)/5|0):i>364+e?1:(i/7|0)+1},hb={init:function(){this.name=this.searchString(this.dataBrowser)||"",this.version=this.searchVersion(navigator.userAgent)||this.searchVersion(navigator.appVersion)||""},searchString:function(a){for(var b=0;b<a.length;b++){var c=a[b].string,d=a[b].prop;if(this.versionSearchString=a[b].versionSearch||a[b].identity,c){if(-1!=c.indexOf(a[b].subString))return a[b].identity}else if(d)return a[b].identity}},searchVersion:function(a){var b=a.indexOf(this.versionSearchString);if(-1!=b)return parseFloat(a.substring(b+this.versionSearchString.length+1))},dataBrowser:[{string:navigator.userAgent,subString:"Firefox",identity:"firefox"},{string:navigator.userAgent,subString:"MSIE",identity:"explorer",versionSearch:"MSIE"}]};hb.init(),Q()},a.fn.Zebra_DatePicker=function(b){return this.each(function(){void 0!==a(this).data("Zebra_DatePicker")&&a(this).data("Zebra_DatePicker").destroy();var c=new a.Zebra_DatePicker(this,b);a(this).data("Zebra_DatePicker",c)})}}(jQuery);
|
@@ -8,13 +8,15 @@
|
|
8
8
|
* For more resources visit {@link http://stefangabos.ro/}
|
9
9
|
*
|
10
10
|
* @author Stefan Gabos <contact@stefangabos.ro>
|
11
|
-
* @version 1.8.
|
12
|
-
* @copyright (c) 2011 -
|
11
|
+
* @version 1.8.9 (last revision: August 16, 2014)
|
12
|
+
* @copyright (c) 2011 - 2014 Stefan Gabos
|
13
13
|
* @license http://www.gnu.org/licenses/lgpl-3.0.txt GNU LESSER GENERAL PUBLIC LICENSE
|
14
14
|
* @package Zebra_DatePicker
|
15
15
|
*/
|
16
16
|
;(function($) {
|
17
17
|
|
18
|
+
'use strict';
|
19
|
+
|
18
20
|
$.Zebra_DatePicker = function(element, options) {
|
19
21
|
|
20
22
|
var defaults = {
|
@@ -34,6 +36,14 @@
|
|
34
36
|
// default is FALSE
|
35
37
|
days_abbr: false,
|
36
38
|
|
39
|
+
// the position of the date picker relative to the element it is attached to. note that, regardless of this
|
40
|
+
// setting, the date picker's position will be automatically adjusted to fit in the viewport, if needed.
|
41
|
+
//
|
42
|
+
// possible values are "above" and "below"
|
43
|
+
//
|
44
|
+
// default is "above"
|
45
|
+
default_position: 'above',
|
46
|
+
|
37
47
|
// direction of the calendar
|
38
48
|
//
|
39
49
|
// a positive or negative integer: n (a positive integer) creates a future-only calendar beginning at n days
|
@@ -97,7 +107,7 @@
|
|
97
107
|
// format of the returned date
|
98
108
|
//
|
99
109
|
// accepts the following characters for date formatting: d, D, j, l, N, w, S, F, m, M, n, Y, y borrowing
|
100
|
-
// syntax from
|
110
|
+
// syntax from PHP's "date" function.
|
101
111
|
//
|
102
112
|
// note that when setting a date format without days ('d', 'j'), the users will be able to select only years
|
103
113
|
// and months, and when setting a format without months and days ('F', 'm', 'M', 'n', 'd', 'j'), the
|
@@ -110,6 +120,41 @@
|
|
110
120
|
// default is Y-m-d
|
111
121
|
format: 'Y-m-d',
|
112
122
|
|
123
|
+
// captions in the datepicker's header, for the 3 possible views: days, months, years
|
124
|
+
//
|
125
|
+
// for each of the 3 views the following special characters may be used borrowing from PHP's "date" function's
|
126
|
+
// syntax: m, n, F, M, y and Y; any of these will be replaced at runtime with the appropriate date fragment,
|
127
|
+
// depending on the currently viewed date. two more special characters are also available Y1 and Y2 (upper
|
128
|
+
// case representing years with 4 digits, lowercase representing years with 2 digits) which represent
|
129
|
+
// "currently selected year - 7" and "currently selected year + 4" and which only make sense used in the
|
130
|
+
// "years" view.
|
131
|
+
//
|
132
|
+
// even though any of these special characters may be used in any of the 3 views, you should use m, n, F, M
|
133
|
+
// for the "days" view and y, Y, Y1, Y2, y1, y2 for the "months" and "years" view or you may get unexpected
|
134
|
+
// results!
|
135
|
+
//
|
136
|
+
// Text and HTML can also be used, and will be rendered as it is, as in the example below (the library is
|
137
|
+
// smart enough to not replace special characters when used in words or HTML tags):
|
138
|
+
//
|
139
|
+
// header_captions: {
|
140
|
+
// 'days': 'Departure:<br>F, Y',
|
141
|
+
// 'months': 'Departure:<br>Y',
|
142
|
+
// 'years': 'Departure:<br>Y1 - Y2'
|
143
|
+
// }
|
144
|
+
//
|
145
|
+
// Default is
|
146
|
+
//
|
147
|
+
// header_captions: {
|
148
|
+
// 'days': 'F, Y',
|
149
|
+
// 'months': 'Y',
|
150
|
+
// 'years': 'Y1 - Y2'
|
151
|
+
// }
|
152
|
+
header_captions: {
|
153
|
+
'days': 'F, Y',
|
154
|
+
'months': 'Y',
|
155
|
+
'years': 'Y1 - Y2'
|
156
|
+
},
|
157
|
+
|
113
158
|
// HTML to be used for the previous month/next month buttons
|
114
159
|
//
|
115
160
|
// default is ['«','»']
|
@@ -246,26 +291,44 @@
|
|
246
291
|
// view (can be "days", "months" or "years"), the second argument represents an array containing the "active"
|
247
292
|
// elements (not disabled) from the view, as jQuery elements, allowing for easy customization and interaction
|
248
293
|
// with particular cells in the date picker's view, while the third argument is a reference to the element
|
249
|
-
// the date picker is attached to, as a jQuery object
|
294
|
+
// the date picker is attached to, as a jQuery object (deprecated - use the "this" keyword inside the callback
|
295
|
+
// function to refer to the element the date picker is attached to)
|
250
296
|
//
|
251
297
|
// for simplifying searching for particular dates, each element in the second argument will also have a
|
252
298
|
// "date" data attribute whose format depends on the value of the "view" argument:
|
253
299
|
// - YYYY-MM-DD for elements in the "days" view
|
254
300
|
// - YYYY-MM for elements in the "months" view
|
255
301
|
// - YYYY for elements in the "years" view
|
302
|
+
//
|
303
|
+
// the "this" keyword inside the callback function refers to the element the date picker is attached to!
|
256
304
|
onChange: null,
|
257
305
|
|
258
306
|
// callback function to be executed when the user clicks the "Clear" button
|
259
307
|
// the callback function takes a single argument:
|
260
|
-
// - a reference to the element the date picker is attached to, as a jQuery object
|
308
|
+
// - a reference to the element the date picker is attached to, as a jQuery object (deprecated - use the
|
309
|
+
// "this" keyword inside the callback function to refer to the element the date picker is attached to)
|
310
|
+
//
|
311
|
+
// the "this" keyword inside the callback function refers to the element the date picker is attached to!
|
261
312
|
onClear: null,
|
262
313
|
|
314
|
+
// callback function to be executed when the date picker is shown
|
315
|
+
// the callback function takes a single argument:
|
316
|
+
// - a reference to the element the date picker is attached to, as a jQuery object (deprecated - use the
|
317
|
+
// "this" keyword inside the callback function to refer to the element the date picker is attached to)
|
318
|
+
//
|
319
|
+
// the "this" keyword inside the callback function refers to the element the date picker is attached to!
|
320
|
+
onOpen: null,
|
321
|
+
|
263
322
|
// callback function to be executed when a date is selected
|
264
|
-
// the callback function takes
|
323
|
+
// the callback function takes 5 arguments:
|
265
324
|
// - the date in the format specified by the "format" attribute;
|
266
325
|
// - the date in YYYY-MM-DD format
|
267
326
|
// - the date as a JavaScript Date object
|
268
|
-
// - a reference to the element the date picker is attached to, as a jQuery object
|
327
|
+
// - a reference to the element the date picker is attached to, as a jQuery object (deprecated - use the
|
328
|
+
// "this" keyword inside the callback function to refer to the element the date picker is attached to)
|
329
|
+
// - the ISO 8601 week number of the selected date
|
330
|
+
//
|
331
|
+
// the "this" keyword inside the callback function refers to the element the date picker is attached to!
|
269
332
|
onSelect: null
|
270
333
|
|
271
334
|
};
|
@@ -311,7 +374,8 @@
|
|
311
374
|
if (undefined !== defaults[data])
|
312
375
|
|
313
376
|
// update the property's value
|
314
|
-
|
377
|
+
// (note that for the "pair" property we need to convert the property to an element)
|
378
|
+
plugin.settings[data] = (data == 'pair' ? $($element.data('zdp_' + data)) : $element.data('zdp_' + data));
|
315
379
|
|
316
380
|
}
|
317
381
|
|
@@ -361,6 +425,9 @@
|
|
361
425
|
// if user can cycle only through year and months, set the flag accordingly
|
362
426
|
else if (!has_days && has_months && has_years) views = ['years', 'months'];
|
363
427
|
|
428
|
+
// if user can cycle only through months and days, set the flag accordingly
|
429
|
+
else if (has_days && has_months && !has_years) views = ['months', 'days'];
|
430
|
+
|
364
431
|
// if user can only see the year picker, set the flag accordingly
|
365
432
|
else if (!has_days && !has_months && has_years) views = ['years'];
|
366
433
|
|
@@ -803,7 +870,8 @@
|
|
803
870
|
$element.val('');
|
804
871
|
|
805
872
|
// updates value for the date picker whose starting date depends on the selected date (if any)
|
806
|
-
if (!update
|
873
|
+
if (!update && (undefined !== start_date || undefined !== default_date))
|
874
|
+
update_dependent(undefined !== start_date ? start_date : default_date);
|
807
875
|
|
808
876
|
// if date picker is not always visible
|
809
877
|
if (!plugin.settings.always_visible) {
|
@@ -822,7 +890,7 @@
|
|
822
890
|
|
823
891
|
// we create a wrapper for the parent element so that we can later position the icon
|
824
892
|
// also, make sure the wrapper inherits some important css properties of the parent element
|
825
|
-
var icon_wrapper =
|
893
|
+
var icon_wrapper = $('<span class="Zebra_DatePicker_Icon_Wrapper"></span>').css({
|
826
894
|
'display': $element.css('display'),
|
827
895
|
'position': $element.css('position') == 'static' ? 'relative' : $element.css('position'),
|
828
896
|
'float': $element.css('float'),
|
@@ -843,7 +911,7 @@
|
|
843
911
|
});
|
844
912
|
|
845
913
|
// create the actual calendar icon (show a disabled icon if the element is disabled)
|
846
|
-
icon =
|
914
|
+
icon = $('<button type="button" class="Zebra_DatePicker_Icon' + ($element.attr('disabled') == 'disabled' ? ' Zebra_DatePicker_Icon_Disabled' : '') + '">Pick a date</button>');
|
847
915
|
|
848
916
|
// a reference to the icon, as a global property
|
849
917
|
plugin.icon = icon;
|
@@ -863,7 +931,7 @@
|
|
863
931
|
if (!$element.attr('disabled'))
|
864
932
|
|
865
933
|
// if the date picker is visible, hide it
|
866
|
-
if (datepicker.
|
934
|
+
if (datepicker.hasClass('dp_visible')) plugin.hide();
|
867
935
|
|
868
936
|
// if the date picker is not visible, show it
|
869
937
|
else plugin.show();
|
@@ -918,6 +986,12 @@
|
|
918
986
|
'left': element_margin_left + element_width + icon_margin_left
|
919
987
|
});
|
920
988
|
|
989
|
+
// assume the datepicker is not disabled
|
990
|
+
icon.removeClass(' Zebra_DatePicker_Icon_Disabled');
|
991
|
+
|
992
|
+
// if element the datepicker is attached to became disabled, disable the calendar icon, too
|
993
|
+
if ($element.attr('disabled') == 'disabled') icon.addClass('Zebra_DatePicker_Icon_Disabled');
|
994
|
+
|
921
995
|
}
|
922
996
|
|
923
997
|
}
|
@@ -1009,10 +1083,10 @@
|
|
1009
1083
|
// add the mouseover/mousevents to all to the date picker's cells
|
1010
1084
|
// except those that are not selectable
|
1011
1085
|
datepicker.
|
1012
|
-
delegate('td:not(.dp_disabled, .dp_weekend_disabled, .dp_not_in_month, .
|
1086
|
+
delegate('td:not(.dp_disabled, .dp_weekend_disabled, .dp_not_in_month, .dp_week_number)', 'mouseover', function() {
|
1013
1087
|
$(this).addClass('dp_hover');
|
1014
1088
|
}).
|
1015
|
-
delegate('td:not(.dp_disabled, .dp_weekend_disabled, .dp_not_in_month, .
|
1089
|
+
delegate('td:not(.dp_disabled, .dp_weekend_disabled, .dp_not_in_month, .dp_week_number)', 'mouseout', function() {
|
1016
1090
|
$(this).removeClass('dp_hover');
|
1017
1091
|
});
|
1018
1092
|
|
@@ -1023,33 +1097,28 @@
|
|
1023
1097
|
// event for when clicking the "previous" button
|
1024
1098
|
$('.dp_previous', header).bind('click', function() {
|
1025
1099
|
|
1026
|
-
// if
|
1027
|
-
|
1028
|
-
|
1029
|
-
// if view is "months"
|
1030
|
-
// decrement year by one
|
1031
|
-
if (view == 'months') selected_year--;
|
1032
|
-
|
1033
|
-
// if view is "years"
|
1034
|
-
// decrement years by 12
|
1035
|
-
else if (view == 'years') selected_year -= 12;
|
1036
|
-
|
1037
|
-
// if view is "days"
|
1038
|
-
// decrement the month and
|
1039
|
-
// if month is out of range
|
1040
|
-
else if (--selected_month < 0) {
|
1100
|
+
// if view is "months"
|
1101
|
+
// decrement year by one
|
1102
|
+
if (view == 'months') selected_year--;
|
1041
1103
|
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1104
|
+
// if view is "years"
|
1105
|
+
// decrement years by 12
|
1106
|
+
else if (view == 'years') selected_year -= 12;
|
1045
1107
|
|
1046
|
-
|
1108
|
+
// if view is "days"
|
1109
|
+
// decrement the month and
|
1110
|
+
// if month is out of range
|
1111
|
+
else if (--selected_month < 0) {
|
1047
1112
|
|
1048
|
-
//
|
1049
|
-
|
1113
|
+
// go to the last month of the previous year
|
1114
|
+
selected_month = 11;
|
1115
|
+
selected_year--;
|
1050
1116
|
|
1051
1117
|
}
|
1052
1118
|
|
1119
|
+
// generate the appropriate view
|
1120
|
+
manage_views();
|
1121
|
+
|
1053
1122
|
});
|
1054
1123
|
|
1055
1124
|
// attach a click event to the caption in header
|
@@ -1072,33 +1141,28 @@
|
|
1072
1141
|
// event for when clicking the "next" button
|
1073
1142
|
$('.dp_next', header).bind('click', function() {
|
1074
1143
|
|
1075
|
-
// if
|
1076
|
-
|
1077
|
-
|
1078
|
-
// if view is "months"
|
1079
|
-
// increment year by 1
|
1080
|
-
if (view == 'months') selected_year++;
|
1081
|
-
|
1082
|
-
// if view is "years"
|
1083
|
-
// increment years by 12
|
1084
|
-
else if (view == 'years') selected_year += 12;
|
1085
|
-
|
1086
|
-
// if view is "days"
|
1087
|
-
// increment the month and
|
1088
|
-
// if month is out of range
|
1089
|
-
else if (++selected_month == 12) {
|
1144
|
+
// if view is "months"
|
1145
|
+
// increment year by 1
|
1146
|
+
if (view == 'months') selected_year++;
|
1090
1147
|
|
1091
|
-
|
1092
|
-
|
1093
|
-
|
1148
|
+
// if view is "years"
|
1149
|
+
// increment years by 12
|
1150
|
+
else if (view == 'years') selected_year += 12;
|
1094
1151
|
|
1095
|
-
|
1152
|
+
// if view is "days"
|
1153
|
+
// increment the month and
|
1154
|
+
// if month is out of range
|
1155
|
+
else if (++selected_month == 12) {
|
1096
1156
|
|
1097
|
-
//
|
1098
|
-
|
1157
|
+
// go to the first month of the next year
|
1158
|
+
selected_month = 0;
|
1159
|
+
selected_year++;
|
1099
1160
|
|
1100
1161
|
}
|
1101
1162
|
|
1163
|
+
// generate the appropriate view
|
1164
|
+
manage_views();
|
1165
|
+
|
1102
1166
|
});
|
1103
1167
|
|
1104
1168
|
// attach a click event for the cells in the day picker
|
@@ -1225,7 +1289,7 @@
|
|
1225
1289
|
if (plugin.settings.onClear && typeof plugin.settings.onClear == 'function')
|
1226
1290
|
|
1227
1291
|
// execute the callback function and pass as argument the element the plugin is attached to
|
1228
|
-
plugin.settings.onClear($element);
|
1292
|
+
plugin.settings.onClear.call($element, $element);
|
1229
1293
|
|
1230
1294
|
});
|
1231
1295
|
|
@@ -1239,7 +1303,7 @@
|
|
1239
1303
|
'mousedown.Zebra_DatePicker': function(e) {
|
1240
1304
|
|
1241
1305
|
// if the date picker is visible
|
1242
|
-
if (datepicker.
|
1306
|
+
if (datepicker.hasClass('dp_visible')) {
|
1243
1307
|
|
1244
1308
|
// if the calendar icon is visible and we clicked it, let the onClick event of the icon to handle the event
|
1245
1309
|
// (we want it to toggle the date picker)
|
@@ -1259,7 +1323,7 @@
|
|
1259
1323
|
// if the date picker is visible
|
1260
1324
|
// and the pressed key is ESC
|
1261
1325
|
// hide the date picker
|
1262
|
-
if (datepicker.
|
1326
|
+
if (datepicker.hasClass('dp_visible') && e.which == 27) plugin.hide();
|
1263
1327
|
|
1264
1328
|
}
|
1265
1329
|
|
@@ -1291,9 +1355,6 @@
|
|
1291
1355
|
// remove association with the element
|
1292
1356
|
$element.removeData('Zebra_DatePicker');
|
1293
1357
|
|
1294
|
-
// completely delete object
|
1295
|
-
delete plugin;
|
1296
|
-
|
1297
1358
|
};
|
1298
1359
|
|
1299
1360
|
/**
|
@@ -1310,7 +1371,7 @@
|
|
1310
1371
|
iframeShim('hide');
|
1311
1372
|
|
1312
1373
|
// hide the date picker
|
1313
|
-
datepicker.
|
1374
|
+
datepicker.removeClass('dp_visible').addClass('dp_hidden');
|
1314
1375
|
|
1315
1376
|
}
|
1316
1377
|
|
@@ -1390,9 +1451,13 @@
|
|
1390
1451
|
window_scroll_top = $(window).scrollTop(),
|
1391
1452
|
window_scroll_left = $(window).scrollLeft();
|
1392
1453
|
|
1454
|
+
if (plugin.settings.default_position == 'below')
|
1455
|
+
top = (undefined !== icon ? icon.offset().top : $element.offset().top) + plugin.settings.offset[1];
|
1456
|
+
|
1393
1457
|
// if date picker is outside the viewport, adjust its position so that it is visible
|
1394
1458
|
if (left + datepicker_width > window_scroll_left + window_width) left = window_scroll_left + window_width - datepicker_width;
|
1395
1459
|
if (left < window_scroll_left) left = window_scroll_left;
|
1460
|
+
|
1396
1461
|
if (top + datepicker_height > window_scroll_top + window_height) top = window_scroll_top + window_height - datepicker_height;
|
1397
1462
|
if (top < window_scroll_top) top = window_scroll_top;
|
1398
1463
|
|
@@ -1404,13 +1469,19 @@
|
|
1404
1469
|
|
1405
1470
|
// fade-in the date picker
|
1406
1471
|
// for Internet Explorer < 9 show the date picker instantly or fading alters the font's weight
|
1407
|
-
datepicker.
|
1472
|
+
datepicker.removeClass('dp_hidden').addClass('dp_visible');
|
1408
1473
|
|
1409
1474
|
// show the iFrameShim in Internet Explorer 6
|
1410
1475
|
iframeShim();
|
1411
1476
|
|
1412
1477
|
// if date picker is always visible, show it
|
1413
|
-
} else datepicker.
|
1478
|
+
} else datepicker.removeClass('dp_hidden').addClass('dp_visible');
|
1479
|
+
|
1480
|
+
// if a callback function exists for when showing the date picker
|
1481
|
+
if (plugin.settings.onOpen && typeof plugin.settings.onOpen == 'function')
|
1482
|
+
|
1483
|
+
// execute the callback function and pass as argument the element the plugin is attached to
|
1484
|
+
plugin.settings.onOpen.call($element, $element);
|
1414
1485
|
|
1415
1486
|
};
|
1416
1487
|
|
@@ -1533,7 +1604,7 @@
|
|
1533
1604
|
// check if date is a valid date (i.e. there's no February 31)
|
1534
1605
|
|
1535
1606
|
var tmpdate = new Date(),
|
1536
|
-
original_day =
|
1607
|
+
original_day = 1,
|
1537
1608
|
original_month = tmpdate.getMonth() + 1,
|
1538
1609
|
original_year = tmpdate.getFullYear(),
|
1539
1610
|
english_days = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],
|
@@ -1828,7 +1899,7 @@
|
|
1828
1899
|
days_from_previous_month = days_from_previous_month < 0 ? 7 + days_from_previous_month : days_from_previous_month;
|
1829
1900
|
|
1830
1901
|
// manage header caption and enable/disable navigation buttons if necessary
|
1831
|
-
manage_header(plugin.settings.
|
1902
|
+
manage_header(plugin.settings.header_captions['days']);
|
1832
1903
|
|
1833
1904
|
// start generating the HTML
|
1834
1905
|
var html = '<tr>';
|
@@ -1942,7 +2013,7 @@
|
|
1942
2013
|
|
1943
2014
|
// cache all the cells
|
1944
2015
|
// (we need them so that we can easily remove the "dp_selected" class from all of them when user selects a date)
|
1945
|
-
daypicker_cells = $('td:not(.dp_disabled, .dp_weekend_disabled, .dp_not_in_month, .
|
2016
|
+
daypicker_cells = $('td:not(.dp_disabled, .dp_weekend_disabled, .dp_not_in_month, .dp_week_number)', daypicker);
|
1946
2017
|
|
1947
2018
|
// make the day picker visible
|
1948
2019
|
daypicker.show();
|
@@ -1959,7 +2030,7 @@
|
|
1959
2030
|
var generate_monthpicker = function() {
|
1960
2031
|
|
1961
2032
|
// manage header caption and enable/disable navigation buttons if necessary
|
1962
|
-
manage_header(
|
2033
|
+
manage_header(plugin.settings.header_captions['months']);
|
1963
2034
|
|
1964
2035
|
// start generating the HTML
|
1965
2036
|
var html = '<tr>';
|
@@ -1976,7 +2047,7 @@
|
|
1976
2047
|
if (is_disabled(selected_year, i)) class_name += ' dp_disabled';
|
1977
2048
|
|
1978
2049
|
// else, if a date is already selected and this is that particular month, highlight it
|
1979
|
-
else if (default_month !== false && default_month == i) class_name += ' dp_selected';
|
2050
|
+
else if (default_month !== false && default_month == i && selected_year == default_year) class_name += ' dp_selected';
|
1980
2051
|
|
1981
2052
|
// else, if this the current system month, highlight it
|
1982
2053
|
else if (current_system_month == i && current_system_year == selected_year) class_name += ' dp_current';
|
@@ -2014,7 +2085,7 @@
|
|
2014
2085
|
var generate_yearpicker = function() {
|
2015
2086
|
|
2016
2087
|
// manage header caption and enable/disable navigation buttons if necessary
|
2017
|
-
manage_header(
|
2088
|
+
manage_header(plugin.settings.header_captions['years']);
|
2018
2089
|
|
2019
2090
|
// start generating the HTML
|
2020
2091
|
var html = '<tr>';
|
@@ -2079,11 +2150,10 @@
|
|
2079
2150
|
var zIndex = to_int(datepicker.css('zIndex')) - 1;
|
2080
2151
|
|
2081
2152
|
// create the iFrame
|
2082
|
-
shim =
|
2153
|
+
shim = $('<iframe>', {
|
2083
2154
|
'src': 'javascript:document.write("")',
|
2084
2155
|
'scrolling': 'no',
|
2085
2156
|
'frameborder': 0,
|
2086
|
-
'allowtransparency': 'true',
|
2087
2157
|
css: {
|
2088
2158
|
'zIndex': zIndex,
|
2089
2159
|
'position': 'absolute',
|
@@ -2339,67 +2409,61 @@
|
|
2339
2409
|
*/
|
2340
2410
|
var manage_header = function(caption) {
|
2341
2411
|
|
2342
|
-
//
|
2343
|
-
|
2344
|
-
|
2345
|
-
// if calendar has direction restrictions or we're looking only at months
|
2346
|
-
if (!(!$.isArray(plugin.settings.direction) && to_int(plugin.settings.direction) === 0) || (views.length == 1 && views[0] == 'months')) {
|
2412
|
+
// if "selected_month" has a value
|
2413
|
+
// $.isNumeric is available only from jQuery 1.7 - thanks to birla for the fix!
|
2414
|
+
if (!isNaN(parseFloat(selected_month)) && isFinite(selected_month))
|
2347
2415
|
|
2348
|
-
|
2349
|
-
var year = selected_year,
|
2350
|
-
month = selected_month,
|
2351
|
-
next, previous;
|
2416
|
+
caption = caption.replace(/\bm\b|\bn\b|\bF\b|\bM\b/, function (match) {
|
2352
2417
|
|
2353
|
-
|
2354
|
-
if (view == 'days') {
|
2418
|
+
switch (match) {
|
2355
2419
|
|
2356
|
-
|
2357
|
-
|
2420
|
+
// month number, prefixed with 0
|
2421
|
+
case 'm':
|
2422
|
+
return str_pad(selected_month + 1, 2);
|
2358
2423
|
|
2359
|
-
|
2360
|
-
|
2424
|
+
// month number, not prefixed with 0
|
2425
|
+
case 'n':
|
2426
|
+
return selected_month + 1;
|
2361
2427
|
|
2362
|
-
|
2363
|
-
|
2428
|
+
// full month name
|
2429
|
+
case 'F':
|
2430
|
+
return plugin.settings.months[selected_month];
|
2364
2431
|
|
2365
|
-
|
2366
|
-
|
2432
|
+
// month name, three letters
|
2433
|
+
case 'M':
|
2434
|
+
return ($.isArray(plugin.settings.months_abbr) && undefined !== plugin.settings.months_abbr[selected_month] ? plugin.settings.months_abbr[selected_month] : plugin.settings.months[selected_month].substr(0, 3));
|
2367
2435
|
|
2368
|
-
|
2369
|
-
|
2436
|
+
// unknown replace
|
2437
|
+
default:
|
2438
|
+
return match;
|
2370
2439
|
|
2371
|
-
|
2372
|
-
} else if (view == 'years') {
|
2440
|
+
}
|
2373
2441
|
|
2374
|
-
|
2375
|
-
if (!start_date || start_date.getFullYear() < year - 7) previous = true;
|
2442
|
+
});
|
2376
2443
|
|
2377
|
-
|
2378
|
-
|
2444
|
+
// if "selected_year" has a value
|
2445
|
+
// $.isNumeric is available only from jQuery 1.7 - thanks to birla for the fix!
|
2446
|
+
if (!isNaN(parseFloat(selected_year)) && isFinite(selected_year))
|
2379
2447
|
|
2380
|
-
|
2448
|
+
// replace year-related patterns
|
2449
|
+
caption =
|
2381
2450
|
|
2382
|
-
|
2383
|
-
if (!previous) {
|
2451
|
+
caption.
|
2384
2452
|
|
2385
|
-
//
|
2386
|
-
|
2387
|
-
$('.dp_previous', header).removeClass('dp_hover');
|
2388
|
-
|
2389
|
-
// otherwise enable the "previous" button
|
2390
|
-
} else $('.dp_previous', header).removeClass('dp_blocked');
|
2453
|
+
// year as four digits
|
2454
|
+
replace(/\bY\b/, selected_year).
|
2391
2455
|
|
2392
|
-
|
2393
|
-
|
2456
|
+
// year as two digits
|
2457
|
+
replace(/\by\b/, (selected_year + '').substr(2)).
|
2394
2458
|
|
2395
|
-
//
|
2396
|
-
|
2397
|
-
$('.dp_next', header).removeClass('dp_hover');
|
2459
|
+
// lower limit of year as two or four digits
|
2460
|
+
replace(/\bY1\b/i, selected_year - 7).
|
2398
2461
|
|
2399
|
-
|
2400
|
-
|
2462
|
+
// upper limit of year as two or four digits
|
2463
|
+
replace(/\bY2\b/i, selected_year + 4);
|
2401
2464
|
|
2402
|
-
|
2465
|
+
// update the caption in the header
|
2466
|
+
$('.dp_caption', header).html(caption);
|
2403
2467
|
|
2404
2468
|
};
|
2405
2469
|
|
@@ -2427,7 +2491,7 @@
|
|
2427
2491
|
|
2428
2492
|
// temporarily make the date picker visible
|
2429
2493
|
// so that we can later grab its width and height
|
2430
|
-
datepicker.
|
2494
|
+
datepicker.css('visibility', 'visible');
|
2431
2495
|
|
2432
2496
|
// generate the day picker
|
2433
2497
|
generate_daypicker();
|
@@ -2453,7 +2517,7 @@
|
|
2453
2517
|
footer.css('width', width);
|
2454
2518
|
|
2455
2519
|
// hide the date picker again
|
2456
|
-
datepicker.
|
2520
|
+
datepicker.css('visibility', '').addClass('dp_hidden');
|
2457
2521
|
|
2458
2522
|
// if the day picker was previously generated at least once
|
2459
2523
|
// generate the day picker
|
@@ -2490,10 +2554,10 @@
|
|
2490
2554
|
|
2491
2555
|
// get the "active" elements in the view (ignoring the disabled ones)
|
2492
2556
|
var elements = (view == 'days' ?
|
2493
|
-
daypicker.find('td:not(.dp_disabled, .dp_weekend_disabled, .dp_not_in_month
|
2557
|
+
daypicker.find('td:not(.dp_disabled, .dp_weekend_disabled, .dp_not_in_month)') :
|
2494
2558
|
(view == 'months' ?
|
2495
|
-
monthpicker.find('td:not(.dp_disabled, .dp_weekend_disabled, .dp_not_in_month
|
2496
|
-
yearpicker.find('td:not(.dp_disabled, .dp_weekend_disabled, .dp_not_in_month
|
2559
|
+
monthpicker.find('td:not(.dp_disabled, .dp_weekend_disabled, .dp_not_in_month)') :
|
2560
|
+
yearpicker.find('td:not(.dp_disabled, .dp_weekend_disabled, .dp_not_in_month)')));
|
2497
2561
|
|
2498
2562
|
// iterate through the active elements
|
2499
2563
|
// and attach a "date" data attribute to each element in the form of
|
@@ -2540,7 +2604,7 @@
|
|
2540
2604
|
|
2541
2605
|
// execute the callback function and send as arguments the current view, the elements in the view, and
|
2542
2606
|
// the element the plugin is attached to
|
2543
|
-
plugin.settings.onChange(view, elements, $element);
|
2607
|
+
plugin.settings.onChange.call($element, view, elements, $element);
|
2544
2608
|
|
2545
2609
|
}
|
2546
2610
|
|
@@ -2662,8 +2726,9 @@
|
|
2662
2726
|
if (plugin.settings.onSelect && typeof plugin.settings.onSelect == 'function')
|
2663
2727
|
|
2664
2728
|
// execute the callback function
|
2665
|
-
|
2666
|
-
|
2729
|
+
// make "this" inside the callback function refer to the element the date picker is attached to
|
2730
|
+
plugin.settings.onSelect.call($element, selected_value, year + '-' + str_pad(month + 1, 2) + '-' + str_pad(day, 2), default_date, $element, getWeekNumber(default_date));
|
2731
|
+
|
2667
2732
|
// move focus to the element the plugin is attached to
|
2668
2733
|
$element.focus();
|
2669
2734
|
|
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
Twitter Bootstrap theme
|
6
6
|
|
7
|
-
copyright (c) 2011 -
|
7
|
+
copyright (c) 2011 - 2014 Stefan Gabos
|
8
8
|
http://stefangabos.ro/jquery/zebra-datepicker/
|
9
9
|
|
10
10
|
*/
|
@@ -13,13 +13,13 @@
|
|
13
13
|
.Zebra_DatePicker *:after,
|
14
14
|
.Zebra_DatePicker *:before { -moz-box-sizing: content-box !important; -webkit-box-sizing: content-box !important; box-sizing: content-box !important }
|
15
15
|
|
16
|
-
.Zebra_DatePicker { position: absolute; background: #FFF; border: 1px solid #999;
|
16
|
+
.Zebra_DatePicker { position: absolute; background: #FFF; border: 1px solid #999; z-index: 100; padding: 5px }
|
17
17
|
|
18
18
|
.Zebra_DatePicker * { margin: 0; padding: 0; color: #373737; background: transparent; border: none }
|
19
19
|
|
20
20
|
/* = GLOBALS
|
21
21
|
----------------------------------------------------------------------------------------------------------------------*/
|
22
|
-
.Zebra_DatePicker table { border-collapse: collapse; border-spacing: 0 }
|
22
|
+
.Zebra_DatePicker table { border-collapse: collapse; border-spacing: 0; width: auto; table-layout: auto; }
|
23
23
|
|
24
24
|
.Zebra_DatePicker td,
|
25
25
|
.Zebra_DatePicker th { text-align: center; padding: 5px 0 }
|
@@ -41,6 +41,11 @@
|
|
41
41
|
.Zebra_DatePicker .dp_footer .dp_hover,
|
42
42
|
.Zebra_DatePicker td.dp_hover { -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px }
|
43
43
|
|
44
|
+
/* = VISIBLE/HIDDEN STATES (USE TRANSITIONS FOR EFFECTS)
|
45
|
+
----------------------------------------------------------------------------------------------------------------------*/
|
46
|
+
.Zebra_DatePicker.dp_visible { visibility: visible; filter: alpha(opacity=100); -khtml-opacity: 1; -moz-opacity: 1; opacity: 1; transition: opacity 0.2s ease-in-out }
|
47
|
+
.Zebra_DatePicker.dp_hidden { visibility: hidden; filter: alpha(opacity=0); -khtml-opacity: 0; -moz-opacity: 0; opacity: 0 }
|
48
|
+
|
44
49
|
/* = HEADER
|
45
50
|
----------------------------------------------------------------------------------------------------------------------*/
|
46
51
|
.Zebra_DatePicker .dp_header td { }
|
@@ -50,7 +55,6 @@
|
|
50
55
|
|
51
56
|
.Zebra_DatePicker .dp_header .dp_caption { font-weight: bold }
|
52
57
|
.Zebra_DatePicker .dp_header .dp_hover { background: #DEDEDE; color: #373737 }
|
53
|
-
.Zebra_DatePicker .dp_header .dp_blocked { color: #DEDEDE; cursor: default }
|
54
58
|
|
55
59
|
/* = DATEPICKER
|
56
60
|
----------------------------------------------------------------------------------------------------------------------*/
|
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
Default theme
|
6
6
|
|
7
|
-
copyright (c) 2011 -
|
7
|
+
copyright (c) 2011 - 2014 Stefan Gabos
|
8
8
|
http://stefangabos.ro/jquery/zebra-datepicker/
|
9
9
|
|
10
10
|
*/
|
@@ -13,13 +13,13 @@
|
|
13
13
|
.Zebra_DatePicker *:after,
|
14
14
|
.Zebra_DatePicker *:before { -moz-box-sizing: content-box !important; -webkit-box-sizing: content-box !important; box-sizing: content-box !important }
|
15
15
|
|
16
|
-
.Zebra_DatePicker { position: absolute; background: #666; border: 3px solid #666;
|
16
|
+
.Zebra_DatePicker { position: absolute; background: #666; border: 3px solid #666; z-index: 100; font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 13px; }
|
17
17
|
|
18
18
|
.Zebra_DatePicker * { margin: 0; padding: 0; color: #000; background: transparent; border: none }
|
19
19
|
|
20
20
|
/* = GLOBALS
|
21
21
|
----------------------------------------------------------------------------------------------------------------------*/
|
22
|
-
.Zebra_DatePicker table { border-collapse: collapse; border-spacing: 0 }
|
22
|
+
.Zebra_DatePicker table { border-collapse: collapse; border-spacing: 0; width: auto; table-layout: auto; }
|
23
23
|
|
24
24
|
.Zebra_DatePicker td,
|
25
25
|
.Zebra_DatePicker th { text-align: center; padding: 5px 0 }
|
@@ -39,6 +39,11 @@
|
|
39
39
|
.Zebra_DatePicker .dp_header .dp_hover,
|
40
40
|
.Zebra_DatePicker .dp_footer .dp_hover { -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px }
|
41
41
|
|
42
|
+
/* = VISIBLE/HIDDEN STATES (USE TRANSITIONS FOR EFFECTS)
|
43
|
+
----------------------------------------------------------------------------------------------------------------------*/
|
44
|
+
.Zebra_DatePicker.dp_visible { visibility: visible; filter: alpha(opacity=100); -khtml-opacity: 1; -moz-opacity: 1; opacity: 1; transition: opacity 0.2s ease-in-out }
|
45
|
+
.Zebra_DatePicker.dp_hidden { visibility: hidden; filter: alpha(opacity=0); -khtml-opacity: 0; -moz-opacity: 0; opacity: 0 }
|
46
|
+
|
42
47
|
/* = HEADER
|
43
48
|
----------------------------------------------------------------------------------------------------------------------*/
|
44
49
|
.Zebra_DatePicker .dp_header td { color: #FFF }
|
@@ -48,7 +53,6 @@
|
|
48
53
|
|
49
54
|
.Zebra_DatePicker .dp_header .dp_caption { font-weight: bold }
|
50
55
|
.Zebra_DatePicker .dp_header .dp_hover { background: #222; color: #FFF }
|
51
|
-
.Zebra_DatePicker .dp_header .dp_blocked { color: #888; cursor: default }
|
52
56
|
|
53
57
|
/* = DATEPICKER
|
54
58
|
----------------------------------------------------------------------------------------------------------------------*/
|
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
Metalic Theme
|
6
6
|
|
7
|
-
copyright (c) 2011 -
|
7
|
+
copyright (c) 2011 - 2014 Stefan Gabos
|
8
8
|
http://stefangabos.ro/jquery/zebra-datepicker/
|
9
9
|
|
10
10
|
*/
|
@@ -13,13 +13,13 @@
|
|
13
13
|
.Zebra_DatePicker *:after,
|
14
14
|
.Zebra_DatePicker *:before { -moz-box-sizing: content-box !important; -webkit-box-sizing: content-box !important; box-sizing: content-box !important }
|
15
15
|
|
16
|
-
.Zebra_DatePicker { position: absolute; background: #373737; border: 3px solid #373737;
|
16
|
+
.Zebra_DatePicker { position: absolute; background: #373737; border: 3px solid #373737; z-index: 100; font-family: Geneva, 'Lucida Sans', 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; font-size: 13px }
|
17
17
|
|
18
18
|
.Zebra_DatePicker * { margin: 0; padding: 0; color: #666; background: transparent; border: none }
|
19
19
|
|
20
20
|
/* = GLOBALS
|
21
21
|
----------------------------------------------------------------------------------------------------------------------*/
|
22
|
-
.Zebra_DatePicker table { border-collapse: collapse; border-spacing: 0 }
|
22
|
+
.Zebra_DatePicker table { border-collapse: collapse; border-spacing: 0; width: auto; table-layout: auto; }
|
23
23
|
|
24
24
|
.Zebra_DatePicker td,
|
25
25
|
.Zebra_DatePicker th { text-align: center; padding: 5px 0 }
|
@@ -39,6 +39,11 @@
|
|
39
39
|
.Zebra_DatePicker .dp_header .dp_hover,
|
40
40
|
.Zebra_DatePicker .dp_footer .dp_hover { -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px }
|
41
41
|
|
42
|
+
/* = VISIBLE/HIDDEN STATES (USE TRANSITIONS FOR EFFECTS)
|
43
|
+
----------------------------------------------------------------------------------------------------------------------*/
|
44
|
+
.Zebra_DatePicker.dp_visible { visibility: visible; filter: alpha(opacity=100); -khtml-opacity: 1; -moz-opacity: 1; opacity: 1; transition: opacity 0.2s ease-in-out }
|
45
|
+
.Zebra_DatePicker.dp_hidden { visibility: hidden; filter: alpha(opacity=0); -khtml-opacity: 0; -moz-opacity: 0; opacity: 0 }
|
46
|
+
|
42
47
|
/* = HEADER
|
43
48
|
----------------------------------------------------------------------------------------------------------------------*/
|
44
49
|
.Zebra_DatePicker .dp_header td { color: #E0E0E0 }
|
@@ -48,7 +53,6 @@
|
|
48
53
|
|
49
54
|
.Zebra_DatePicker .dp_header .dp_caption { font-weight: bold }
|
50
55
|
.Zebra_DatePicker .dp_header .dp_hover { background: #67AABB; color: #FFF }
|
51
|
-
.Zebra_DatePicker .dp_header .dp_blocked { color: #888; cursor: default }
|
52
56
|
|
53
57
|
/* = DATEPICKER
|
54
58
|
----------------------------------------------------------------------------------------------------------------------*/
|
metadata
CHANGED
@@ -1,69 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zebra-datepicker-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.8.
|
4
|
+
version: 1.8.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marcus Derencius
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.3'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: railties
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '3.0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: sass-rails
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
description: Zebra Datepicker packaged for rails
|
@@ -73,7 +73,7 @@ executables: []
|
|
73
73
|
extensions: []
|
74
74
|
extra_rdoc_files: []
|
75
75
|
files:
|
76
|
-
- .gitignore
|
76
|
+
- ".gitignore"
|
77
77
|
- Gemfile
|
78
78
|
- LICENSE.txt
|
79
79
|
- README.md
|
@@ -91,9 +91,9 @@ files:
|
|
91
91
|
- vendor/assets/javascripts/zebra-datepicker/core.js
|
92
92
|
- vendor/assets/javascripts/zebra-datepicker/zebra_datepicker.js
|
93
93
|
- vendor/assets/javascripts/zebra-datepicker/zebra_datepicker.src.js
|
94
|
-
- vendor/assets/stylesheets/zebra-datepicker/bootstrap.css
|
95
|
-
- vendor/assets/stylesheets/zebra-datepicker/default.css
|
96
|
-
- vendor/assets/stylesheets/zebra-datepicker/metallic.css
|
94
|
+
- vendor/assets/stylesheets/zebra-datepicker/bootstrap.css.scss
|
95
|
+
- vendor/assets/stylesheets/zebra-datepicker/default.css.scss
|
96
|
+
- vendor/assets/stylesheets/zebra-datepicker/metallic.css.scss
|
97
97
|
- zebra-datepicker-rails.gemspec
|
98
98
|
homepage: ''
|
99
99
|
licenses:
|
@@ -105,17 +105,17 @@ require_paths:
|
|
105
105
|
- lib
|
106
106
|
required_ruby_version: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
112
|
requirements:
|
113
|
-
- -
|
113
|
+
- - ">="
|
114
114
|
- !ruby/object:Gem::Version
|
115
115
|
version: '0'
|
116
116
|
requirements: []
|
117
117
|
rubyforge_project:
|
118
|
-
rubygems_version: 2.
|
118
|
+
rubygems_version: 2.2.2
|
119
119
|
signing_key:
|
120
120
|
specification_version: 4
|
121
121
|
summary: Zebra Datepicker (http://stefangabos.ro/jquery/zebra-datepicker/) packaged
|