/*! * TableCheck Widget - Copyright 2013-2014 KK VESPER - www.tablecheck.com */ /*! * Pikaday - Copyright 2013 David Bushell | BSD & MIT license | https://github.com/dbushell/Pikaday */ !function(t,e){"use strict";var n;if("object"==typeof exports){try{n=require("moment")}catch(t){}module.exports=e(n)}else"function"==typeof define&&define.amd?define(function(t){var i="moment";return n=t.defined&&t.defined(i)?t(i):void 0,e(n)}):t.Pikaday=e(t.moment)}(this,function(t){"use strict";var e="function"==typeof t,n=!!window.addEventListener,i=window.document,a=window.setTimeout,o=function(t,e,i,a){n?t.addEventListener(e,i,!!a):t.attachEvent("on"+e,i)},s=function(t,e,i,a){n?t.removeEventListener(e,i,!!a):t.detachEvent("on"+e,i)},r=function(t,e,n){var a;i.createEvent?(a=i.createEvent("HTMLEvents"),a.initEvent(e,!0,!1),a=_(a,n),t.dispatchEvent(a)):i.createEventObject&&(a=i.createEventObject(),a=_(a,n),t.fireEvent("on"+e,a))},l=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")},d=function(t,e){return(" "+t.className+" ").indexOf(" "+e+" ")!==-1},u=function(t,e){d(t,e)||(t.className=""===t.className?e:t.className+" "+e)},c=function(t,e){t.className=l((" "+t.className+" ").replace(" "+e+" "," "))},h=function(t){return/Array/.test(Object.prototype.toString.call(t))},p=function(t){return/Date/.test(Object.prototype.toString.call(t))&&!isNaN(t.getTime())},f=function(t){return t%4===0&&t%100!==0||t%400===0},m=function(t,e){return[31,f(t)?29:28,31,30,31,30,31,31,30,31,30,31][e]},g=function(t){p(t)&&t.setHours(0,0,0,0)},v=function(t,e){return t.getTime()===e.getTime()},_=function(t,e,n){var i,a;for(i in e)a=void 0!==t[i],a&&"object"==typeof e[i]&&void 0===e[i].nodeName?p(e[i])?n&&(t[i]=new Date(e[i].getTime())):h(e[i])?n&&(t[i]=e[i].slice(0)):t[i]=_({},e[i],n):!n&&a||(t[i]=e[i]);return t},y={field:null,bound:void 0,format:"YYYY-MM-DD",defaultDate:null,setDefaultDate:!1,firstDay:0,minDate:null,maxDate:null,yearRange:10,minYear:0,maxYear:9999,minMonth:void 0,maxMonth:void 0,isRTL:!1,yearSuffix:"",showMonthAfterYear:!1,numberOfMonths:1,i18n:{previousMonth:"Previous Month",nextMonth:"Next Month",months:["January","February","March","April","May","June","July","August","September","October","November","December"],weekdays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdaysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},onSelect:null,onOpen:null,onClose:null,onDraw:null},b=function(t,e,n){for(e+=t.firstDay;e>=7;)e-=7;return n?t.i18n.weekdaysShort[e]:t.i18n.weekdays[e]},w=function(t,e,n,i,a){if(a)return'';var o=[];return i&&o.push("is-disabled"),n&&o.push("is-today"),e&&o.push("is-selected"),'"},D=function(t,e){return""+(e?t.reverse():t).join("")+""},j=function(t){return""+t.join("")+""},k=function(t){var e,n=[];for(e=0;e<7;e++)n.push(''+b(t,e,!0)+"");return""+(t.isRTL?n.reverse():n).join("")+""},M=function(t){var e,n,i,a,o,s=t._o,r=t._m,l=t._y,d=l===s.minYear,u=l===s.maxYear,c='
',p=!0,f=!0;for(i=[],e=0;e<12;e++)i.push('");for(a='
'+s.i18n.months[r]+'
",h(s.yearRange)?(e=s.yearRange[0],n=s.yearRange[1]+1):(e=l-s.yearRange,n=1+l+s.yearRange),i=[];e=s.minYear&&i.push('");return o='
'+l+s.yearSuffix+'
",c+=s.showMonthAfterYear?o+a:a+o,d&&(0===r||s.minMonth>=r)&&(p=!1),u&&(11===r||s.maxMonth<=r)&&(f=!1),c+='",c+='",c+="
"},I=function(t,e){return''+k(t)+j(e)+"
"},T=function(s){var r=this,l=r.config(s);r._onMouseDown=function(t){if(r._v){t=t||window.event;var e=t.target||t.srcElement;if(e){if(!d(e,"is-disabled")){if(d(e,"pika-button")&&!d(e,"is-empty"))return r.setDate(new Date(r._y,r._m,parseInt(e.innerHTML,10))),void(l.bound&&a(function(){r.hide()},100));d(e,"pika-prev")?r.prevMonth():d(e,"pika-next")&&r.nextMonth()}if(d(e,"pika-select"))r._c=!0;else{if(!t.preventDefault)return t.returnValue=!1,!1;t.preventDefault()}}}},r._onChange=function(t){t=t||window.event;var e=t.target||t.srcElement;e&&(d(e,"pika-select-month")?r.gotoMonth(e.value):d(e,"pika-select-year")&&r.gotoYear(e.value))},r._onInputChange=function(n){var i;n.firedBy!==r&&(e?(i=t(l.field.value,l.format),i=i&&i.isValid()?i.toDate():null):i=new Date(Date.parse(l.field.value)),r.setDate(p(i)?i:null),r._v||r.show())},r._onInputFocus=function(){r.show()},r._onInputClick=function(){r.show()},r._onInputBlur=function(){r._c||(r._b=a(function(){r.hide()},50)),r._c=!1},r._onClick=function(t){t=t||window.event;var e=t.target||t.srcElement,i=e;if(e){!n&&d(e,"pika-select")&&(e.onchange||(e.setAttribute("onchange","return;"),o(e,"change",r._onChange)));do if(d(i,"pika-single"))return;while(i=i.parentNode);r._v&&e!==l.trigger&&r.hide()}},r.el=i.createElement("div"),r.el.className="pika-single"+(l.isRTL?" is-rtl":""),o(r.el,"mousedown",r._onMouseDown,!0),o(r.el,"change",r._onChange),l.field&&(l.bound?i.body.appendChild(r.el):l.field.parentNode.insertBefore(r.el,l.field.nextSibling),o(l.field,"change",r._onInputChange),l.defaultDate||(e&&l.field.value?l.defaultDate=t(l.field.value,l.format).toDate():l.defaultDate=new Date(Date.parse(l.field.value)),l.setDefaultDate=!0));var u=l.defaultDate;p(u)?l.setDefaultDate?r.setDate(u,!0):r.gotoDate(u):r.gotoDate(new Date),l.bound?(this.hide(),r.el.className+=" is-bound",o(l.trigger,"click",r._onInputClick),o(l.trigger,"focus",r._onInputFocus),o(l.trigger,"blur",r._onInputBlur)):this.show()};return T.prototype={config:function(t){this._o||(this._o=_({},y,!0));var e=_(this._o,t,!0);e.isRTL=!!e.isRTL,e.field=e.field&&e.field.nodeName?e.field:null,e.bound=!!(void 0!==e.bound?e.field&&e.bound:e.field),e.trigger=e.trigger&&e.trigger.nodeName?e.trigger:e.field;var n=parseInt(e.numberOfMonths,10)||1;if(e.numberOfMonths=n>4?4:n,p(e.minDate)||(e.minDate=!1),p(e.maxDate)||(e.maxDate=!1),e.minDate&&e.maxDate&&e.maxDate100&&(e.yearRange=100);return e},toString:function(n){return p(this._d)?e?t(this._d).format(n||this._o.format):this._d.yyyymmdd():""},getMoment:function(){return e?t(this._d):null},setMoment:function(n){e&&t.isMoment(n)&&this.setDate(n.toDate())},getDate:function(){return p(this._d)?new Date(this._d.getTime()):null},setDate:function(t,e){if(!t)return this._d=null,this.draw();if("string"==typeof t&&(t=new Date(Date.parse(t))),p(t)){var n=this._o.minDate,i=this._o.maxDate;p(n)&&ti&&(t=i),this._d=new Date(t.getTime()),g(this._d),this.gotoDate(this._d),this._o.field&&(this._o.field.value=this.toString(),r(this._o.field,"change",{firedBy:this})),e||"function"!=typeof this._o.onSelect||this._o.onSelect.call(this,this.getDate())}},gotoDate:function(t){p(t)&&(this._y=t.getFullYear(),this._m=t.getMonth(),this.draw())},gotoToday:function(){this.gotoDate(new Date)},gotoMonth:function(t){isNaN(t=parseInt(t,10))||(this._m=t<0?0:t>11?11:t,this.draw())},nextMonth:function(){++this._m>11&&(this._m=0,this._y++),this.draw()},prevMonth:function(){--this._m<0&&(this._m=11,this._y--),this.draw()},gotoYear:function(t){isNaN(t)||(this._y=parseInt(t,10),this.draw())},setMinDate:function(t){this._o.minDate=t},setMaxDate:function(t){this._o.maxDate=t},draw:function(t){if(this._v||t){var e=this._o,n=e.minYear,i=e.maxYear,o=e.minMonth,s=e.maxMonth;if(this._y<=n&&(this._y=n,!isNaN(o)&&this._m=i&&(this._y=i,!isNaN(s)&&this._m>s&&(this._m=s)),this.el.innerHTML=M(this)+this.render(this._y,this._m),e.bound&&(this.adjustPosition(),"hidden"!==e.field.type&&a(function(){e.trigger.focus()},1)),"function"==typeof this._o.onDraw){var r=this;a(function(){r._o.onDraw.call(r)},0)}}},adjustPosition:function(){var t,e,n,a=this._o.trigger,o=a,s=this.el.offsetWidth,r=this.el.offsetHeight,l=window.innerWidth||i.documentElement.clientWidth,d=window.innerHeight||i.documentElement.clientHeight,u=window.pageYOffset||i.body.scrollTop||i.documentElement.scrollTop;if("function"==typeof a.getBoundingClientRect)n=a.getBoundingClientRect(),t=n.left+window.pageXOffset,e=n.bottom+window.pageYOffset;else for(t=o.offsetLeft,e=o.offsetTop+o.offsetHeight;o=o.offsetParent;)t+=o.offsetLeft,e+=o.offsetTop;t+s>l&&(t=t-s+a.offsetWidth),e+r>d+u&&(e=e-r-a.offsetHeight),this.el.style.cssText="position:absolute;left:"+t+"px;top:"+e+"px;"},render:function(t,e){var n=this._o,i=new Date,a=m(t,e),o=new Date(t,e,1).getDay(),s=[],r=[];g(i),n.firstDay>0&&(o-=n.firstDay,o<0&&(o+=7));for(var l=a+o,d=l;d>7;)d-=7;l+=7-d;for(var u=0,c=0;un.maxDate,_=!!p(this._d)&&v(h,this._d),y=v(h,i),b=u=a+o;r.push(w(1+(u-o),_,y,f,b)),7===++c&&(s.push(D(r,n.isRTL)),r=[],c=0)}return I(n,s)},isVisible:function(){return this._v},show:function(){this._v||(this._o.bound&&o(i,"click",this._onClick),c(this.el,"is-hidden"),this._v=!0,this.draw(),"function"==typeof this._o.onOpen&&this._o.onOpen.call(this))},hide:function(){var t=this._v;t!==!1&&(this._o.bound&&s(i,"click",this._onClick),this.el.style.cssText="",u(this.el,"is-hidden"),this._v=!1,void 0!==t&&"function"==typeof this._o.onClose&&this._o.onClose.call(this))},destroy:function(){this.hide(),s(this.el,"mousedown",this._onMouseDown,!0),s(this.el,"change",this._onChange),this._o.field&&(s(this._o.field,"change",this._onInputChange),this._o.bound&&(s(this._o.trigger,"click",this._onInputClick),s(this._o.trigger,"focus",this._onInputFocus),s(this._o.trigger,"blur",this._onInputBlur))),this.el.parentNode&&this.el.parentNode.removeChild(this.el)}},T}),/*! * Pikaday jQuery plugin - Copyright 2013 David Bushell | BSD & MIT license | https://github.com/dbushell/Pikaday */ Pikaday.jqueryPlugin=function(t,e){"use strict";t.fn.pikaday=function(){var n=arguments;return n&&n.length||(n=[{}]),this.each(function(){var i=t(this),a=i.data("pikaday");if(a instanceof e)"string"==typeof n[0]&&"function"==typeof a[n[0]]&&a[n[0]].apply(a,Array.prototype.slice.call(n,1));else if("object"==typeof n[0]){var o=t.extend({},n[0]);o.field=i[0],i.data("pikaday",new e(o))}})}},function(){window.WidgetI18n=function(){function t(){}return t.jQ=null,t.reset=function(){return this.defaultLocale="en",this.locale="en",this.fallbacks=!1},t.locales={},t.locales.get=function(e){var n;return n=this[e]||this[t.locale]||this["default"],"function"==typeof n&&(n=n(e)),n instanceof Array||(n=[n]),n},t.locales["default"]=function(e){var n,i,a;return a=[],i=[],n=void 0,e&&a.push(e),!e&&t.locale&&a.push(t.locale),t.fallbacks&&t.defaultLocale&&a.push(t.defaultLocale),t.jQ.each(a,function(e,a){if(n=a.split("-")[0],~t.jQ.inArray(a,i)||i.push(a),t.fallbacks&&n&&n!==a&&!~t.jQ.inArray(n,i))return i.push(n)}),a.length||a.push("en"),i},t.reset(),t.currentLocale=function(){return this.locale||this.defaultLocale},t.lookup=function(t){var e,n,i,a;for(n=this.locales.get(),e=void 0,i=void 0,a=void 0;n.length;)if(e=n.shift(),i=t.split("."),a=this.translations[e]){for(;i.length&&(a=a[i.shift()],null!=a););if(null!=a)return a}return""},t.translate=function(t){var e;return e=this.lookup(t),null==e?"":e},t.t=t.translate,t}()}.call(this),WidgetI18n.translations||(WidgetI18n.translations={}),WidgetI18n.translations.en={date:{min_day_names:["Su","M","Tu","W","Th","F","Sa"],month_names:[null,"January","February","March","April","May","June","July","August","September","October","November","December"]},widget:{date:"Date",num_people:"People",person:{one:"Person",other:"People"},submit:"Book Now",table_check:"Powered By TableCheck",time:"Time",title:"Book a Reservation"}},WidgetI18n.translations.ja={date:{min_day_names:["\u65e5","\u6708","\u706b","\u6c34","\u6728","\u91d1","\u571f"],month_names:[null,"1\u6708","2\u6708","3\u6708","4\u6708","5\u6708","6\u6708","7\u6708","8\u6708","9\u6708","10\u6708","11\u6708","12\u6708"]},widget:{date:"\u65e5\u4ed8",num_people:"\u4eba\u6570",person:{one:"\u540d",other:"\u540d"},submit:"\u4e88\u7d04\u3059\u308b",table_check:"Powered By TableCheck",time:"\u6642\u9593",title:"\u4e88\u7d04\u3059\u308b"}},WidgetI18n.translations.ko={date:{min_day_names:["\uc77c","\uc6d4","\ud654","\uc218","\ubaa9","\uae08","\ud1a0"],month_names:[null,"1\uc6d4","2\uc6d4","3\uc6d4","4\uc6d4","5\uc6d4","6\uc6d4","7\uc6d4","8\uc6d4","9\uc6d4","10\uc6d4","11\uc6d4","12\uc6d4"]},widget:{date:"\ub0a0\uc9dc",num_people:"\uc778\uc6d0\uc218",person:{one:"\uba85",other:"\uba85"},submit:"\uc608\uc57d\ud55c\ub2e4",table_check:"Powered By TableCheck",time:"\uc2dc\uac04",title:"\uc608\uc57d\ud55c\ub2e4"}},WidgetI18n.translations["zh-CN"]={date:{min_day_names:["\u65e5","\u4e00","\u4e8c","\u4e09","\u56db","\u4e94","\u516d"],month_names:[null,"\u4e00\u6708","\u4e8c\u6708","\u4e09\u6708","\u56db\u6708","\u4e94\u6708","\u516d\u6708","\u4e03\u6708","\u516b\u6708","\u4e5d\u6708","\u5341\u6708","\u5341\u4e00\u6708","\u5341\u4e8c\u6708"]},widget:{date:"\u65e5\u671f",num_people:"\u4eba\u6570",person:{one:"\u4f4d",other:"\u4f4d"},submit:"\u9001\u51fa\u9884\u7ea6",table_check:"Powered By TableCheck",time:"\u65f6\u95f4",title:"\u8ba2\u4f4d"}},WidgetI18n.translations["zh-TW"]={date:{min_day_names:["\u65e5","\u4e00","\u4e8c","\u4e09","\u56db","\u4e94","\u516d"],month_names:[null,"\u4e00\u6708","\u4e8c\u6708","\u4e09\u6708","\u56db\u6708","\u4e94\u6708","\u516d\u6708","\u4e03\u6708","\u516b\u6708","\u4e5d\u6708","\u5341\u6708","\u5341\u4e00\u6708","\u5341\u4e8c\u6708"]},widget:{date:"\u65e5\u671f",num_people:"\u4eba\u6578",person:{one:"\u4f4d",other:"\u4f4d"},submit:"\u9001\u51fa\u9810\u7d04",table_check:"Powered By TableCheck",time:"\u6642\u9593",title:"\u8a02\u4f4d"}},WidgetI18n.translations.de={date:{min_day_names:["So","Mo","Di","Mi","Do","F","Sa"],month_names:[null,"Januar","Februar","M\xe4rz","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"]},widget:{date:"Datum",num_people:"Personen",person:{one:"Person",other:"Personen"},submit:"Tisch suchen",table_check:"bereitgestellt von TableCheck",time:"Zeit",title:"Jetzt Reservieren"}},WidgetI18n.translations.es={date:{min_day_names:["d","l","ma","me","j","v","s"],month_names:[null,"enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre"]},widget:{date:"Fecha",num_people:"Personas",person:{one:"persona",other:"personas"},submit:"Reservar",table_check:"Impulsado por TableCheck",time:"Hora",title:"Buscar una mesa"}},WidgetI18n.translations.fr={date:{min_day_names:["d","l","ma","me","j","v","s"],month_names:[null,"janvier","f\xe9vrier","mars","avril","mai","juin","juillet","ao\xfbt","septembre","octobre","novembre","d\xe9cembre"]},widget:{date:"Date",num_people:"Pers.",person:{one:"Pers.",other:"Pers."},submit:"R\xe9server",table_check:"Propuls\xe9 par TableCheck",time:"Heure",title:"R\xe9servations"}},WidgetI18n.translations.it={date:{min_day_names:["d","l","ma","me","g","v","s"],month_names:[null,"gennaio","febbraio","marzo","aprile","maggio","giugno","luglio","agosto","settembre","ottobre","novembre","dicembre"]},widget:{date:"Data",num_people:"Persone",person:{one:"Persona",other:"Persone"},submit:"Prenota ora",table_check:"Offerto da TableCheck",time:"Ora",title:"Faiuna prenotazione"}},function(){var t=[].slice;window.TCWidget=function(){function e(){}var n,i,a,o;return Date.prototype.addMinutes=function(t){return this.setMinutes(this.getMinutes()+t),this},Date.prototype.yyyymmdd=function(){var t,e,n;return n=this.getFullYear().toString(),e=(this.getMonth()+1).toString(),t=this.getDate().toString(),n+"-"+(e[1]?e:"0"+e[0])+"-"+(t[1]?t:"0"+t[0])},e.DOMAIN_PRODUCTION="https://www.tablecheck.com/",e.DOMAIN_STAGING="http://staging.tablecheck.com/tablecheck/",e.JQUERY_MIN_VERSION=[1,6],e.DEFAULT_TIME=68400,e.LANGUAGES=["en","de","es","fr","it","ja","ko","zh-CN","zh-TW"],e.MAX_DP_RETRIES=3,e.jQ=null,e.env="production",e.layout=null,e.theme=null,e.timeInterval=null,e.calendar=null,e.dpRetries=0,e.t=function(){var e;return e=1<=arguments.length?t.call(arguments,0):[],WidgetI18n.t.apply(WidgetI18n,e)},e.init=function(){return this.initPikaday(),this.initI18n(),this.initWidget(),this.initDatePicker()},e.initPikaday=function(){return Pikaday.jqueryPlugin(this.jQ,Pikaday)},e.initI18n=function(){return WidgetI18n.jQ=this.jQ,WidgetI18n.locale="ja",WidgetI18n.defaultLocale="ja"},e.initWidget=function(){var t,e,n,i,a,o,s;return t=this.jQ("#tc-widget2"),this.env=t.data("env")||"production",this.layout=t.data("layout")||"vertical",this.theme=t.data("theme")||"basic",this.timeInterval=this.normalizeInterval(t.data("time-interval")),n=t.data("franchise-id"),e=t.data("chain-id"),s=t.data("shop-id"),i=this.detect_resource(n,e,s),o=i[0],a=i[1],this.calendar="calendar"===this.layout?"inline":"popup",this.setLocale(t.data("lang"),t.data("autolang")),this.renderWidget(o,a)},e.normalizeInterval=function(t){switch(t){case 15:case 30:case 60:return t;case 900:case 1800:case 3600:return t/60;default:return 15}},e.setLocale=function(t,n){var i;return i=(navigator.language||navigator.userLanguage).split("-")[0],n&&this.jQ.inArray(i,e.LANGUAGES)!==-1?WidgetI18n.locale=i:this.jQ.inArray(t,e.LANGUAGES)!==-1?WidgetI18n.locale=t:void 0},e.getDomain=function(){return"production"===this.env&&(this.domain||(this.domain=e.DOMAIN_PRODUCTION)),this.jQ(".tc-widget2[data-domain]")[0]&&(this.domain||(this.domain=this.jQ(".tc-widget2").data("domain"))),this.domain||(this.domain=e.DOMAIN_STAGING),this.domain},e.getUrl=function(t){return this.getDomain()+WidgetI18n.locale+"/"+(t||"")},e.detect_resource=function(t,e,n){var i,a;return i=t||e||n,a=null!=t?"franchise":null!=e?"chain":"shop",[a,i]},e.renderWidget=function(t,e){return this.appendCSS(),this.jQ("#tc-widget2").html(this.generateWidget(t,e)),this.initDatePicker(),this.bindEvents()},e.cssURL=function(){var t;switch(t="/tc_widget/tc_widget.css",this.env){case"production":return"https://vesper-widget.s3.amazonaws.com"+t;case"staging":return"https://vesper-staging-widget.s3.amazonaws.com"+t;default:return window.location.protocol+"//"+window.location.host+"/assets/widget/tc_widget.css"}},e.appendCSS=function(){var t;if("production"===this.env||"staging"===this.env)return t=this.jQ("",{rel:"stylesheet",type:"text/css",href:this.cssURL()}),this.jQ(t).appendTo("head")},e.generateWidget=function(t,e){var n,i,a,o,s,r;return o=this.jQ("
").addClass("tc-wrap"),a=this.jQ("
").addClass("tc-header").append(this.jQ("
").addClass("tc-h1").append(this.t("widget.title"))),r=this.jQ("
").addClass("tc-body"),i=this.jQ("
").attr({action:this.getUrl("shops/"+e+"/reserve"),"accept-charset":"UTF-8",method:"post",target:"_blank"}),s=this.jQ("
").addClass("tc-wrap-book").append(this.jQ("").attr({type:"submit",value:this.t("widget.submit")}).addClass("tc-book")),n=this.jQ("
").addClass("tc-content"),"shop"!==t&&this.addShopSelector(t,e,n),n.append(this.addDatepicker()),n.append(this.addTimepicker()),n.append(this.addPeople()),o.append(a),i.append(n),i.append(s),r.append(i),o.append(r),o},e.bindEvents=function(){return this.jQ("#tc-widget2 form input:submit").click(function(t){return function(){return t.setData()}}(this))},e.setData=function(){if(!this.jQ(".tc-date input").length)return this.jQ(".tc-date-inline").append(this.jQ("").attr({type:"hidden",id:"reservation_start_date",name:"reservation[start_date]",value:this.jQ(".tc-date-inline").val()}))},e.addDatepicker=function(){var t,e;return e=this.jQ("
").addClass("tc-date"),"inline"!==this.calendar?(e.append(''),t=this.jQ('
').append(""),e.append(t)):(e.addClass("tc-date-inline"),e.append("")),e},e.addTimepicker=function(){var t,e,n,i;return i=this.jQ("
"),n=this.getTimeSlots(),e=this.jQ(""),e.append(""),this.jQ.each(n,function(){return e.append("")}),i.append(''),t=this.jQ('
').append(e),i.append(t),i},e.addPeople=function(){var t,e,n,i,a,o;for(i=this.jQ("
"),a=this.jQ(''),a.append(""),e=n=1;n<=20;e=++n)o=e+" "+this.t("widget.person."+(1===e?"one":"other")),a.append("");return i.append(''),t=this.jQ('
').append(a),i.append(t),i},e.addShopSelector=function(t,n,i){return e.fetchShops(t,n,function(t){return i.prepend(e.createShopSelector(t)),e.setShop()})},e.fetchShops=function(t,e,n){var i;return i=this.getUrl("widget/"+t+"s/"+e+".json"),this.jQ.ajax({url:i,type:"GET",dataType:"jsonp",success:function(t){if(null!==t.shops)return n(t.shops)}})},e.createShopSelector=function(t){var n,i;return i=e.jQ("
"),n=e.jQ(""),t&&(e.jQ.each(t,function(t,e){return n.append("")}),i.append(n)),n.on("change",e.setShop),i},e.setShop=function(){var t,n;return n=e.jQ("#tc-widget2 .tc-shop select#shop_id").val(),t=e.getUrl("shops/"+n+"/reserve"),e.jQ("#tc-widget2 .tc-body form").attr("action",t)},e.getTimeSlots=function(){var t,e,n,i,a,o,s;for(o=new Date(70,0,1,11,0,0),s=[],t=e=0,a=720/this.timeInterval;0<=a?e<=a:e>=a;t=0<=a?++e:--e)n=o.getHours()+":"+this.padZero(o.getMinutes()),i=3600*o.getHours()+60*o.getMinutes(),s.push([n,i]),o=o.addMinutes(this.timeInterval);return s},e.initDatePicker=function(){var t;return t=this.jQ("#tc-widget2").find("input#reservation_start_date")[0]||this.jQ("#tc-widget2").find(".tc-date-inline")[0],this.jQ(t).pikaday(this.dpOptions())},e.dpOptions=function(){return{format:"YYYY-MM-DD",minDate:new Date,i18n:this.dpI18n(),bound:"popup"===this.calendar}},e.dpI18n=function(){return{months:this.t("date.month_names").slice(1),weekdays:this.t("date.min_day_names"),weekdaysShort:this.t("date.min_day_names")}},e.padZero=function(t){return t<10?"0"+t:t},e.ieLoadBugFix=function(t,n){return"loaded"===t.readyState||"completed"===t.readyState?n():setTimeout(function(){return e.ieLoadBugFix(t,n)},100)},e.jQueryValid=function(t){var e,n,i,a,o,s,r,l;if(null!=t&&null!=t.fn.jquery){if(s=t.fn.jquery.match(/^(\d+)\.(\d+)/),!s||!(s.length=3))return!1;if(i=s.slice(1,3),r=i[0],l=i[1],a=[parseInt(r,10),parseInt(l,10)],r=a[0],l=a[1],o=this.JQUERY_MIN_VERSION,e=o[0],n=o[1],r>e||r===e&&l>=n)return!0}return!1},e.jQueryValid(window.jQuery)?window.jQuery(function(){return e.jQ=window.jQuery,e.init()}):(o="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js",n=document.getElementsByTagName("head")[0]||document.documentElement,a=document.createElement("script"),a.type="text/javascript",a.src=o,i=function(){return e.jQ=window.jQuery.noConflict(!0),e.init()},null!=a.addEventListener?a.addEventListener("load",i,!1):a.onreadystatechange=function(){return a.onreadystatechange=null,e.ieLoadBugFix(a,i)},n.appendChild(a)),e}()}.call(this);