My personal site (brandoncornejo.name) (binaryatrocity.name)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
29 KiB

10 years ago
  1. /*! UIkit 2.3.1 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
  2. (function(t,e,n){var i=!1,s=e('<div class="uk-dropdown uk-datepicker"></div>');s.on("click",".uk-datepicker-next, .uk-datepicker-previous, [data-date]",function(t){t.stopPropagation(),t.preventDefault();var n=e(this);n.is("[data-date]")?(i.element.val(moment(n.data("date")).format(i.options.format)).trigger("change"),s.hide(),i=!1):i.add("months",1*(n.hasClass("uk-datepicker-next")?1:-1))});var o=function(t,n){var s=this,a=e(t);a.data("datepicker")||(this.element=a,this.options=e.extend({},o.defaults,n),this.current=this.element.val()?moment(this.element.val(),this.options.format):moment(),this.element.on("click",function(){i!==s&&s.pick(this.value)}).on("change",function(){s.element.val()&&!moment(s.element.val(),s.options.format).isValid()&&s.element.val(moment().format(s.options.format))}),this.element.data("datepicker",this))};o.defaults={weekstart:1,i18n:{months:["January","February","March","April","May","June","July","August","September","October","November","December"],weekdays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},format:"DD.MM.YYYY",offsettop:5,template:function(t,e){var n="";n+='<div class="uk-datepicker-nav">',n+='<a href="" class="uk-datepicker-previous"></a>',n+='<a href="" class="uk-datepicker-next"></a>',n+='<div class="uk-datepicker-heading">'+e.i18n.months[t.month]+" "+t.year+"</div>",n+="</div>",n+='<table class="uk-datepicker-table">',n+="<thead>";for(var i=0;t.weekdays.length>i;i++)t.weekdays[i]&&(n+="<th>"+t.weekdays[i]+"</th>");n+="</thead>",n+="<tbody>";for(var i=0;t.days.length>i;i++)if(t.days[i]&&t.days[i].length){n+="<tr>";for(var s=0;t.days[i].length>s;s++)if(t.days[i][s]){var o=t.days[i][s],a=[];o.inmonth||a.push("uk-datepicker-table-muted"),o.selected&&a.push("uk-active"),n+='<td><a href="" class="'+a.join(" ")+'" data-date="'+o.day.format()+'">'+o.day.format("D")+"</a></td>"}n+="</tr>"}return n+="</tbody>",n+="</table>"}},e.extend(o.prototype,{pick:function(t){var n=this.element.offset(),o={top:n.top+this.element.outerHeight()+this.options.offsettop,left:n.left,right:""};this.current=t?moment(t,this.options.format):moment(),this.initdate=this.current.format("YYYY-MM-DD"),this.update(),"right"==e.UIkit.langdirection&&(o.right=window.innerWidth-(o.left+this.element.outerWidth()),o.left=""),s.css(o).show(),i=this},add:function(t,e){this.current.add(t,e),this.update()},setMonth:function(t){this.current.month(t),this.update()},setYear:function(t){this.current.year(t),this.update()},update:function(){var t=this.getRows(this.current.year(),this.current.month()),e=this.options.template(t,this.options);s.html(e)},getRows:function(t,e){var n=this.options,i=moment().format("YYYY-MM-DD"),s=[31,0===t%4&&0!==t%100||0===t%400?29:28,31,30,31,30,31,31,30,31,30,31][e],o=new Date(t,e,1).getDay(),a={month:e,year:t,weekdays:[],days:[]},r=[];a.weekdays=function(){for(var t=0,e=[];7>t;t++){for(var i=t+(n.weekstart||0);i>=7;)i-=7;e.push(n.i18n.weekdays[i])}return e}(),n.weekstart&&n.weekstart>0&&(o-=n.weekstart,0>o&&(o+=7));for(var u=s+o,l=u;l>7;)l-=7;u+=7-l;for(var d,h,c,f,p,m=0,g=0;u>m;m++)d=new Date(t,e,1+(m-o)),h=n.mindate&&n.mindate>d||n.maxdate&&d>n.maxdate,p=!(o>m||m>=s+o),d=moment(d),c=this.initdate==d.format("YYYY-MM-DD"),f=i==d.format("YYYY-MM-DD"),r.push({selected:c,today:f,disabled:h,day:d,inmonth:p}),7===++g&&(a.days.push(r),r=[],g=0);return a}}),n.datepicker=o,e(document).on("focus.datepicker.uikit","[data-uk-datepicker]",function(t){var i=e(this);i.data("datepicker")||(t.preventDefault(),new o(i,n.Utils.options(i.attr("data-uk-datepicker"))),i.trigger("focus"))}),e(document).on("click.datepicker.uikit",function(t){var n=e(t.target);!i||n[0]==s[0]||n.data("datepicker")||n.parents(".uk-datepicker:first").length||(s.hide(),i=!1)}),e(function(){s.appendTo("body")})})(this,jQuery,jQuery.UIkit),window.moment||function(t){function e(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1}}function n(t,e){return function(n){return d(t.call(this,n),e)}}function i(t,e){return function(n){return this.lang().o