5 lines
51 KiB
JavaScript
5 lines
51 KiB
JavaScript
!function(a){"object"==typeof exports&&exports&&"object"==typeof module&&module&&module.exports===exports?a(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],a):a(jQuery)}(function(a){function b(a){var b=a[0];return b.offsetWidth>0&&b.offsetHeight>0}function c(b){if(b.minTime&&(b.minTime=t(b.minTime)),b.maxTime&&(b.maxTime=t(b.maxTime)),b.durationTime&&"function"!=typeof b.durationTime&&(b.durationTime=t(b.durationTime)),"now"==b.scrollDefault)b.scrollDefault=function(){return b.roundingFunction(t(new Date),b)};else if(b.scrollDefault&&"function"!=typeof b.scrollDefault){var c=b.scrollDefault;b.scrollDefault=function(){return b.roundingFunction(t(c),b)}}else b.minTime&&(b.scrollDefault=function(){return b.roundingFunction(b.minTime,b)});if("string"===a.type(b.timeFormat)&&b.timeFormat.match(/[gh]/)&&(b._twelveHourTime=!0),b.showOnFocus===!1&&-1!=b.showOn.indexOf("focus")&&b.showOn.splice(b.showOn.indexOf("focus"),1),b.disableTimeRanges.length>0){for(var d in b.disableTimeRanges)b.disableTimeRanges[d]=[t(b.disableTimeRanges[d][0]),t(b.disableTimeRanges[d][1])];b.disableTimeRanges=b.disableTimeRanges.sort(function(a,b){return a[0]-b[0]});for(var d=b.disableTimeRanges.length-1;d>0;d--)b.disableTimeRanges[d][0]<=b.disableTimeRanges[d-1][1]&&(b.disableTimeRanges[d-1]=[Math.min(b.disableTimeRanges[d][0],b.disableTimeRanges[d-1][0]),Math.max(b.disableTimeRanges[d][1],b.disableTimeRanges[d-1][1])],b.disableTimeRanges.splice(d,1))}return b}function d(b){var c=b.data("timepicker-settings"),d=b.data("timepicker-list");if(d&&d.length&&(d.remove(),b.data("timepicker-list",!1)),c.useSelect){d=a("<select />",{"class":"ui-timepicker-select"});var g=d}else{d=a("<ul />",{"class":"ui-timepicker-list"});var g=a("<div />",{"class":"ui-timepicker-wrapper",tabindex:-1});g.css({display:"none",position:"absolute"}).append(d)}if(c.noneOption)if(c.noneOption===!0&&(c.noneOption=c.useSelect?"Time...":"None"),a.isArray(c.noneOption)){for(var i in c.noneOption)if(parseInt(i,10)==i){var k=e(c.noneOption[i],c.useSelect);d.append(k)}}else{var k=e(c.noneOption,c.useSelect);d.append(k)}if(c.className&&g.addClass(c.className),(null!==c.minTime||null!==c.durationTime)&&c.showDuration){"function"==typeof c.step?"function":c.step;g.addClass("ui-timepicker-with-duration"),g.addClass("ui-timepicker-step-"+c.step)}var l=c.minTime;"function"==typeof c.durationTime?l=t(c.durationTime()):null!==c.durationTime&&(l=c.durationTime);var n=null!==c.minTime?c.minTime:0,o=null!==c.maxTime?c.maxTime:n+v-1;n>o&&(o+=v),o===v-1&&"string"===a.type(c.timeFormat)&&c.show2400&&(o=v);var p=c.disableTimeRanges,w=0,y=p.length,z=c.step;"function"!=typeof z&&(z=function(){return c.step});for(var i=n,A=0;o>=i;A++,i+=60*z(A)){var B=i,C=s(B,c);if(c.useSelect){var D=a("<option />",{value:C});D.text(C)}else{var D=a("<li />");D.addClass(v/2>B%v?"ui-timepicker-am":"ui-timepicker-pm"),D.data("time",u(B,c)),D.text(C)}if((null!==c.minTime||null!==c.durationTime)&&c.showDuration){var E=r(i-l,c.step);if(c.useSelect)D.text(D.text()+" ("+E+")");else{var F=a("<span />",{"class":"ui-timepicker-duration"});F.text(" ("+E+")"),D.append(F)}}y>w&&(B>=p[w][1]&&(w+=1),p[w]&&B>=p[w][0]&&B<p[w][1]&&(c.useSelect?D.prop("disabled",!0):D.addClass("ui-timepicker-disabled"))),d.append(D)}if(g.data("timepicker-input",b),b.data("timepicker-list",g),c.useSelect)b.val()&&d.val(f(t(b.val()),c)),d.on("focus",function(){a(this).data("timepicker-input").trigger("showTimepicker")}),d.on("blur",function(){a(this).data("timepicker-input").trigger("hideTimepicker")}),d.on("change",function(){m(b,a(this).val(),"select")}),m(b,d.val(),"initial"),b.hide().after(d);else{var G=c.appendTo;"string"==typeof G?G=a(G):"function"==typeof G&&(G=G(b)),G.append(g),j(b,d),d.on("mousedown click","li",function(c){b.off("focus.timepicker"),b.on("focus.timepicker-ie-hack",function(){b.off("focus.timepicker-ie-hack"),b.on("focus.timepicker",x.show)}),h(b)||b[0].focus(),d.find("li").removeClass("ui-timepicker-selected"),a(this).addClass("ui-timepicker-selected"),q(b)&&(b.trigger("hideTimepicker"),d.on("mouseup.timepicker click.timepicker","li",function(a){d.off("mouseup.timepicker click.timepicker"),g.hide()}))})}}function e(b,c){var d,e,f;return"object"==typeof b?(d=b.label,e=b.className,f=b.value):"string"==typeof b?d=b:a.error("Invalid noneOption value"),c?a("<option />",{value:f,"class":e,text:d}):a("<li />",{"class":e,text:d}).data("time",String(f))}function f(a,b){return a=b.roundingFunction(a,b),null!==a?s(a,b):void 0}function g(b){if(b.target!=window){var c=a(b.target);c.closest(".ui-timepicker-input").length||c.closest(".ui-timepicker-wrapper").length||(x.hide(),a(document).unbind(".ui-timepicker"),a(window).unbind(".ui-timepicker"))}}function h(a){var b=a.data("timepicker-settings");return(window.navigator.msMaxTouchPoints||"ontouchstart"in document)&&b.disableTouchKeyboard}function i(b,c,d){if(!d&&0!==d)return!1;var e=b.data("timepicker-settings"),f=!1,d=e.roundingFunction(d,e);return c.find("li").each(function(b,c){var e=a(c);if("number"==typeof e.data("time"))return e.data("time")==d?(f=e,!1):void 0}),f}function j(a,b){b.find("li").removeClass("ui-timepicker-selected");var c=t(l(a),a.data("timepicker-settings"));if(null!==c){var d=i(a,b,c);if(d){var e=d.offset().top-b.offset().top;(e+d.outerHeight()>b.outerHeight()||0>e)&&b.scrollTop(b.scrollTop()+d.position().top-d.outerHeight()),d.addClass("ui-timepicker-selected")}}}function k(b,c){if(""!==this.value&&"timepicker"!=c){var d=a(this);if(!d.is(":focus")||b&&"change"==b.type){var e=d.data("timepicker-settings"),f=t(this.value,e);if(null===f)return void d.trigger("timeFormatError");var g=!1;if(null!==e.minTime&&null!==e.maxTime&&(f<e.minTime||f>e.maxTime)&&(g=!0),a.each(e.disableTimeRanges,function(){return f>=this[0]&&f<this[1]?(g=!0,!1):void 0}),e.forceRoundTime){var h=e.roundingFunction(f,e);h!=f&&(f=h,c=null)}var i=s(f,e);g?(m(d,i,"error")||b&&"change"==b.type)&&d.trigger("timeRangeError"):m(d,i,c)}}}function l(a){return a.is("input")?a.val():a.data("ui-timepicker-value")}function m(a,b,c){if(a.is("input")){a.val(b);var d=a.data("timepicker-settings");d.useSelect&&"select"!=c&&"initial"!=c&&a.data("timepicker-list").val(f(t(b),d))}return a.data("ui-timepicker-value")!=b?(a.data("ui-timepicker-value",b),"select"==c?a.trigger("selectTime").trigger("changeTime").trigger("change","timepicker"):-1==["error","initial"].indexOf(c)&&a.trigger("changeTime"),!0):(a.trigger("selectTime"),!1)}function n(a){switch(a.keyCode){case 13:case 9:return;default:a.preventDefault()}}function o(c){var d=a(this),e=d.data("timepicker-list");if(!e||!b(e)){if(40!=c.keyCode)return!0;x.show.call(d.get(0)),e=d.data("timepicker-list"),h(d)||d.focus()}switch(c.keyCode){case 13:return q(d)&&(k.call(d.get(0),{type:"change"}),x.hide.apply(this)),c.preventDefault(),!1;case 38:var f=e.find(".ui-timepicker-selected");return f.length?f.is(":first-child")||(f.removeClass("ui-timepicker-selected"),f.prev().addClass("ui-timepicker-selected"),f.prev().position().top<f.outerHeight()&&e.scrollTop(e.scrollTop()-f.outerHeight())):(e.find("li").each(function(b,c){return a(c).position().top>0?(f=a(c),!1):void 0}),f.addClass("ui-timepicker-selected")),!1;case 40:return f=e.find(".ui-timepicker-selected"),0===f.length?(e.find("li").each(function(b,c){return a(c).position().top>0?(f=a(c),!1):void 0}),f.addClass("ui-timepicker-selected")):f.is(":last-child")||(f.removeClass("ui-timepicker-selected"),f.next().addClass("ui-timepicker-selected"),f.next().position().top+2*f.outerHeight()>e.outerHeight()&&e.scrollTop(e.scrollTop()+f.outerHeight())),!1;case 27:e.find("li").removeClass("ui-timepicker-selected"),x.hide();break;case 9:x.hide();break;default:return!0}}function p(c){var d=a(this),e=d.data("timepicker-list"),f=d.data("timepicker-settings");if(!e||!b(e)||f.disableTextInput)return!0;switch(c.keyCode){case 96:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:case 65:case 77:case 80:case 186:case 8:case 46:f.typeaheadHighlight?j(d,e):e.hide()}}function q(a){var b=a.data("timepicker-settings"),c=a.data("timepicker-list"),d=null,e=c.find(".ui-timepicker-selected");return e.hasClass("ui-timepicker-disabled")?!1:(e.length&&(d=e.data("time")),null!==d&&("string"!=typeof d&&(d=s(d,b)),m(a,d,"select")),!0)}function r(a,b){a=Math.abs(a);var c,d,e=Math.round(a/60),f=[];return 60>e?f=[e,w.mins]:(c=Math.floor(e/60),d=e%60,30==b&&30==d&&(c+=w.decimal+5),f.push(c),f.push(1==c?w.hr:w.hrs),30!=b&&d&&(f.push(d),f.push(w.mins))),f.join(" ")}function s(b,c){if("number"!=typeof b)return null;var d=parseInt(b%60),e=parseInt(b/60%60),f=parseInt(b/3600%24),g=new Date(1970,0,2,f,e,d,0);if(isNaN(g.getTime()))return null;if("function"===a.type(c.timeFormat))return c.timeFormat(g);for(var h,i,j="",k=0;k<c.timeFormat.length;k++)switch(i=c.timeFormat.charAt(k)){case"a":j+=g.getHours()>11?w.pm:w.am;break;case"A":j+=g.getHours()>11?w.PM:w.AM;break;case"g":h=g.getHours()%12,j+=0===h?"12":h;break;case"G":h=g.getHours(),b===v&&(h=c.show2400?24:0),j+=h;break;case"h":h=g.getHours()%12,0!==h&&10>h&&(h="0"+h),j+=0===h?"12":h;break;case"H":h=g.getHours(),b===v&&(h=c.show2400?24:0),j+=h>9?h:"0"+h;break;case"i":var e=g.getMinutes();j+=e>9?e:"0"+e;break;case"s":d=g.getSeconds(),j+=d>9?d:"0"+d;break;case"\\":k++,j+=c.timeFormat.charAt(k);break;default:j+=i}return j}function t(a,b){if(""===a||null===a)return null;if("object"==typeof a)return 3600*a.getHours()+60*a.getMinutes()+a.getSeconds();if("string"!=typeof a)return a;a=a.toLowerCase().replace(/[\s\.]/g,""),("a"==a.slice(-1)||"p"==a.slice(-1))&&(a+="m");var c="("+w.am.replace(".","")+"|"+w.pm.replace(".","")+"|"+w.AM.replace(".","")+"|"+w.PM.replace(".","")+")?",d=new RegExp("^"+c+"([0-9]?[0-9])\\W?([0-5][0-9])?\\W?([0-5][0-9])?"+c+"$"),e=a.match(d);if(!e)return null;var f=parseInt(1*e[2],10);if(f>24){if(b&&b.wrapHours===!1)return null;f%=24}var g=e[1]||e[5],h=f;if(12>=f&&g){var i=g==w.pm||g==w.PM;h=12==f?i?12:0:f+(i?12:0)}var j=1*e[3]||0,k=1*e[4]||0,l=3600*h+60*j+k;if(12>f&&!g&&b&&b._twelveHourTime&&b.scrollDefault){var m=l-b.scrollDefault();0>m&&m>=v/-2&&(l=(l+v/2)%v)}return l}function u(a,b){return a==v&&b.show2400?a:a%v}var v=86400,w={am:"am",pm:"pm",AM:"AM",PM:"PM",decimal:".",mins:"mins",hr:"hr",hrs:"hrs"},x={init:function(b){return this.each(function(){var e=a(this),f=[];for(var g in a.fn.qorTimepicker.defaults)e.data(g)&&(f[g]=e.data(g));var h=a.extend({},a.fn.qorTimepicker.defaults,b,f);if(h.lang&&(w=a.extend(w,h.lang)),h=c(h),e.data("timepicker-settings",h),e.addClass("ui-timepicker-input"),h.useSelect)d(e);else{if(e.prop("autocomplete","off"),h.showOn)for(var i in h.showOn)e.on(h.showOn[i]+".timepicker",x.show);e.on("change.timepicker",k),e.on("keydown.timepicker",o),e.on("keyup.timepicker",p),h.disableTextInput&&e.on("keydown.timepicker",n),k.call(e.get(0),null,"initial")}})},show:function(c){var e=a(this),f=e.data("timepicker-settings");if(c&&c.preventDefault(),f.useSelect)return void e.data("timepicker-list").focus();h(e)&&e.blur();var k=e.data("timepicker-list");if(!e.prop("readonly")&&(k&&0!==k.length&&"function"!=typeof f.durationTime||(d(e),k=e.data("timepicker-list")),!b(k))){e.data("ui-timepicker-value",e.val()),j(e,k),x.hide(),k.show();var m={};f.orientation.match(/r/)?m.left=e.offset().left+e.outerWidth()-k.outerWidth()+parseInt(k.css("marginLeft").replace("px",""),10):m.left=e.offset().left+parseInt(k.css("marginLeft").replace("px",""),10);var n;n=f.orientation.match(/t/)?"t":f.orientation.match(/b/)?"b":e.offset().top+e.outerHeight(!0)+k.outerHeight()>a(window).height()+a(window).scrollTop()?"t":"b","t"==n?(k.addClass("ui-timepicker-positioned-top"),m.top=e.offset().top-k.outerHeight()+parseInt(k.css("marginTop").replace("px",""),10)):(k.removeClass("ui-timepicker-positioned-top"),m.top=e.offset().top+e.outerHeight()+parseInt(k.css("marginTop").replace("px",""),10)),k.offset(m);var o=k.find(".ui-timepicker-selected");if(!o.length){var p=t(l(e));null!==p?o=i(e,k,p):f.scrollDefault&&(o=i(e,k,f.scrollDefault()))}if(o&&o.length){var q=k.scrollTop()+o.position().top-o.outerHeight();k.scrollTop(q)}else k.scrollTop(0);return f.stopScrollPropagation&&a(document).on("wheel.ui-timepicker",".ui-timepicker-wrapper",function(b){b.preventDefault();var c=a(this).scrollTop();a(this).scrollTop(c+b.originalEvent.deltaY)}),a(document).on("touchstart.ui-timepicker mousedown.ui-timepicker",g),a(window).on("resize.ui-timepicker",g),f.closeOnWindowScroll&&a(document).on("scroll.ui-timepicker",g),e.trigger("showTimepicker"),this}},hide:function(c){var d=a(this),e=d.data("timepicker-settings");return e&&e.useSelect&&d.blur(),a(".ui-timepicker-wrapper").each(function(){var c=a(this);if(b(c)){var d=c.data("timepicker-input"),e=d.data("timepicker-settings");e&&e.selectOnBlur&&q(d),c.hide(),d.trigger("hideTimepicker")}}),this},option:function(b,e){return"string"==typeof b&&"undefined"==typeof e?a(this).data("timepicker-settings")[b]:this.each(function(){var f=a(this),g=f.data("timepicker-settings"),h=f.data("timepicker-list");"object"==typeof b?g=a.extend(g,b):"string"==typeof b&&(g[b]=e),g=c(g),f.data("timepicker-settings",g),k.call(f.get(0),{type:"change"},"initial"),h&&(h.remove(),f.data("timepicker-list",!1)),g.useSelect&&d(f)})},getSecondsFromMidnight:function(){return t(l(this))},getTime:function(a){var b=this,c=l(b);if(!c)return null;var d=t(c);if(null===d)return null;a||(a=new Date);var e=new Date(a);return e.setHours(d/3600),e.setMinutes(d%3600/60),e.setSeconds(d%60),e.setMilliseconds(0),e},isVisible:function(){var a=this,c=a.data("timepicker-list");return!(!c||!b(c))},setTime:function(a){var b=this,c=b.data("timepicker-settings");if(c.forceRoundTime)var d=f(t(a),c);else var d=s(t(a),c);return a&&null===d&&c.noneOption&&(d=a),m(b,d),b.data("timepicker-list")&&j(b,b.data("timepicker-list")),this},remove:function(){var a=this;if(a.hasClass("ui-timepicker-input")){var b=a.data("timepicker-settings");return a.removeAttr("autocomplete","off"),a.removeClass("ui-timepicker-input"),a.removeData("timepicker-settings"),a.off(".timepicker"),a.data("timepicker-list")&&a.data("timepicker-list").remove(),b.useSelect&&a.show(),a.removeData("timepicker-list"),this}}};a.fn.qorTimepicker=function(b){return this.length?x[b]?this.hasClass("ui-timepicker-input")?x[b].apply(this,Array.prototype.slice.call(arguments,1)):this:"object"!=typeof b&&b?void a.error("Method "+b+" does not exist on jQuery.timepicker"):x.init.apply(this,arguments):this},a.fn.qorTimepicker.defaults={appendTo:"body",className:null,closeOnWindowScroll:!1,disableTextInput:!1,disableTimeRanges:[],disableTouchKeyboard:!1,durationTime:null,forceRoundTime:!1,maxTime:null,minTime:null,noneOption:!1,orientation:"l",roundingFunction:function(a,b){if(null===a)return null;if("number"!=typeof b.step)return a;var c=a%(60*b.step),d=b.minTime||0;return c-=d%(60*b.step),c>=30*b.step?a+=60*b.step-c:a-=c,u(a,b)},scrollDefault:null,selectOnBlur:!1,show2400:!1,showDuration:!1,showOn:["click","focus"],showOnFocus:!0,step:30,stopScrollPropagation:!1,timeFormat:"g:ia",typeaheadHighlight:!0,useSelect:!1,wrapHours:!0}});
|
|
|
|
(function defineMustache(global,factory){if(typeof exports==="object"&&exports&&typeof exports.nodeName!=="string"){factory(exports)}else if(typeof define==="function"&&define.amd){define(["exports"],factory)}else{global.Mustache={};factory(global.Mustache)}})(this,function mustacheFactory(mustache){var objectToString=Object.prototype.toString;var isArray=Array.isArray||function isArrayPolyfill(object){return objectToString.call(object)==="[object Array]"};function isFunction(object){return typeof object==="function"}function typeStr(obj){return isArray(obj)?"array":typeof obj}function escapeRegExp(string){return string.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function hasProperty(obj,propName){return obj!=null&&typeof obj==="object"&&propName in obj}var regExpTest=RegExp.prototype.test;function testRegExp(re,string){return regExpTest.call(re,string)}var nonSpaceRe=/\S/;function isWhitespace(string){return!testRegExp(nonSpaceRe,string)}var entityMap={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function escapeHtml(string){return String(string).replace(/[&<>"'`=\/]/g,function fromEntityMap(s){return entityMap[s]})}var whiteRe=/\s*/;var spaceRe=/\s+/;var equalsRe=/\s*=/;var curlyRe=/\s*\}/;var tagRe=/#|\^|\/|>|\{|&|=|!/;function parseTemplate(template,tags){if(!template)return[];var sections=[];var tokens=[];var spaces=[];var hasTag=false;var nonSpace=false;function stripSpace(){if(hasTag&&!nonSpace){while(spaces.length)delete tokens[spaces.pop()]}else{spaces=[]}hasTag=false;nonSpace=false}var openingTagRe,closingTagRe,closingCurlyRe;function compileTags(tagsToCompile){if(typeof tagsToCompile==="string")tagsToCompile=tagsToCompile.split(spaceRe,2);if(!isArray(tagsToCompile)||tagsToCompile.length!==2)throw new Error("Invalid tags: "+tagsToCompile);openingTagRe=new RegExp(escapeRegExp(tagsToCompile[0])+"\\s*");closingTagRe=new RegExp("\\s*"+escapeRegExp(tagsToCompile[1]));closingCurlyRe=new RegExp("\\s*"+escapeRegExp("}"+tagsToCompile[1]))}compileTags(tags||mustache.tags);var scanner=new Scanner(template);var start,type,value,chr,token,openSection;while(!scanner.eos()){start=scanner.pos;value=scanner.scanUntil(openingTagRe);if(value){for(var i=0,valueLength=value.length;i<valueLength;++i){chr=value.charAt(i);if(isWhitespace(chr)){spaces.push(tokens.length)}else{nonSpace=true}tokens.push(["text",chr,start,start+1]);start+=1;if(chr==="\n")stripSpace()}}if(!scanner.scan(openingTagRe))break;hasTag=true;type=scanner.scan(tagRe)||"name";scanner.scan(whiteRe);if(type==="="){value=scanner.scanUntil(equalsRe);scanner.scan(equalsRe);scanner.scanUntil(closingTagRe)}else if(type==="{"){value=scanner.scanUntil(closingCurlyRe);scanner.scan(curlyRe);scanner.scanUntil(closingTagRe);type="&"}else{value=scanner.scanUntil(closingTagRe)}if(!scanner.scan(closingTagRe))throw new Error("Unclosed tag at "+scanner.pos);token=[type,value,start,scanner.pos];tokens.push(token);if(type==="#"||type==="^"){sections.push(token)}else if(type==="/"){openSection=sections.pop();if(!openSection)throw new Error('Unopened section "'+value+'" at '+start);if(openSection[1]!==value)throw new Error('Unclosed section "'+openSection[1]+'" at '+start)}else if(type==="name"||type==="{"||type==="&"){nonSpace=true}else if(type==="="){compileTags(value)}}openSection=sections.pop();if(openSection)throw new Error('Unclosed section "'+openSection[1]+'" at '+scanner.pos);return nestTokens(squashTokens(tokens))}function squashTokens(tokens){var squashedTokens=[];var token,lastToken;for(var i=0,numTokens=tokens.length;i<numTokens;++i){token=tokens[i];if(token){if(token[0]==="text"&&lastToken&&lastToken[0]==="text"){lastToken[1]+=token[1];lastToken[3]=token[3]}else{squashedTokens.push(token);lastToken=token}}}return squashedTokens}function nestTokens(tokens){var nestedTokens=[];var collector=nestedTokens;var sections=[];var token,section;for(var i=0,numTokens=tokens.length;i<numTokens;++i){token=tokens[i];switch(token[0]){case"#":case"^":collector.push(token);sections.push(token);collector=token[4]=[];break;case"/":section=sections.pop();section[5]=token[2];collector=sections.length>0?sections[sections.length-1][4]:nestedTokens;break;default:collector.push(token)}}return nestedTokens}function Scanner(string){this.string=string;this.tail=string;this.pos=0}Scanner.prototype.eos=function eos(){return this.tail===""};Scanner.prototype.scan=function scan(re){var match=this.tail.match(re);if(!match||match.index!==0)return"";var string=match[0];this.tail=this.tail.substring(string.length);this.pos+=string.length;return string};Scanner.prototype.scanUntil=function scanUntil(re){var index=this.tail.search(re),match;switch(index){case-1:match=this.tail;this.tail="";break;case 0:match="";break;default:match=this.tail.substring(0,index);this.tail=this.tail.substring(index)}this.pos+=match.length;return match};function Context(view,parentContext){this.view=view;this.cache={".":this.view};this.parent=parentContext}Context.prototype.push=function push(view){return new Context(view,this)};Context.prototype.lookup=function lookup(name){var cache=this.cache;var value;if(cache.hasOwnProperty(name)){value=cache[name]}else{var context=this,names,index,lookupHit=false;while(context){if(name.indexOf(".")>0){value=context.view;names=name.split(".");index=0;while(value!=null&&index<names.length){if(index===names.length-1)lookupHit=hasProperty(value,names[index]);value=value[names[index++]]}}else{value=context.view[name];lookupHit=hasProperty(context.view,name)}if(lookupHit)break;context=context.parent}cache[name]=value}if(isFunction(value))value=value.call(this.view);return value};function Writer(){this.cache={}}Writer.prototype.clearCache=function clearCache(){this.cache={}};Writer.prototype.parse=function parse(template,tags){var cache=this.cache;var tokens=cache[template];if(tokens==null)tokens=cache[template]=parseTemplate(template,tags);return tokens};Writer.prototype.render=function render(template,view,partials){var tokens=this.parse(template);var context=view instanceof Context?view:new Context(view);return this.renderTokens(tokens,context,partials,template)};Writer.prototype.renderTokens=function renderTokens(tokens,context,partials,originalTemplate){var buffer="";var token,symbol,value;for(var i=0,numTokens=tokens.length;i<numTokens;++i){value=undefined;token=tokens[i];symbol=token[0];if(symbol==="#")value=this.renderSection(token,context,partials,originalTemplate);else if(symbol==="^")value=this.renderInverted(token,context,partials,originalTemplate);else if(symbol===">")value=this.renderPartial(token,context,partials,originalTemplate);else if(symbol==="&")value=this.unescapedValue(token,context);else if(symbol==="name")value=this.escapedValue(token,context);else if(symbol==="text")value=this.rawValue(token);if(value!==undefined)buffer+=value}return buffer};Writer.prototype.renderSection=function renderSection(token,context,partials,originalTemplate){var self=this;var buffer="";var value=context.lookup(token[1]);function subRender(template){return self.render(template,context,partials)}if(!value)return;if(isArray(value)){for(var j=0,valueLength=value.length;j<valueLength;++j){buffer+=this.renderTokens(token[4],context.push(value[j]),partials,originalTemplate)}}else if(typeof value==="object"||typeof value==="string"||typeof value==="number"){buffer+=this.renderTokens(token[4],context.push(value),partials,originalTemplate)}else if(isFunction(value)){if(typeof originalTemplate!=="string")throw new Error("Cannot use higher-order sections without the original template");value=value.call(context.view,originalTemplate.slice(token[3],token[5]),subRender);if(value!=null)buffer+=value}else{buffer+=this.renderTokens(token[4],context,partials,originalTemplate)}return buffer};Writer.prototype.renderInverted=function renderInverted(token,context,partials,originalTemplate){var value=context.lookup(token[1]);if(!value||isArray(value)&&value.length===0)return this.renderTokens(token[4],context,partials,originalTemplate)};Writer.prototype.renderPartial=function renderPartial(token,context,partials){if(!partials)return;var value=isFunction(partials)?partials(token[1]):partials[token[1]];if(value!=null)return this.renderTokens(this.parse(value),context,partials,value)};Writer.prototype.unescapedValue=function unescapedValue(token,context){var value=context.lookup(token[1]);if(value!=null)return value};Writer.prototype.escapedValue=function escapedValue(token,context){var value=context.lookup(token[1]);if(value!=null)return mustache.escape(value)};Writer.prototype.rawValue=function rawValue(token){return token[1]};mustache.name="mustache.js";mustache.version="2.2.1";mustache.tags=["{{","}}"];var defaultWriter=new Writer;mustache.clearCache=function clearCache(){return defaultWriter.clearCache()};mustache.parse=function parse(template,tags){return defaultWriter.parse(template,tags)};mustache.render=function render(template,view,partials){if(typeof template!=="string"){throw new TypeError('Invalid template! Template should be a "string" '+'but "'+typeStr(template)+'" was given as the first '+"argument for mustache#render(template, view, partials)")}return defaultWriter.render(template,view,partials)};mustache.to_html=function to_html(template,view,partials,send){var result=mustache.render(template,view,partials);if(isFunction(send)){send(result)}else{return result}};mustache.escape=escapeHtml;mustache.Scanner=Scanner;mustache.Context=Context;mustache.Writer=Writer});
|
|
|
|
"use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}window.Mustache&&(window.Mustache.tags=["[[","]]"]),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(e){var i=window.componentHandler,a='[class*="mdl-js"],[class*="mdl-tooltip"]';function s(t){i&&(e(t).is(a)?i.upgradeElements(t):i.upgradeElements(e(a,t).toArray()))}function n(t){i&&(e(t).is(a)?i.downgradeElements(t):i.downgradeElements(e(a,t).toArray()))}e(function(){e(document).on("enable.qor.material",function(t){s(t.target)}).on("disable.qor.material",function(t){n(t.target)}).on("update.qor.material",function(t){n(t.target),s(t.target)})})}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(s){var a=s(document),n="qor.modal",t="click."+n,e="keyup."+n,r="transitionend",o="qor-modal-open",h="shown",l="in",i="aria-hidden";function d(t,e){this.$element=s(t),this.options=s.extend({},d.DEFAULTS,s.isPlainObject(e)&&e),this.transitioning=!1,this.fadable=!1,this.init()}return d.prototype={constructor:d,init:function(){this.fadable=this.$element.hasClass("fade"),this.options.show?this.show():this.toggle()},bind:function(){this.$element.on(t,s.proxy(this.click,this)),this.options.keyboard&&a.on(e,s.proxy(this.keyup,this))},unbind:function(){this.$element.off(t,this.click),this.options.keyboard&&a.off(e,this.keyup)},click:function(t){var e=this.$element[0],i=t.target;if(i===e&&this.options.backdrop)this.hide();else for(;i!==e;){if("modal"===s(i).data("dismiss")){this.hide();break}i=i.parentNode}},keyup:function(t){27===t.which&&this.hide()},show:function(t){var e,i=this.$element;if(!this.transitioning&&!i.hasClass(l)&&(e=s.Event("show.qor.modal"),i.trigger(e),!e.isDefaultPrevented())){if(a.find("body").addClass(o),i.addClass(h).scrollTop(0).get(0).offsetHeight,this.transitioning=!0,t||!this.fadable)return i.addClass(l),void this.shown();i.one(r,s.proxy(this.shown,this)),i.addClass(l)}},shown:function(){this.transitioning=!1,this.bind(),this.$element.attr(i,!1).trigger("shown.qor.modal").focus()},hide:function(t){var e,i=this.$element;if(!this.transitioning&&i.hasClass(l)&&(e=s.Event("hide.qor.modal"),i.trigger(e),!e.isDefaultPrevented())){if(a.find("body").removeClass(o),this.transitioning=!0,t||!this.fadable)return i.removeClass(l),void this.hidden();i.one(r,s.proxy(this.hidden,this)),i.removeClass(l)}},hidden:function(){this.transitioning=!1,this.unbind(),this.$element.removeClass(h).attr(i,!0).trigger("hidden.qor.modal")},toggle:function(){this.$element.hasClass(l)?this.hide():this.show()},destroy:function(){this.$element.removeData(n)}},d.DEFAULTS={backdrop:!1,keyboard:!0,show:!0},d.plugin=function(a){return this.each(function(){var t,e=s(this),i=e.data(n);if(!i){if(/destroy/.test(a))return;e.data(n,i=new d(this,a))}"string"==typeof a&&s.isFunction(t=i[a])&&t.apply(i)})},s.fn.qorModal=d.plugin,s(function(){var e=".qor-modal";s(document).on(t,'[data-toggle="qor.modal"]',function(){var t=s(this),e=t.data(),i=s(e.target||t.attr("href"));d.plugin.call(i,i.data(n)?"toggle":e)}).on("disable.qor.modal",function(t){d.plugin.call(s(e,t.target),"destroy")}).on("enable.qor.modal",function(t){d.plugin.call(s(e,t.target))})}),d}),function(t){"function"==typeof define&&define.amd?define("datepicker",["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(_){var t=_(window),s=window.document,p=_(s),n=window.Number,o="datepicker",i="click."+o,a="keyup."+o,r="focus."+o,e="resize."+o,h="show."+o,l="hide."+o,d="pick."+o,c=/(y|m|d)+/g,u=/\d+/g,f=/^\d{2,4}$/,m=o+"-top-left",y=o+"-bottom-left",g=[m,o+"-top-right",y,o+"-bottom-right"].join(" "),w=o+"-hide",v=Math.min,k=Object.prototype.toString;function D(t){return"string"==typeof t}function b(t){return"number"==typeof t&&!isNaN(t)}function $(t){return void 0===t}function x(t){return"date"===(e=t,k.call(e).slice(8,-1).toLowerCase());var e}function q(t,e){var i=[];return Array.from?Array.from(t).slice(e||0):(b(e)&&i.push(e),i.slice.apply(t,i))}function S(t,e){var i=q(arguments,2);return function(){return t.apply(e,i.concat(q(arguments)))}}function I(t,e){return[31,(i=t,i%4==0&&i%100!=0||i%400==0?29:28),31,30,31,30,31,31,30,31,30,31][e];var i}function C(t,e){(e=_.isPlainObject(e)?e:{}).language&&(e=_.extend({},C.LANGUAGES[e.language],e)),this.$element=_(t),this.options=_.extend({},C.DEFAULTS,e),this.isBuilt=!1,this.isShown=!1,this.isInput=!1,this.isInline=!1,this.initialValue="",this.initialDate=null,this.startDate=null,this.endDate=null,this.init()}C.prototype={constructor:C,init:function(){var t=this.options,e=this.$element,i=t.startDate,a=t.endDate,s=t.date;this.$trigger=_(t.trigger||e),this.isInput=e.is("input")||e.is("textarea"),this.isInline=t.inline&&(t.container||!this.isInput),this.format=function(t){var e,i,a=String(t).toLowerCase(),s=a.match(c);if(!s||0===s.length)throw new Error("Invalid date format.");for(t={source:a,parts:s},e=s.length,i=0;i<e;i++)switch(s[i]){case"dd":case"d":t.hasDay=!0;break;case"mm":case"m":t.hasMonth=!0;break;case"yyyy":case"yy":t.hasYear=!0}return t}(t.format),this.initialValue=this.getValue(),s=this.parseDate(s||this.initialValue),i&&(i=this.parseDate(i),s.getTime()<i.getTime()&&(s=new Date(i)),this.startDate=i),a&&(a=this.parseDate(a),i&&a.getTime()<i.getTime()&&(a=new Date(i)),s.getTime()>a.getTime()&&(s=new Date(a)),this.endDate=a),this.date=s,this.viewDate=new Date(s),this.initialDate=new Date(this.date),this.bind(),(t.autoshow||this.isInline)&&this.show(),t.autopick&&this.pick()},build:function(){var t,e=this.options,i=this.$element;this.isBuilt||(this.isBuilt=!0,this.$picker=t=_(e.template),this.$week=t.find('[data-view="week"]'),this.$yearsPicker=t.find('[data-view="years picker"]'),this.$yearsPrev=t.find('[data-view="years prev"]'),this.$yearsNext=t.find('[data-view="years next"]'),this.$yearsCurrent=t.find('[data-view="years current"]'),this.$years=t.find('[data-view="years"]'),this.$monthsPicker=t.find('[data-view="months picker"]'),this.$yearPrev=t.find('[data-view="year prev"]'),this.$yearNext=t.find('[data-view="year next"]'),this.$yearCurrent=t.find('[data-view="year current"]'),this.$months=t.find('[data-view="months"]'),this.$daysPicker=t.find('[data-view="days picker"]'),this.$monthPrev=t.find('[data-view="month prev"]'),this.$monthNext=t.find('[data-view="month next"]'),this.$monthCurrent=t.find('[data-view="month current"]'),this.$days=t.find('[data-view="days"]'),this.isInline?_(e.container||i).append(t.addClass("datepicker-inline")):(_(s.body).append(t.addClass("datepicker-dropdown")),t.addClass(w)),this.fillWeek())},unbuild:function(){this.isBuilt&&(this.isBuilt=!1,this.$picker.remove())},bind:function(){var t=this.options,e=this.$element;_.isFunction(t.show)&&e.on(h,t.show),_.isFunction(t.hide)&&e.on(l,t.hide),_.isFunction(t.pick)&&e.on(d,t.pick),this.isInput&&(e.on(a,_.proxy(this.keyup,this)),t.trigger||e.on(r,_.proxy(this.show,this))),this.$trigger.on(i,_.proxy(this.show,this))},unbind:function(){var t=this.options,e=this.$element;_.isFunction(t.show)&&e.off(h,t.show),_.isFunction(t.hide)&&e.off(l,t.hide),_.isFunction(t.pick)&&e.off(d,t.pick),this.isInput&&(e.off(a,this.keyup),t.trigger||e.off(r,this.show)),this.$trigger.off(i,this.show)},showView:function(t){var e=this.$yearsPicker,i=this.$monthsPicker,a=this.$daysPicker,s=this.format;if(s.hasYear||s.hasMonth||s.hasDay)switch(n(t)){case 2:case"years":i.addClass(w),a.addClass(w),s.hasYear?(this.fillYears(),e.removeClass(w)):this.showView(0);break;case 1:case"months":e.addClass(w),a.addClass(w),s.hasMonth?(this.fillMonths(),i.removeClass(w)):this.showView(2);break;default:e.addClass(w),i.addClass(w),s.hasDay?(this.fillDays(),a.removeClass(w)):this.showView(1)}},hideView:function(){this.options.autohide&&this.hide()},place:function(){var t=this.options,e=this.$element,i=this.$picker,a=p.outerWidth(),s=p.outerHeight(),n=e.outerWidth(),r=e.outerHeight(),o=i.width(),h=i.height(),l=e.offset(),d=l.left,c=l.top,u=parseFloat(t.offset)||10,f=m;h<c&&s<c+r+h?(c-=h+u,f=y):c+=r+u,a<d+o&&(d=d+n-o,f=f.replace("left","right")),i.removeClass(g).addClass(f).css({top:c,left:d,zIndex:parseInt(t.zIndex,10)})},trigger:function(t,e){var i=_.Event(t,e);return this.$element.trigger(i),i},createItem:function(t){var e=this.options,i=e.itemTag,a={text:"",view:"",muted:!1,picked:!1,disabled:!1};return _.extend(a,t),"<"+i+" "+(a.disabled?'class="'+e.disabledClass+'"':a.picked?'class="'+e.pickedClass+'"':a.muted?'class="'+e.mutedClass+'"':"")+(a.view?' data-view="'+a.view+'"':"")+">"+a.text+"</"+i+">"},fillAll:function(){this.fillYears(),this.fillMonths(),this.fillDays()},fillWeek:function(){var t,e=this.options,i=parseInt(e.weekStart,10)%7,a=e.daysMin,s="";for(a=_.merge(a.slice(i),a.slice(0,i)),t=0;t<=6;t++)s+=this.createItem({text:a[t]});this.$week.html(s)},fillYears:function(){var t,e=this.options,i=e.disabledClass||"",a=e.yearSuffix||"",s=_.isFunction(e.filter)&&e.filter,n=this.startDate,r=this.endDate,o=this.viewDate,h=o.getFullYear(),l=o.getMonth(),d=o.getDate(),c=this.date,u=c.getFullYear(),f=!1,p=!1,m=!1,y=!1,g=!1,w="";for(t=-5;t<=6;t++)c=new Date(h+t,l,d),g=-5===t||6===t,y=h+t===u,m=!1,n&&(m=c.getFullYear()<n.getFullYear(),-5===t&&(f=m)),!m&&r&&(m=c.getFullYear()>r.getFullYear(),6===t&&(p=m)),!m&&s&&(m=!1===s.call(this.$element,c)),w+=this.createItem({text:h+t,view:m?"year disabled":y?"year picked":"year",muted:g,picked:y,disabled:m});this.$yearsPrev.toggleClass(i,f),this.$yearsNext.toggleClass(i,p),this.$yearsCurrent.toggleClass(i,!0).html(h+-5+a+" - "+(h+6)+a),this.$years.html(w)},fillMonths:function(){var t,e=this.options,i=e.disabledClass||"",a=e.monthsShort,s=_.isFunction(e.filter)&&e.filter,n=this.startDate,r=this.endDate,o=this.viewDate,h=o.getFullYear(),l=o.getDate(),d=this.date,c=d.getFullYear(),u=d.getMonth(),f=!1,p=!1,m=!1,y=!1,g="";for(t=0;t<=11;t++)d=new Date(h,t,l),y=h===c&&t===u,m=!1,n&&(m=(f=d.getFullYear()===n.getFullYear())&&d.getMonth()<n.getMonth()),!m&&r&&(m=(p=d.getFullYear()===r.getFullYear())&&d.getMonth()>r.getMonth()),!m&&s&&(m=!1===s.call(this.$element,d)),g+=this.createItem({index:t,text:a[t],view:m?"month disabled":y?"month picked":"month",picked:y,disabled:m});this.$yearPrev.toggleClass(i,f),this.$yearNext.toggleClass(i,p),this.$yearCurrent.toggleClass(i,f&&p).html(h+e.yearSuffix||""),this.$months.html(g)},fillDays:function(){var t,e,i,a=this.options,s=a.disabledClass||"",n=a.yearSuffix||"",r=a.monthsShort,o=parseInt(a.weekStart,10)%7,h=_.isFunction(a.filter)&&a.filter,l=this.startDate,d=this.endDate,c=this.viewDate,u=c.getFullYear(),f=c.getMonth(),p=u,m=f,y=u,g=f,w=this.date,v=w.getFullYear(),k=w.getMonth(),D=w.getDate(),b=!1,$=!1,x=!1,q=!1,S=[],C=[],T=[];for(0===f?(p-=1,m=11):m-=1,t=I(p,m),(i=(w=new Date(u,f,1)).getDay()-o)<=0&&(i+=7),l&&(b=w.getTime()<=l.getTime()),e=t-(i-1);e<=t;e++)w=new Date(p,m,e),x=!1,l&&(x=w.getTime()<l.getTime()),!x&&h&&(x=!1===h.call(this.$element,w)),S.push(this.createItem({text:e,view:"day prev",muted:!0,disabled:x}));for(11===f?(y+=1,g=0):g+=1,t=I(u,f),i=42-(S.length+t),w=new Date(u,f,t),d&&($=w.getTime()>=d.getTime()),e=1;e<=i;e++)w=new Date(y,g,e),x=!1,d&&(x=w.getTime()>d.getTime()),!x&&h&&(x=!1===h.call(this.$element,w)),C.push(this.createItem({text:e,view:"day next",muted:!0,disabled:x}));for(e=1;e<=t;e++)w=new Date(u,f,e),q=u===v&&f===k&&e===D,x=!1,l&&(x=w.getTime()<l.getTime()),!x&&d&&(x=w.getTime()>d.getTime()),!x&&h&&(x=!1===h.call(this.$element,w)),T.push(this.createItem({text:e,view:x?"day disabled":q?"day picked":"day",picked:q,disabled:x}));this.$monthPrev.toggleClass(s,b),this.$monthNext.toggleClass(s,$),this.$monthCurrent.toggleClass(s,b&&$).html(a.yearFirst?u+n+" "+r[f]:r[f]+" "+u+n),this.$days.html(S.join("")+T.join(" ")+C.join(""))},click:function(t){var e,i,a,s,n,r,o=_(t.target),h=this.viewDate;if(t.stopPropagation(),t.preventDefault(),!o.hasClass("disabled"))switch(e=h.getFullYear(),i=h.getMonth(),a=h.getDate(),r=o.data("view")){case"years prev":case"years next":e="years prev"===r?e-10:e+10,n=o.text(),(s=f.test(n))&&(e=parseInt(n,10),this.date=new Date(e,i,v(a,28))),this.viewDate=new Date(e,i,v(a,28)),this.fillYears(),s&&(this.showView(1),this.pick("year"));break;case"year prev":case"year next":e="year prev"===r?e-1:e+1,this.viewDate=new Date(e,i,v(a,28)),this.fillMonths();break;case"year current":this.format.hasYear&&this.showView(2);break;case"year picked":this.format.hasMonth?this.showView(1):this.hideView();break;case"year":e=parseInt(o.text(),10),this.date=new Date(e,i,v(a,28)),this.viewDate=new Date(e,i,v(a,28)),this.format.hasMonth?this.showView(1):this.hideView(),this.pick("year");break;case"month prev":case"month next":i="month prev"===r?i-1:"month next"===r?i+1:i,this.viewDate=new Date(e,i,v(a,28)),this.fillDays();break;case"month current":this.format.hasMonth&&this.showView(1);break;case"month picked":this.format.hasDay?this.showView(0):this.hideView();break;case"month":i=_.inArray(o.text(),this.options.monthsShort),this.date=new Date(e,i,v(a,28)),this.viewDate=new Date(e,i,v(a,28)),this.format.hasDay?this.showView(0):this.hideView(),this.pick("month");break;case"day prev":case"day next":case"day":i="day prev"===r?i-1:"day next"===r?i+1:i,a=parseInt(o.text(),10),this.date=new Date(e,i,a),this.viewDate=new Date(e,i,a),this.fillDays(),"day"===r&&this.hideView(),this.pick("day");break;case"day picked":this.hideView(),this.pick("day")}},clickDoc:function(t){for(var e,i=t.target,a=this.$trigger[0];i!==s;){if(i===a){e=!0;break}i=i.parentNode}e||this.hide()},keyup:function(){this.update()},getValue:function(){var t=this.$element,e="";return this.isInput?e=t.val():this.isInline?this.options.container&&(e=t.text()):e=t.text(),e},setValue:function(t){var e=this.$element;t=D(t)?t:"",this.isInput?e.val(t):this.isInline?this.options.container&&e.text(t):e.text(t)},show:function(){this.isBuilt||this.build(),this.isShown||this.trigger(h).isDefaultPrevented()||(this.isShown=!0,this.$picker.removeClass(w).on(i,_.proxy(this.click,this)),this.showView(this.options.startView),this.isInline||(t.on(e,this._place=S(this.place,this)),p.on(i,this._clickDoc=S(this.clickDoc,this)),this.place()))},hide:function(){this.isShown&&(this.trigger(l).isDefaultPrevented()||(this.isShown=!1,this.$picker.addClass(w).off(i,this.click),this.isInline||(t.off(e,this._place),p.off(i,this._clickDoc))))},update:function(){this.setDate(this.getValue(),!0)},pick:function(t){var e=this.$element,i=this.date;this.trigger(d,{view:t||"",date:i}).isDefaultPrevented()||(this.setValue(i=this.formatDate(this.date)),this.isInput&&e.trigger("change"))},reset:function(){this.setDate(this.initialDate,!0),this.setValue(this.initialValue),this.isShown&&this.showView(this.options.startView)},getMonthName:function(t,e){var i=this.options,a=i.months;return _.isNumeric(t)?t=n(t):$(e)&&(e=t),!0===e&&(a=i.monthsShort),a[b(t)?t:this.date.getMonth()]},getDayName:function(t,e,i){var a=this.options,s=a.days;return _.isNumeric(t)?t=n(t):($(i)&&(i=e),$(e)&&(e=t)),(s=!0===i?a.daysMin:!0===e?a.daysShort:s)[b(t)?t:this.date.getDay()]},getDate:function(t){var e=this.date;return t?this.formatDate(e):new Date(e)},setDate:function(t,e){var i=this.options.filter;if(x(t)||D(t)){if(t=this.parseDate(t),_.isFunction(i)&&!1===i.call(this.$element,t))return;this.date=t,this.viewDate=new Date(t),e||this.pick(),this.isBuilt&&this.fillAll()}},setStartDate:function(t){(x(t)||D(t))&&(this.startDate=this.parseDate(t),this.isBuilt&&this.fillAll())},setEndDate:function(t){(x(t)||D(t))&&(this.endDate=this.parseDate(t),this.isBuilt&&this.fillAll())},parseDate:function(t){var e,i,a,s,n,r,o=this.format,h=[];if(x(t))return new Date(t.getFullYear(),t.getMonth(),t.getDate());if(D(t)&&(h=t.match(u)||[]),i=(t=new Date).getFullYear(),a=t.getDate(),s=t.getMonth(),e=o.parts.length,h.length===e)for(r=0;r<e;r++)switch(n=parseInt(h[r],10)||1,o.parts[r]){case"dd":case"d":a=n;break;case"mm":case"m":s=n-1;break;case"yy":i=2e3+n;break;case"yyyy":i=n}return new Date(i,s,a)},formatDate:function(t){var e,i,a,s,n,r=this.format,o="";if(x(t))for(o=r.source,i=t.getFullYear(),(s={d:t.getDate(),m:t.getMonth()+1,yy:i.toString().substring(2),yyyy:i}).dd=(s.d<10?"0":"")+s.d,s.mm=(s.m<10?"0":"")+s.m,e=r.parts.length,n=0;n<e;n++)a=r.parts[n],o=o.replace(a,s[a]);return o},destroy:function(){this.unbind(),this.unbuild(),this.$element.removeData(o)}},C.LANGUAGES={},C.DEFAULTS={autoshow:!1,autohide:!1,autopick:!1,inline:!1,container:null,trigger:null,language:"",format:"yyyy-mm-dd",date:null,startDate:null,endDate:null,startView:0,weekStart:0,yearFirst:!1,yearSuffix:"",days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],daysMin:["Su","Mo","Tu","We","Th","Fr","Sa"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],itemTag:"li",mutedClass:"muted",pickedClass:"picked",disabledClass:"disabled",template:'<div class="datepicker-container"><div class="datepicker-panel" data-view="years picker"><ul><li data-view="years prev">‹</li><li data-view="years current"></li><li data-view="years next">›</li></ul><ul data-view="years"></ul></div><div class="datepicker-panel" data-view="months picker"><ul><li data-view="year prev">‹</li><li data-view="year current"></li><li data-view="year next">›</li></ul><ul data-view="months"></ul></div><div class="datepicker-panel" data-view="days picker"><ul><li data-view="month prev">‹</li><li data-view="month current"></li><li data-view="month next">›</li></ul><ul data-view="week"></ul><ul data-view="days"></ul></div></div>',offset:10,zIndex:1e3,filter:null,show:null,hide:null,pick:null},C.setDefaults=function(t){_.extend(C.DEFAULTS,_.isPlainObject(t)&&t)},C.other=_.fn.qorDatepicker,_.fn.qorDatepicker=function(s){var n,r=q(arguments,1);return this.each(function(){var t,e,i=_(this),a=i.data(o);if(!a){if(/destroy/.test(s))return;t=_.extend({},i.data(),_.isPlainObject(s)&&s),i.data(o,a=new C(this,t))}D(s)&&_.isFunction(e=a[s])&&(n=e.apply(a,r))}),$(n)?this:n},_.fn.qorDatepicker.Constructor=C,_.fn.qorDatepicker.languages=C.LANGUAGES,_.fn.qorDatepicker.setDefaults=C.setDefaults,_.fn.qorDatepicker.noConflict=function(){return _.fn.qorDatepicker=C.other,this}}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(o){var n="qor.datepicker",t="enable."+n,h="pick."+n,l="click."+n,d=".qor-datepicker__embedded",c=".qor-datepicker__save",i="[data-picker-type]";function u(t,e){this.$element=o(t),this.options=o.extend(!0,{},u.DEFAULTS,o.isPlainObject(e)&&e),this.date=null,this.formatDate=null,this.built=!1,this.pickerData=this.$element.data(),this.$parent=this.$element.closest(i),this.isDateTimePicker="datetime"==this.$parent.data("picker-type"),this.$targetInput=this.$parent.find(this.pickerData.targetInput||(this.isDateTimePicker?".qor-datetimepicker__input":".qor-datepicker__input")),this.init()}return u.prototype={init:function(){this.$targetInput.is(":disabled")?this.$element.remove():this.bind()},bind:function(){this.$element.on(l,o.proxy(this.show,this))},unbind:function(){this.$element.off(l,this.show)},build:function(){var t,i,e,a=this.$element,s=this.$targetInput,n=s.val(),r={date:new Date,inline:!0};this.built||(a.is(":input")&&Date.parse(a.val())?r.date=new Date(a.val()):n&&Date.parse(n)&&(r.date=new Date(n)),this.$modal=t=o((i=u.TEMPLATE,e=this.options.text,"string"==typeof i&&"object"===_typeof(e)&&o.each(e,function(t,e){i=i.replace("$["+String(t).toLowerCase()+"]",e)}),i)).appendTo("body"),s.data("start-date")&&(r.startDate=new Date),t.find(d).on(h,o.proxy(this.change,this)).qorDatepicker(r).triggerHandler(h),t.find(c).on(l,o.proxy(this.pick,this)),this.built=!0)},unbuild:function(){this.built&&this.$modal.find(d).off(h,this.change).qorDatepicker("destroy").end().find(c).off(l,this.pick).end().remove()},change:function(t){var e,i=this.$modal,a=o(t.target);this.date=e=a.qorDatepicker("getDate"),this.formatDate=a.qorDatepicker("getDate",!0),i.find(".qor-datepicker__picked-year").text(e.getFullYear()),i.find(".qor-datepicker__picked-date").text([a.qorDatepicker("getDayName",e.getDay(),!0)+",",String(a.qorDatepicker("getMonthName",e.getMonth(),!0)),e.getDate()].join(" "))},show:function(){this.built||this.build(),this.$modal.qorModal("show")},pick:function(){var t=this.$targetInput,e=this.formatDate;if(this.isDateTimePicker){var i=/^\d{4}-\d{1,2}-\d{1,2}/,a=t.val();i.test(a)?e=a.replace(i,e):e+=" 00:00"}t.val(e).trigger("change"),this.$modal.qorModal("hide")},destroy:function(){this.unbind(),this.unbuild(),this.$element.removeData(n)}},u.DEFAULTS={text:{title:"Pick a date",ok:"OK",cancel:"Cancel"}},u.TEMPLATE='<div class="qor-modal fade qor-datepicker" tabindex="-1" role="dialog" aria-hidden="true">\n <div class="mdl-card mdl-shadow--2dp" role="document">\n <div class="mdl-card__title">\n <h2 class="mdl-card__title-text">$[title]</h2>\n </div>\n <div class="mdl-card__supporting-text">\n <div class="qor-datepicker__picked">\n <div class="qor-datepicker__picked-year"></div>\n <div class="qor-datepicker__picked-date"></div>\n </div>\n <div class="qor-datepicker__embedded"></div>\n </div>\n <div class="mdl-card__actions">\n <a class="mdl-button mdl-button--colored mdl-button--raised qor-datepicker__save">$[ok]</a>\n <a class="mdl-button mdl-button--colored " data-dismiss="modal">$[cancel]</a>\n </div>\n </div>\n </div>',u.plugin=function(s){return this.each(function(){var t,e,i=o(this),a=i.data(n);if(!a){if(!o.fn.qorDatepicker)return;if(/destroy/.test(s))return;t=o.extend(!0,{},i.data(),"object"===_typeof(s)&&s),i.data(n,a=new u(this,t))}"string"==typeof s&&o.isFunction(e=a[s])&&e.apply(a)})},o(function(){var e='[data-toggle="qor.datepicker"]';o(document).on("disable.qor.datepicker",function(t){u.plugin.call(o(e,t.target),"destroy")}).on(t,function(t){u.plugin.call(o(e,t.target))}).triggerHandler(t)}),u}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(n){var r="qor.timepicker",t="enable."+r,e="click."+r,i="focus."+r,a="keydown."+r,s="blur."+r,o="selectTime."+r,h="[data-picker-type]";function l(t,e){this.$element=n(t),this.options=n.extend(!0,{},l.DEFAULTS,n.isPlainObject(e)&&e),this.formatDate=null,this.pickerData=this.$element.data(),this.parent=this.$element.closest(h),this.isDateTimePicker="datetime"==this.parent.data("picker-type"),this.$targetInput=this.parent.find(this.pickerData.targetInput||(this.isDateTimePicker?".qor-datetimepicker__input":".qor-datepicker__input")),this.init()}return l.prototype={init:function(){if(this.$targetInput.is(":disabled"))this.$element.remove();else{this.bind(),this.oldValue=this.$targetInput.val();var t=new Date,e=t.getMonth()+1,i=t.getDate();e=e<8?"0"+e:e,i=i<10?"0"+i:i,this.dateValueNow=t.getFullYear()+"-"+e+"-"+i}},bind:function(){this.isDateTimePicker&&this.$targetInput.qorTimepicker({timeFormat:"H:i",showOn:null,wrapHours:!1,scrollDefault:"now"}).on(o,n.proxy(this.changeTime,this)).on(s,n.proxy(this.blur,this)).on(i,n.proxy(this.focus,this)).on(a,n.proxy(this.keydown,this)),this.$element.on(e,n.proxy(this.show,this))},unbind:function(){this.$element.off(e,this.show),this.isDateTimePicker&&this.$targetInput.off(o,this.changeTime).off(s,this.blur).off(i,this.focus).off(a,this.keydown)},focus:function(){},blur:function(){var t,e,i,a,s,n,r=this.$targetInput.val(),o=r.split(" "),h=o.length,l=/\d{1,2}:\d{1,2}/,d=/^\d{4}-\d{1,2}-\d{1,2}/;if(r){if(1==h)d.test(o[0])&&(e=o[0],i="00:00"),l.test(o[0])&&(e=this.dateValueNow,i=o[0]);else for(var c=0;c<h;c++){a=d.test(o[c]),s=l.test(o[c]),a&&(e=o[c],n="-"),s&&(i=o[c],n=":"),t=o[c].split(n);for(var u=0;u<t.length;u++)t[u].length<2&&(t[u]="0"+t[u]);a&&(e=t.join(n)),s&&(i=t.join(n))}this.checkDate(e)&&this.checkTime(i)?(this.$targetInput.val(e+" "+i),this.oldValue=this.$targetInput.val()):this.$targetInput.val(this.oldValue)}},keydown:function(t){var e=t.keyCode;-1==[48,49,50,51,52,53,54,55,56,57,8,37,38,39,40,27,32,20,189,16,186,96,97,98,99,100,101,102,103,104,105].indexOf(e)&&t.preventDefault()},checkDate:function(t){return/^(?:(?!0000)[0-9]{4}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-8])|(?:0[13-9]|1[0-2])-(?:29|30)|(?:0[13578]|1[02])-31)|(?:[0-9]{1,2}(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)-02-29)$/.test(t)},checkTime:function(t){return/^([01]\d|2[0-3]):?([0-5]\d)$/.test(t)},changeTime:function(){var t,e=this.$targetInput,i=this.oldValue,a=/\d{1,2}:\d{1,2}/,s=a.test(i),n=e.data().timepickerList.find(".ui-timepicker-selected").html();t=i?s?i.replace(a,n):i+" "+n:this.dateValueNow+" "+n,e.val(t)},show:function(){this.isDateTimePicker&&(this.$targetInput.qorTimepicker("show"),this.oldValue=this.$targetInput.val())},destroy:function(){this.unbind(),this.$targetInput.qorTimepicker("remove"),this.$element.removeData(r)}},l.DEFAULTS={},l.plugin=function(s){return this.each(function(){var t,e,i=n(this),a=i.data(r);if(!a){if(!n.fn.qorDatepicker)return;if(/destroy/.test(s))return;t=n.extend(!0,{},i.data(),"object"===_typeof(s)&&s),i.data(r,a=new l(this,t))}"string"==typeof s&&n.isFunction(e=a[s])&&e.apply(a)})},n(function(){var e='[data-toggle="qor.timepicker"]';n(document).on("disable.qor.timepicker",function(t){l.plugin.call(n(e,t.target),"destroy")}).on(t,function(t){l.plugin.call(n(e,t.target))}).triggerHandler(t)}),l}); |