/* Copyright (C) Federico Zivolo 2018 Distributed under the MIT License (license terms are at http://opensource.org/licenses/MIT). */(function(e,t){'object'==typeof exports&&'undefined'!=typeof module?module.exports=t():'function'==typeof define&&define.amd?define(t):e.Popper=t()})(this,function(){'use strict';function e(e){return e&&'[object Function]'==={}.toString.call(e)}function t(e,t){if(1!==e.nodeType)return[];var o=getComputedStyle(e,null);return t?o[t]:o}function o(e){return'HTML'===e.nodeName?e:e.parentNode||e.host}function n(e){if(!e)return document.body;switch(e.nodeName){case'HTML':case'BODY':return e.ownerDocument.body;case'#document':return e.body;}var i=t(e),r=i.overflow,p=i.overflowX,s=i.overflowY;return /(auto|scroll|overlay)/.test(r+s+p)?e:n(o(e))}function r(e){if(!e)return document.documentElement;for(var o=ie(10)?document.body:null,n=e.offsetParent;n===o&&e.nextElementSibling;)n=(e=e.nextElementSibling).offsetParent;var i=n&&n.nodeName;return i&&'BODY'!==i&&'HTML'!==i?-1!==['TD','TABLE'].indexOf(n.nodeName)&&'static'===t(n,'position')?r(n):n:e?e.ownerDocument.documentElement:document.documentElement}function p(e){var t=e.nodeName;return'BODY'!==t&&('HTML'===t||r(e.firstElementChild)===e)}function s(e){return null===e.parentNode?e:s(e.parentNode)}function d(e,t){if(!e||!e.nodeType||!t||!t.nodeType)return document.documentElement;var o=e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING,n=o?e:t,i=o?t:e,a=document.createRange();a.setStart(n,0),a.setEnd(i,0);var l=a.commonAncestorContainer;if(e!==l&&t!==l||n.contains(i))return p(l)?l:r(l);var f=s(e);return f.host?d(f.host,t):d(e,s(t).host)}function a(e){var t=1=o.clientWidth&&n>=o.clientHeight}),l=0n[e]&&!t.escapeWithReference&&(i=X(p[o],n[e]-('right'===e?p.width:p.height))),se({},o,i)}};return i.forEach(function(e){var t=-1===['left','top'].indexOf(e)?'secondary':'primary';p=de({},p,s[t](e))}),e.offsets.popper=p,e},priority:['left','right','top','bottom'],padding:5,boundariesElement:'scrollParent'},keepTogether:{order:400,enabled:!0,fn:function(e){var t=e.offsets,o=t.popper,n=t.reference,i=e.placement.split('-')[0],r=J,p=-1!==['top','bottom'].indexOf(i),s=p?'right':'bottom',d=p?'left':'top',a=p?'width':'height';return o[s]r(n[s])&&(e.offsets.popper[d]=r(n[s])),e}},arrow:{order:500,enabled:!0,fn:function(e,o){var n;if(!q(e.instance.modifiers,'arrow','keepTogether'))return e;var i=o.element;if('string'==typeof i){if(i=e.instance.popper.querySelector(i),!i)return e;}else if(!e.instance.popper.contains(i))return console.warn('WARNING: `arrow.element` must be child of its popper element!'),e;var r=e.placement.split('-')[0],p=e.offsets,s=p.popper,d=p.reference,a=-1!==['left','right'].indexOf(r),l=a?'height':'width',f=a?'Top':'Left',m=f.toLowerCase(),h=a?'left':'top',g=a?'bottom':'right',u=L(i)[l];d[g]-us[g]&&(e.offsets.popper[m]+=d[m]+u-s[g]),e.offsets.popper=c(e.offsets.popper);var b=d[m]+d[l]/2-u/2,y=t(e.instance.popper),w=parseFloat(y['margin'+f],10),E=parseFloat(y['border'+f+'Width'],10),v=b-e.offsets.popper[m]-w-E;return v=Q(X(s[l]-u,v),0),e.arrowElement=i,e.offsets.arrow=(n={},se(n,m,Math.round(v)),se(n,h,''),n),e},element:'[x-arrow]'},flip:{order:600,enabled:!0,fn:function(e,t){if(P(e.instance.modifiers,'inner'))return e;if(e.flipped&&e.placement===e.originalPlacement)return e;var o=E(e.instance.popper,e.instance.reference,t.padding,t.boundariesElement,e.positionFixed),n=e.placement.split('-')[0],i=S(n),r=e.placement.split('-')[1]||'',p=[];switch(t.behavior){case fe.FLIP:p=[n,i];break;case fe.CLOCKWISE:p=V(n);break;case fe.COUNTERCLOCKWISE:p=V(n,!0);break;default:p=t.behavior;}return p.forEach(function(s,d){if(n!==s||p.length===d+1)return e;n=e.placement.split('-')[0],i=S(n);var a=e.offsets.popper,l=e.offsets.reference,f=J,m='left'===n&&f(a.right)>f(l.left)||'right'===n&&f(a.left)f(l.top)||'bottom'===n&&f(a.top)f(o.right),g=f(a.top)f(o.bottom),b='left'===n&&h||'right'===n&&c||'top'===n&&g||'bottom'===n&&u,y=-1!==['top','bottom'].indexOf(n),w=!!t.flipVariations&&(y&&'start'===r&&h||y&&'end'===r&&c||!y&&'start'===r&&g||!y&&'end'===r&&u);(m||b||w)&&(e.flipped=!0,(m||b)&&(n=p[d+1]),w&&(r=K(r)),e.placement=n+(r?'-'+r:''),e.offsets.popper=de({},e.offsets.popper,T(e.instance.popper,e.offsets.reference,e.placement)),e=N(e.instance.modifiers,e,'flip'))}),e},behavior:'flip',padding:5,boundariesElement:'viewport'},inner:{order:700,enabled:!1,fn:function(e){var t=e.placement,o=t.split('-')[0],n=e.offsets,i=n.popper,r=n.reference,p=-1!==['left','right'].indexOf(o),s=-1===['top','left'].indexOf(o);return i[p?'left':'top']=r[o]-(s?i[p?'width':'height']:0),e.placement=S(t),e.offsets.popper=c(i),e}},hide:{order:800,enabled:!0,fn:function(e){if(!q(e.instance.modifiers,'hide','preventOverflow'))return e;var t=e.offsets.reference,o=D(e.instance.modifiers,function(e){return'preventOverflow'===e.name}).boundaries;if(t.bottomo.right||t.top>o.bottom||t.rightthis._items.length-1||t<0))if(this._isSliding)P(this._element).one(Q.SLID,function(){return e.to(t)});else{if(n===t)return this.pause(),void this.cycle();var i=ndocument.documentElement.clientHeight;!this._isBodyOverflowing&&t&&(this._element.style.paddingLeft=this._scrollbarWidth+"px"),this._isBodyOverflowing&&!t&&(this._element.style.paddingRight=this._scrollbarWidth+"px")},t._resetAdjustments=function(){this._element.style.paddingLeft="",this._element.style.paddingRight=""},t._checkScrollbar=function(){var t=document.body.getBoundingClientRect();this._isBodyOverflowing=t.left+t.right
',trigger:"hover focus",title:"",delay:0,html:!(_e={AUTO:"auto",TOP:"top",RIGHT:"right",BOTTOM:"bottom",LEFT:"left"}),selector:!(de={animation:"boolean",template:"string",title:"(string|element|function)",trigger:"string",delay:"(number|object)",html:"boolean",selector:"(string|boolean)",placement:"(string|function)",offset:"(number|string)",container:"(string|element|boolean)",fallbackPlacement:"(string|array)",boundary:"(string|element)"}),placement:"top",offset:0,container:!1,fallbackPlacement:"flip",boundary:"scrollParent"},pe="out",ve={HIDE:"hide"+he,HIDDEN:"hidden"+he,SHOW:(me="show")+he,SHOWN:"shown"+he,INSERTED:"inserted"+he,CLICK:"click"+he,FOCUSIN:"focusin"+he,FOCUSOUT:"focusout"+he,MOUSEENTER:"mouseenter"+he,MOUSELEAVE:"mouseleave"+he},Ee="fade",ye="show",Te=".tooltip-inner",Ce=".arrow",Ie="hover",Ae="focus",De="click",be="manual",Se=function(){function i(t,e){if("undefined"==typeof c)throw new TypeError("Bootstrap tooltips require Popper.js (https://popper.js.org)");this._isEnabled=!0,this._timeout=0,this._hoverState="",this._activeTrigger={},this._popper=null,this.element=t,this.config=this._getConfig(e),this.tip=null,this._setListeners()}var t=i.prototype;return t.enable=function(){this._isEnabled=!0},t.disable=function(){this._isEnabled=!1},t.toggleEnabled=function(){this._isEnabled=!this._isEnabled},t.toggle=function(t){if(this._isEnabled)if(t){var e=this.constructor.DATA_KEY,n=oe(t.currentTarget).data(e);n||(n=new this.constructor(t.currentTarget,this._getDelegateConfig()),oe(t.currentTarget).data(e,n)),n._activeTrigger.click=!n._activeTrigger.click,n._isWithActiveTrigger()?n._enter(null,n):n._leave(null,n)}else{if(oe(this.getTipElement()).hasClass(ye))return void this._leave(null,this);this._enter(null,this)}},t.dispose=function(){clearTimeout(this._timeout),oe.removeData(this.element,this.constructor.DATA_KEY),oe(this.element).off(this.constructor.EVENT_KEY),oe(this.element).closest(".modal").off("hide.bs.modal"),this.tip&&oe(this.tip).remove(),this._isEnabled=null,this._timeout=null,this._hoverState=null,(this._activeTrigger=null)!==this._popper&&this._popper.destroy(),this._popper=null,this.element=null,this.config=null,this.tip=null},t.show=function(){var e=this;if("none"===oe(this.element).css("display"))throw new Error("Please use show on visible elements");var t=oe.Event(this.constructor.Event.SHOW);if(this.isWithContent()&&this._isEnabled){oe(this.element).trigger(t);var n=oe.contains(this.element.ownerDocument.documentElement,this.element);if(t.isDefaultPrevented()||!n)return;var i=this.getTipElement(),r=Cn.getUID(this.constructor.NAME);i.setAttribute("id",r),this.element.setAttribute("aria-describedby",r),this.setContent(),this.config.animation&&oe(i).addClass(Ee);var s="function"==typeof this.config.placement?this.config.placement.call(this,i,this.element):this.config.placement,o=this._getAttachment(s);this.addAttachmentClass(o);var a=!1===this.config.container?document.body:oe(this.config.container);oe(i).data(this.constructor.DATA_KEY,this),oe.contains(this.element.ownerDocument.documentElement,this.tip)||oe(i).appendTo(a),oe(this.element).trigger(this.constructor.Event.INSERTED),this._popper=new c(this.element,i,{placement:o,modifiers:{offset:{offset:this.config.offset},flip:{behavior:this.config.fallbackPlacement},arrow:{element:Ce},preventOverflow:{boundariesElement:this.config.boundary}},onCreate:function(t){t.originalPlacement!==t.placement&&e._handlePopperPlacementChange(t)},onUpdate:function(t){e._handlePopperPlacementChange(t)}}),oe(i).addClass(ye),"ontouchstart"in document.documentElement&&oe(document.body).children().on("mouseover",null,oe.noop);var l=function(){e.config.animation&&e._fixTransition();var t=e._hoverState;e._hoverState=null,oe(e.element).trigger(e.constructor.Event.SHOWN),t===pe&&e._leave(null,e)};if(oe(this.tip).hasClass(Ee)){var h=Cn.getTransitionDurationFromElement(this.tip);oe(this.tip).one(Cn.TRANSITION_END,l).emulateTransitionEnd(h)}else l()}},t.hide=function(t){var e=this,n=this.getTipElement(),i=oe.Event(this.constructor.Event.HIDE),r=function(){e._hoverState!==me&&n.parentNode&&n.parentNode.removeChild(n),e._cleanTipClass(),e.element.removeAttribute("aria-describedby"),oe(e.element).trigger(e.constructor.Event.HIDDEN),null!==e._popper&&e._popper.destroy(),t&&t()};if(oe(this.element).trigger(i),!i.isDefaultPrevented()){if(oe(n).removeClass(ye),"ontouchstart"in document.documentElement&&oe(document.body).children().off("mouseover",null,oe.noop),this._activeTrigger[De]=!1,this._activeTrigger[Ae]=!1,this._activeTrigger[Ie]=!1,oe(this.tip).hasClass(Ee)){var s=Cn.getTransitionDurationFromElement(n);oe(n).one(Cn.TRANSITION_END,r).emulateTransitionEnd(s)}else r();this._hoverState=""}},t.update=function(){null!==this._popper&&this._popper.scheduleUpdate()},t.isWithContent=function(){return Boolean(this.getTitle())},t.addAttachmentClass=function(t){oe(this.getTipElement()).addClass(ue+"-"+t)},t.getTipElement=function(){return this.tip=this.tip||oe(this.config.template)[0],this.tip},t.setContent=function(){var t=oe(this.getTipElement());this.setElementContent(t.find(Te),this.getTitle()),t.removeClass(Ee+" "+ye)},t.setElementContent=function(t,e){var n=this.config.html;"object"==typeof e&&(e.nodeType||e.jquery)?n?oe(e).parent().is(t)||t.empty().append(e):t.text(oe(e).text()):t[n?"html":"text"](e)},t.getTitle=function(){var t=this.element.getAttribute("data-original-title");return t||(t="function"==typeof this.config.title?this.config.title.call(this.element):this.config.title),t},t._getAttachment=function(t){return _e[t.toUpperCase()]},t._setListeners=function(){var i=this;this.config.trigger.split(" ").forEach(function(t){if("click"===t)oe(i.element).on(i.constructor.Event.CLICK,i.config.selector,function(t){return i.toggle(t)});else if(t!==be){var e=t===Ie?i.constructor.Event.MOUSEENTER:i.constructor.Event.FOCUSIN,n=t===Ie?i.constructor.Event.MOUSELEAVE:i.constructor.Event.FOCUSOUT;oe(i.element).on(e,i.config.selector,function(t){return i._enter(t)}).on(n,i.config.selector,function(t){return i._leave(t)})}oe(i.element).closest(".modal").on("hide.bs.modal",function(){return i.hide()})}),this.config.selector?this.config=h({},this.config,{trigger:"manual",selector:""}):this._fixTitle()},t._fixTitle=function(){var t=typeof this.element.getAttribute("data-original-title");(this.element.getAttribute("title")||"string"!==t)&&(this.element.setAttribute("data-original-title",this.element.getAttribute("title")||""),this.element.setAttribute("title",""))},t._enter=function(t,e){var n=this.constructor.DATA_KEY;(e=e||oe(t.currentTarget).data(n))||(e=new this.constructor(t.currentTarget,this._getDelegateConfig()),oe(t.currentTarget).data(n,e)),t&&(e._activeTrigger["focusin"===t.type?Ae:Ie]=!0),oe(e.getTipElement()).hasClass(ye)||e._hoverState===me?e._hoverState=me:(clearTimeout(e._timeout),e._hoverState=me,e.config.delay&&e.config.delay.show?e._timeout=setTimeout(function(){e._hoverState===me&&e.show()},e.config.delay.show):e.show())},t._leave=function(t,e){var n=this.constructor.DATA_KEY;(e=e||oe(t.currentTarget).data(n))||(e=new this.constructor(t.currentTarget,this._getDelegateConfig()),oe(t.currentTarget).data(n,e)),t&&(e._activeTrigger["focusout"===t.type?Ae:Ie]=!1),e._isWithActiveTrigger()||(clearTimeout(e._timeout),e._hoverState=pe,e.config.delay&&e.config.delay.hide?e._timeout=setTimeout(function(){e._hoverState===pe&&e.hide()},e.config.delay.hide):e.hide())},t._isWithActiveTrigger=function(){for(var t in this._activeTrigger)if(this._activeTrigger[t])return!0;return!1},t._getConfig=function(t){return"number"==typeof(t=h({},this.constructor.Default,oe(this.element).data(),t)).delay&&(t.delay={show:t.delay,hide:t.delay}),"number"==typeof t.title&&(t.title=t.title.toString()),"number"==typeof t.content&&(t.content=t.content.toString()),Cn.typeCheckConfig(ae,t,this.constructor.DefaultType),t},t._getDelegateConfig=function(){var t={};if(this.config)for(var e in this.config)this.constructor.Default[e]!==this.config[e]&&(t[e]=this.config[e]);return t},t._cleanTipClass=function(){var t=oe(this.getTipElement()),e=t.attr("class").match(fe);null!==e&&0

'}),He=h({},Nn.DefaultType,{content:"(string|element|function)"}),We="fade",xe=".popover-header",Ue=".popover-body",Ke={HIDE:"hide"+ke,HIDDEN:"hidden"+ke,SHOW:(Me="show")+ke,SHOWN:"shown"+ke,INSERTED:"inserted"+ke,CLICK:"click"+ke,FOCUSIN:"focusin"+ke,FOCUSOUT:"focusout"+ke,MOUSEENTER:"mouseenter"+ke,MOUSELEAVE:"mouseleave"+ke},Fe=function(t){var e,n;function i(){return t.apply(this,arguments)||this}n=t,(e=i).prototype=Object.create(n.prototype),(e.prototype.constructor=e).__proto__=n;var r=i.prototype;return r.isWithContent=function(){return this.getTitle()||this._getContent()},r.addAttachmentClass=function(t){we(this.getTipElement()).addClass(Le+"-"+t)},r.getTipElement=function(){return this.tip=this.tip||we(this.config.template)[0],this.tip},r.setContent=function(){var t=we(this.getTipElement());this.setElementContent(t.find(xe),this.getTitle());var e=this._getContent();"function"==typeof e&&(e=e.call(this.element)),this.setElementContent(t.find(Ue),e),t.removeClass(We+" "+Me)},r._getContent=function(){return this.element.getAttribute("data-content")||this.config.content},r._cleanTipClass=function(){var t=we(this.getTipElement()),e=t.attr("class").match(je);null!==e&&0=this._offsets[r]&&("undefined"==typeof this._offsets[r+1]||t(a||v.height())},_setFocus:function(){(b.st.focus?b.content.find(b.st.focus).eq(0):b.wrap).focus()},_onFocusIn:function(c){return c.target===b.wrap[0]||a.contains(b.wrap[0],c.target)?void 0:(b._setFocus(),!1)},_parseMarkup:function(b,c,d){var e;d.data&&(c=a.extend(d.data,c)),y(l,[b,c,d]),a.each(c,function(c,d){if(void 0===d||d===!1)return!0;if(e=c.split("_"),e.length>1){var f=b.find(p+"-"+e[0]);if(f.length>0){var g=e[1];"replaceWith"===g?f[0]!==d[0]&&f.replaceWith(d):"img"===g?f.is("img")?f.attr("src",d):f.replaceWith(a("").attr("src",d).attr("class",f.attr("class"))):f.attr(e[1],d)}}else b.find(p+"-"+c).html(d)})},_getScrollbarSize:function(){if(void 0===b.scrollbarSize){var a=document.createElement("div");a.style.cssText="width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;",document.body.appendChild(a),b.scrollbarSize=a.offsetWidth-a.clientWidth,document.body.removeChild(a)}return b.scrollbarSize}},a.magnificPopup={instance:null,proto:t.prototype,modules:[],open:function(b,c){return A(),b=b?a.extend(!0,{},b):{},b.isObj=!0,b.index=c||0,this.instance.open(b)},close:function(){return a.magnificPopup.instance&&a.magnificPopup.instance.close()},registerModule:function(b,c){c.options&&(a.magnificPopup.defaults[b]=c.options),a.extend(this.proto,c.proto),this.modules.push(b)},defaults:{disableOn:0,key:null,midClick:!1,mainClass:"",preloader:!0,focus:"",closeOnContentClick:!1,closeOnBgClick:!0,closeBtnInside:!0,showCloseBtn:!0,enableEscapeKey:!0,modal:!1,alignTop:!1,removalDelay:0,prependTo:null,fixedContentPos:"auto",fixedBgPos:"auto",overflowY:"auto",closeMarkup:'',tClose:"Close (Esc)",tLoading:"Loading...",autoFocusLast:!0}},a.fn.magnificPopup=function(c){A();var d=a(this);if("string"==typeof c)if("open"===c){var e,f=u?d.data("magnificPopup"):d[0].magnificPopup,g=parseInt(arguments[1],10)||0;f.items?e=f.items[g]:(e=d,f.delegate&&(e=e.find(f.delegate)),e=e.eq(g)),b._openClick({mfpEl:e},d,f)}else b.isOpen&&b[c].apply(b,Array.prototype.slice.call(arguments,1));else c=a.extend(!0,{},c),u?d.data("magnificPopup",c):d[0].magnificPopup=c,b.addGroup(d,c);return d};var C,D,E,F="inline",G=function(){E&&(D.after(E.addClass(C)).detach(),E=null)};a.magnificPopup.registerModule(F,{options:{hiddenClass:"hide",markup:"",tNotFound:"Content not found"},proto:{initInline:function(){b.types.push(F),w(h+"."+F,function(){G()})},getInline:function(c,d){if(G(),c.src){var e=b.st.inline,f=a(c.src);if(f.length){var g=f[0].parentNode;g&&g.tagName&&(D||(C=e.hiddenClass,D=x(C),C="mfp-"+C),E=f.after(D).detach().removeClass(C)),b.updateStatus("ready")}else b.updateStatus("error",e.tNotFound),f=a("
");return c.inlineElement=f,f}return b.updateStatus("ready"),b._parseMarkup(d,{},c),d}}});var H,I="ajax",J=function(){H&&a(document.body).removeClass(H)},K=function(){J(),b.req&&b.req.abort()};a.magnificPopup.registerModule(I,{options:{settings:null,cursor:"mfp-ajax-cur",tError:'The content could not be loaded.'},proto:{initAjax:function(){b.types.push(I),H=b.st.ajax.cursor,w(h+"."+I,K),w("BeforeChange."+I,K)},getAjax:function(c){H&&a(document.body).addClass(H),b.updateStatus("loading");var d=a.extend({url:c.src,success:function(d,e,f){var g={data:d,xhr:f};y("ParseAjax",g),b.appendContent(a(g.data),I),c.finished=!0,J(),b._setFocus(),setTimeout(function(){b.wrap.addClass(q)},16),b.updateStatus("ready"),y("AjaxContentAdded")},error:function(){J(),c.finished=c.loadError=!0,b.updateStatus("error",b.st.ajax.tError.replace("%url%",c.src))}},b.st.ajax.settings);return b.req=a.ajax(d),""}}});var L,M=function(c){if(c.data&&void 0!==c.data.title)return c.data.title;var d=b.st.image.titleSrc;if(d){if(a.isFunction(d))return d.call(b,c);if(c.el)return c.el.attr(d)||""}return""};a.magnificPopup.registerModule("image",{options:{markup:'
',cursor:"mfp-zoom-out-cur",titleSrc:"title",verticalFit:!0,tError:'The image could not be loaded.'},proto:{initImage:function(){var c=b.st.image,d=".image";b.types.push("image"),w(m+d,function(){"image"===b.currItem.type&&c.cursor&&a(document.body).addClass(c.cursor)}),w(h+d,function(){c.cursor&&a(document.body).removeClass(c.cursor),v.off("resize"+p)}),w("Resize"+d,b.resizeImage),b.isLowIE&&w("AfterChange",b.resizeImage)},resizeImage:function(){var a=b.currItem;if(a&&a.img&&b.st.image.verticalFit){var c=0;b.isLowIE&&(c=parseInt(a.img.css("padding-top"),10)+parseInt(a.img.css("padding-bottom"),10)),a.img.css("max-height",b.wH-c)}},_onImageHasSize:function(a){a.img&&(a.hasSize=!0,L&&clearInterval(L),a.isCheckingImgSize=!1,y("ImageHasSize",a),a.imgHidden&&(b.content&&b.content.removeClass("mfp-loading"),a.imgHidden=!1))},findImageSize:function(a){var c=0,d=a.img[0],e=function(f){L&&clearInterval(L),L=setInterval(function(){return d.naturalWidth>0?void b._onImageHasSize(a):(c>200&&clearInterval(L),c++,void(3===c?e(10):40===c?e(50):100===c&&e(500)))},f)};e(1)},getImage:function(c,d){var e=0,f=function(){c&&(c.img[0].complete?(c.img.off(".mfploader"),c===b.currItem&&(b._onImageHasSize(c),b.updateStatus("ready")),c.hasSize=!0,c.loaded=!0,y("ImageLoadComplete")):(e++,200>e?setTimeout(f,100):g()))},g=function(){c&&(c.img.off(".mfploader"),c===b.currItem&&(b._onImageHasSize(c),b.updateStatus("error",h.tError.replace("%url%",c.src))),c.hasSize=!0,c.loaded=!0,c.loadError=!0)},h=b.st.image,i=d.find(".mfp-img");if(i.length){var j=document.createElement("img");j.className="mfp-img",c.el&&c.el.find("img").length&&(j.alt=c.el.find("img").attr("alt")),c.img=a(j).on("load.mfploader",f).on("error.mfploader",g),j.src=c.src,i.is("img")&&(c.img=c.img.clone()),j=c.img[0],j.naturalWidth>0?c.hasSize=!0:j.width||(c.hasSize=!1)}return b._parseMarkup(d,{title:M(c),img_replaceWith:c.img},c),b.resizeImage(),c.hasSize?(L&&clearInterval(L),c.loadError?(d.addClass("mfp-loading"),b.updateStatus("error",h.tError.replace("%url%",c.src))):(d.removeClass("mfp-loading"),b.updateStatus("ready")),d):(b.updateStatus("loading"),c.loading=!0,c.hasSize||(c.imgHidden=!0,d.addClass("mfp-loading"),b.findImageSize(c)),d)}}});var N,O=function(){return void 0===N&&(N=void 0!==document.createElement("p").style.MozTransform),N};a.magnificPopup.registerModule("zoom",{options:{enabled:!1,easing:"ease-in-out",duration:300,opener:function(a){return a.is("img")?a:a.find("img")}},proto:{initZoom:function(){var a,c=b.st.zoom,d=".zoom";if(c.enabled&&b.supportsTransition){var e,f,g=c.duration,j=function(a){var b=a.clone().removeAttr("style").removeAttr("class").addClass("mfp-animated-image"),d="all "+c.duration/1e3+"s "+c.easing,e={position:"fixed",zIndex:9999,left:0,top:0,"-webkit-backface-visibility":"hidden"},f="transition";return e["-webkit-"+f]=e["-moz-"+f]=e["-o-"+f]=e[f]=d,b.css(e),b},k=function(){b.content.css("visibility","visible")};w("BuildControls"+d,function(){if(b._allowZoom()){if(clearTimeout(e),b.content.css("visibility","hidden"),a=b._getItemToZoom(),!a)return void k();f=j(a),f.css(b._getOffset()),b.wrap.append(f),e=setTimeout(function(){f.css(b._getOffset(!0)),e=setTimeout(function(){k(),setTimeout(function(){f.remove(),a=f=null,y("ZoomAnimationEnded")},16)},g)},16)}}),w(i+d,function(){if(b._allowZoom()){if(clearTimeout(e),b.st.removalDelay=g,!a){if(a=b._getItemToZoom(),!a)return;f=j(a)}f.css(b._getOffset(!0)),b.wrap.append(f),b.content.css("visibility","hidden"),setTimeout(function(){f.css(b._getOffset())},16)}}),w(h+d,function(){b._allowZoom()&&(k(),f&&f.remove(),a=null)})}},_allowZoom:function(){return"image"===b.currItem.type},_getItemToZoom:function(){return b.currItem.hasSize?b.currItem.img:!1},_getOffset:function(c){var d;d=c?b.currItem.img:b.st.zoom.opener(b.currItem.el||b.currItem);var e=d.offset(),f=parseInt(d.css("padding-top"),10),g=parseInt(d.css("padding-bottom"),10);e.top-=a(window).scrollTop()-f;var h={width:d.width(),height:(u?d.innerHeight():d[0].offsetHeight)-g-f};return O()?h["-moz-transform"]=h.transform="translate("+e.left+"px,"+e.top+"px)":(h.left=e.left,h.top=e.top),h}}});var P="iframe",Q="//about:blank",R=function(a){if(b.currTemplate[P]){var c=b.currTemplate[P].find("iframe");c.length&&(a||(c[0].src=Q),b.isIE8&&c.css("display",a?"block":"none"))}};a.magnificPopup.registerModule(P,{options:{markup:'
',srcAction:"iframe_src",patterns:{youtube:{index:"youtube.com",id:"v=",src:"//www.youtube.com/embed/%id%?autoplay=1"},vimeo:{index:"vimeo.com/",id:"/",src:"//player.vimeo.com/video/%id%?autoplay=1"},gmaps:{index:"//maps.google.",src:"%id%&output=embed"}}},proto:{initIframe:function(){b.types.push(P),w("BeforeChange",function(a,b,c){b!==c&&(b===P?R():c===P&&R(!0))}),w(h+"."+P,function(){R()})},getIframe:function(c,d){var e=c.src,f=b.st.iframe;a.each(f.patterns,function(){return e.indexOf(this.index)>-1?(this.id&&(e="string"==typeof this.id?e.substr(e.lastIndexOf(this.id)+this.id.length,e.length):this.id.call(this,e)),e=this.src.replace("%id%",e),!1):void 0});var g={};return f.srcAction&&(g[f.srcAction]=e),b._parseMarkup(d,g,c),b.updateStatus("ready"),d}}});var S=function(a){var c=b.items.length;return a>c-1?a-c:0>a?c+a:a},T=function(a,b,c){return a.replace(/%curr%/gi,b+1).replace(/%total%/gi,c)};a.magnificPopup.registerModule("gallery",{options:{enabled:!1,arrowMarkup:'',preload:[0,2],navigateByImgClick:!0,arrows:!0,tPrev:"Previous (Left arrow key)",tNext:"Next (Right arrow key)",tCounter:"%curr% of %total%"},proto:{initGallery:function(){var c=b.st.gallery,e=".mfp-gallery";return b.direction=!0,c&&c.enabled?(f+=" mfp-gallery",w(m+e,function(){c.navigateByImgClick&&b.wrap.on("click"+e,".mfp-img",function(){return b.items.length>1?(b.next(),!1):void 0}),d.on("keydown"+e,function(a){37===a.keyCode?b.prev():39===a.keyCode&&b.next()})}),w("UpdateStatus"+e,function(a,c){c.text&&(c.text=T(c.text,b.currItem.index,b.items.length))}),w(l+e,function(a,d,e,f){var g=b.items.length;e.counter=g>1?T(c.tCounter,f.index,g):""}),w("BuildControls"+e,function(){if(b.items.length>1&&c.arrows&&!b.arrowLeft){var d=c.arrowMarkup,e=b.arrowLeft=a(d.replace(/%title%/gi,c.tPrev).replace(/%dir%/gi,"left")).addClass(s),f=b.arrowRight=a(d.replace(/%title%/gi,c.tNext).replace(/%dir%/gi,"right")).addClass(s);e.click(function(){b.prev()}),f.click(function(){b.next()}),b.container.append(e.add(f))}}),w(n+e,function(){b._preloadTimeout&&clearTimeout(b._preloadTimeout),b._preloadTimeout=setTimeout(function(){b.preloadNearbyImages(),b._preloadTimeout=null},16)}),void w(h+e,function(){d.off(e),b.wrap.off("click"+e),b.arrowRight=b.arrowLeft=null})):!1},next:function(){b.direction=!0,b.index=S(b.index+1),b.updateItemHTML()},prev:function(){b.direction=!1,b.index=S(b.index-1),b.updateItemHTML()},goTo:function(a){b.direction=a>=b.index,b.index=a,b.updateItemHTML()},preloadNearbyImages:function(){var a,c=b.st.gallery.preload,d=Math.min(c[0],b.items.length),e=Math.min(c[1],b.items.length);for(a=1;a<=(b.direction?e:d);a++)b._preloadItem(b.index+a);for(a=1;a<=(b.direction?d:e);a++)b._preloadItem(b.index-a)},_preloadItem:function(c){if(c=S(c),!b.items[c].preloaded){var d=b.items[c];d.parsed||(d=b.parseEl(c)),y("LazyLoad",d),"image"===d.type&&(d.img=a('').on("load.mfploader",function(){d.hasSize=!0}).on("error.mfploader",function(){d.hasSize=!0,d.loadError=!0,y("LazyLoadError",d)}).attr("src",d.src)),d.preloaded=!0}}}});var U="retina";a.magnificPopup.registerModule(U,{options:{replaceSrc:function(a){return a.src.replace(/\.\w+$/,function(a){return"@2x"+a})},ratio:1},proto:{initRetina:function(){if(window.devicePixelRatio>1){var a=b.st.retina,c=a.ratio;c=isNaN(c)?c():c,c>1&&(w("ImageHasSize."+U,function(a,b){b.img.css({"max-width":b.img[0].naturalWidth/c,width:"100%"})}),w("ElementParse."+U,function(b,d){d.src=a.replaceSrc(d,c)}))}}}}),A()}); /* end Magnific Popup */ /* Easy video background jquery plugin */ !function(){function i(){var i=navigator.userAgent.toLowerCase();return-1!=i.indexOf("msie")?parseInt(i.split("msie")[1]):!1}if(void 0==jQuery)console.log("Jquery not included!");else if(void 0==Modernizr.video)console.log("Modernizr not included!");else{var t=jQuery,e=i(),s=0,o=0;jQuery.fn.extend({ensureLoad:function(i){return this.each(function(){this.complete||4===this.readyState?i.call(this):"uninitialized"===this.readyState&&0===this.src.indexOf("data:")?(t(this).trigger("error"),i.call(this)):(t(this).one("load",i),e&&void 0!=this.src&&-1==this.src.indexOf("?")&&(this.src=this.src+"?"+(new Date).getTime()))})}}),video_background=function(i,e){return this.hidden=!1,this.$holder=i,this.id="video_background_video_"+s,s++,this.parameters={position:"absolute","z-index":"-1",video_ratio:!1,loop:!0,autoplay:!0,muted:!1,mp4:!1,webm:!1,ogg:!1,flv:!1,youtube:!1,priority:"html5",fallback_image:!1,sizing:"fill",start:0},t.each(e,t.proxy(function(i,t){this.parameters[i]=t},this)),this.$video_holder=t('
').appendTo(i).css({"z-index":this.parameters["z-index"],position:this.parameters.position,top:0,left:0,right:0,bottom:0,overflow:"hidden"}),this.ismobile=navigator.userAgent.match(/(iPad)|(iPhone)|(iPod)|(android)|(webOS)/i),this.supports_flash=9";!1!==this.parameters.mp4&&(i+=''),!1!==this.parameters.webm&&(i+=''),!1!==this.parameters.ogg&&(i+=''),this.$video=t(i+"").css({position:"absolute"}),this.$video_holder.append(this.$video),this.video=this.$video.get(0),!1!==this.parameters.video_ratio&&(this.resize_timeout=!1,t(window).resize(t.proxy(function(){clearTimeout(this.resize_timeout),this.resize_timeout=setTimeout(t.proxy(this.video_resize,this),10)},this)),this.video_resize()),this.parameters.muted&&this.mute()},video_resize:function(){var i=this.$video_holder.width(),t=this.$video_holder.height(),e=i,s=i/this.parameters.video_ratio;t>s&&(s=t,e=t*this.parameters.video_ratio),s=Math.ceil(s),e=Math.ceil(e),t=Math.round(t/2-s/2),i=Math.round(i/2-e/2),this.$video.attr("width",e),this.$video.attr("height",s),this.$video.css({top:t+"px",left:i+"px"})},make_youtube:function(){var i=t("html");if(this.$video=t('
').appendTo(this.$video_holder).css({position:"absolute"}),this.youtube_ready=!1,0==o){var e=document.createElement("script");e.src="https://www.youtube.com/iframe_api";var s=document.getElementsByTagName("script")[0];s.parentNode.insertBefore(e,s),o=1,window.onYouTubeIframeAPIReady=t.proxy(function(){i.trigger("yt_loaded"),this.build_youtube(),o=2},this)}else 1==o?i.bind("yt_loaded",t.proxy(this.build_youtube,this)):2==o&&this.build_youtube()},build_youtube:function(){var i={loop:this.parameters.loop?1:0,start:this.parameters.start,autoplay:this.parameters.autoplay?1:0,controls:0,showinfo:0,wmode:"transparent",iv_load_policy:3,modestbranding:1,rel:0};this.parameters.loop&&(i.playlist=this.parameters.youtube),this.player=new YT.Player(this.id+"_yt",{height:"100%",width:"100%",playerVars:i,videoId:this.parameters.youtube,events:{onReady:t.proxy(this.youtube_ready_fun,this)}})},youtube_ready_fun:function(i){this.youtube_ready=!0,this.$video=t("#"+this.id+"_yt"),!1!==this.parameters.video_ratio&&(this.resize_timeout=!1,t(window).resize(t.proxy(function(){clearTimeout(this.resize_timeout),this.resize_timeout=setTimeout(t.proxy(this.video_resize,this),10)},this)),this.video_resize()),this.parameters.muted&&this.mute()},make_flash:function(){var i={url:0!=this.parameters.mp4?this.parameters.mp4:this.parameters.flv,loop:this.parameters.loop,autoplay:this.parameters.autoplay,muted:this.parameters.muted};this.$video_holder.append('
'),swfobject.embedSWF("flash/video.swf",this.id+"_flash","100%","100%","9.0",null,i,{allowfullscreen:!0,allowScriptAccess:"always",wmode:"transparent"},{name:"background-video-swf"},t.proxy(this.flash_callback,this))},flash_callback:function(i){this.video=t(i.target).get(0),this.parameters.muted&&this.mute()},make_image:function(){!1!==this.parameters.fallback_image&&(this.$img=t('').appendTo(this.$video_holder).css({position:"absolute"}),this.$img.ensureLoad(t.proxy(this.image_loaded,this)))},image_loaded:function(){this.original_width=this.$img.width(),this.original_height=this.$img.height(),this.resize_timeout=!1,t(window).resize(t.proxy(function(){clearTimeout(this.resize_timeout),this.resize_timeout=setTimeout(t.proxy(this.image_resize,this),10)},this)),this.image_resize()},image_resize:function(){var i=this.$video_holder.width(),t=this.$video_holder.height(),e=i,s=this.original_height/(this.original_width/i);("adjust"==this.parameters.sizing&&s>t||"fill"==this.parameters.sizing&&t>s)&&(s=t,e=this.original_width/(this.original_height/t)),s=Math.ceil(s),e=Math.ceil(e),t=Math.round(t/2-s/2),i=Math.round(i/2-e/2),this.$img.css({width:e+"px",height:s+"px",top:t+"px",left:i+"px"})},isPlaying:function(){return"html5"==this.decision?!this.video.paused:"flash"==this.decision?video.isPlaying():"youtube"==this.decision&&this.youtube_ready?1===this.player.getPlayerState():!1},play:function(){"html5"==this.decision?this.video.play():"flash"==this.decision?this.video.resume():"youtube"==this.decision&&this.youtube_ready&&this.player.playVideo()},pause:function(){"html5"==this.decision||"flash"==this.decision?this.video.pause():"youtube"==this.decision&&this.youtube_ready&&this.player.pauseVideo()},toggle_play:function(){this.isPlaying()?this.pause():this.play()},isMuted:function(){return"html5"==this.decision?!this.video.volume:"flash"==this.decision?video.isMute():"youtube"==this.decision&&this.youtube_ready?this.player.isMuted():!1},mute:function(){"html5"==this.decision?this.video.volume=0:"flash"==this.decision?this.video.mute():"youtube"==this.decision&&this.youtube_ready&&this.player.mute()},unmute:function(){"html5"==this.decision?this.video.volume=1:"flash"==this.decision?this.video.unmute():"youtube"==this.decision&&this.youtube_ready&&this.player.unMute()},toggle_mute:function(){this.isMuted()?this.unmute():this.mute()},hide:function(){this.pause(),this.$video_holder.stop().fadeTo(700,0),this.hidden=!0},show:function(){this.play(),this.$video_holder.stop().fadeTo(700,1),this.hidden=!1},toogle_hidden:function(){this.hidden?this.show():this.hide()},rewind:function(){"html5"==this.decision?this.video.currentTime=0:"flash"==this.decision?this.video.rewind():"youtube"==this.decision&&this.youtube_ready&&this.player.seekTo(0)}}}}(void 0); /* end Easy video background jquery plugin */ /* SWF Object */ var swfobject=function(){function e(){if(!M){try{var e=k.getElementsByTagName("body")[0].appendChild(k.createElement("span"));e.parentNode.removeChild(e)}catch(t){return}M=!0;for(var e=O.length,n=0;e>n;n++)O[n]()}}function t(e){M?e():O[O.length]=e}function n(e){if(typeof L.addEventListener!=A)L.addEventListener("load",e,!1);else if(typeof k.addEventListener!=A)k.addEventListener("load",e,!1);else if(typeof L.attachEvent!=A)p(L,"onload",e);else if("function"==typeof L.onload){var t=L.onload;L.onload=function(){t(),e()}}else L.onload=e}function a(){var e=k.getElementsByTagName("body")[0],t=k.createElement(N);t.setAttribute("type",T);var n=e.appendChild(t);if(n){var a=0;!function(){if(typeof n.GetVariable!=A){var r=n.GetVariable("$version");r&&(r=r.split(" ")[1].split(","),R.pv=[parseInt(r[0],10),parseInt(r[1],10),parseInt(r[2],10)])}else if(10>a)return a++,void setTimeout(arguments.callee,10);e.removeChild(t),n=null,i()}()}else i()}function i(){var e=F.length;if(e>0)for(var t=0;e>t;t++){var n=F[t].id,a=F[t].callbackFn,i={success:!1,id:n};if(0R.wk)if(F[t].expressInstall&&o()){i={},i.data=F[t].expressInstall,i.width=c.getAttribute("width")||"0",i.height=c.getAttribute("height")||"0",c.getAttribute("class")&&(i.styleclass=c.getAttribute("class")),c.getAttribute("align")&&(i.align=c.getAttribute("align"));for(var d={},c=c.getElementsByTagName("param"),f=c.length,p=0;f>p;p++)"movie"!=c[p].getAttribute("name").toLowerCase()&&(d[c[p].getAttribute("name")]=c[p].getAttribute("value"));s(i,d,n,a)}else l(c),a&&a(i);else h(n,!0),a&&(i.success=!0,i.ref=r(n),a(i))}else h(n,!0),a&&((n=r(n))&&typeof n.SetVariable!=A&&(i.success=!0,i.ref=n),a(i))}}function r(e){var t=null;return(e=u(e))&&"OBJECT"==e.nodeName&&(typeof e.SetVariable!=A?t=e:(e=e.getElementsByTagName(N)[0])&&(t=e)),t}function o(){return!V&&v("6.0.65")&&(R.win||R.mac)&&!(R.wk&&312>R.wk)}function s(e,t,n,a){V=!0,b=a||null,E={success:!1,id:n};var i=u(n);i&&("OBJECT"==i.nodeName?(g=c(i),w=null):(g=i,w=n),e.id=I,(typeof e.width==A||!/%$/.test(e.width)&&310>parseInt(e.width,10))&&(e.width="310"),(typeof e.height==A||!/%$/.test(e.height)&&137>parseInt(e.height,10))&&(e.height="137"),k.title=k.title.slice(0,47)+" - Flash Player Installation",a=R.ie&&R.win?"ActiveX":"PlugIn",a="MMredirectURL="+L.location.toString().replace(/&/g,"%26")+"&MMplayerType="+a+"&MMdoctitle="+k.title,t.flashvars=typeof t.flashvars!=A?t.flashvars+("&"+a):a,R.ie&&R.win&&4!=i.readyState&&(a=k.createElement("div"),n+="SWFObjectNew",a.setAttribute("id",n),i.parentNode.insertBefore(a,i),i.style.display="none",function(){4==i.readyState?i.parentNode.removeChild(i):setTimeout(arguments.callee,10)}()),d(e,t,n))}function l(e){if(R.ie&&R.win&&4!=e.readyState){var t=k.createElement("div");e.parentNode.insertBefore(t,e),t.parentNode.replaceChild(c(e),t),e.style.display="none",function(){4==e.readyState?e.parentNode.removeChild(e):setTimeout(arguments.callee,10)}()}else e.parentNode.replaceChild(c(e),e)}function c(e){var t=k.createElement("div");if(R.win&&R.ie)t.innerHTML=e.innerHTML;else if((e=e.getElementsByTagName(N)[0])&&(e=e.childNodes))for(var n=e.length,a=0;n>a;a++)1==e[a].nodeType&&"PARAM"==e[a].nodeName||8==e[a].nodeType||t.appendChild(e[a].cloneNode(!0));return t}function d(e,t,n){var a,i=u(n);if(R.wk&&312>R.wk)return a;if(i)if(typeof e.id==A&&(e.id=n),R.ie&&R.win){var r,o="";for(r in e)e[r]!=Object.prototype[r]&&("data"==r.toLowerCase()?t.movie=e[r]:"styleclass"==r.toLowerCase()?o+=' class="'+e[r]+'"':"classid"!=r.toLowerCase()&&(o+=" "+r+'="'+e[r]+'"'));r="";for(var s in t)t[s]!=Object.prototype[s]&&(r+='');i.outerHTML='"+r+"",$[$.length]=e.id,a=u(e.id)}else{s=k.createElement(N),s.setAttribute("type",T);for(var l in e)e[l]!=Object.prototype[l]&&("styleclass"==l.toLowerCase()?s.setAttribute("class",e[l]):"classid"!=l.toLowerCase()&&s.setAttribute(l,e[l]));for(o in t)t[o]!=Object.prototype[o]&&"movie"!=o.toLowerCase()&&(e=s,r=o,l=t[o],n=k.createElement("param"),n.setAttribute("name",r),n.setAttribute("value",l),e.appendChild(n));i.parentNode.replaceChild(s,i),a=s}return a}function f(e){var t=u(e);t&&"OBJECT"==t.nodeName&&(R.ie&&R.win?(t.style.display="none",function(){if(4==t.readyState){var n=u(e);if(n){for(var a in n)"function"==typeof n[a]&&(n[a]=null);n.parentNode.removeChild(n)}}else setTimeout(arguments.callee,10)}()):t.parentNode.removeChild(t))}function u(e){var t=null;try{t=k.getElementById(e)}catch(n){}return t}function p(e,t,n){e.attachEvent(t,n),x[x.length]=[e,t,n]}function v(e){var t=R.pv;return e=e.split("."),e[0]=parseInt(e[0],10),e[1]=parseInt(e[1],10)||0,e[2]=parseInt(e[2],10)||0,t[0]>e[0]||t[0]==e[0]&&t[1]>e[1]||t[0]==e[0]&&t[1]==e[1]&&t[2]>=e[2]?!0:!1}function y(e,t,n,a){if(!R.ie||!R.mac){var i=k.getElementsByTagName("head")[0];i&&(n=n&&"string"==typeof n?n:"screen",a&&(S=C=null),C&&S==n||(a=k.createElement("style"),a.setAttribute("type","text/css"),a.setAttribute("media",n),C=i.appendChild(a),R.ie&&R.win&&typeof k.styleSheets!=A&&0\.;]/.exec(e)&&typeof encodeURIComponent!=A?encodeURIComponent(e):e}var g,w,b,E,C,S,A="undefined",N="object",T="application/x-shockwave-flash",I="SWFObjectExprInst",L=window,k=document,j=navigator,B=!1,O=[function(){B?a():i()}],F=[],$=[],x=[],M=!1,V=!1,P=!0,R=function(){var e=typeof k.getElementById!=A&&typeof k.getElementsByTagName!=A&&typeof k.createElement!=A,t=j.userAgent.toLowerCase(),n=j.platform.toLowerCase(),a=n?/win/.test(n):/win/.test(t),n=n?/mac/.test(n):/mac/.test(t),t=/webkit/.test(t)?parseFloat(t.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):!1,i=!1,r=[0,0,0],o=null;if(typeof j.plugins!=A&&typeof j.plugins["Shockwave Flash"]==N)!(o=j.plugins["Shockwave Flash"].description)||typeof j.mimeTypes!=A&&j.mimeTypes[T]&&!j.mimeTypes[T].enabledPlugin||(B=!0,i=!1,o=o.replace(/^.*\s+(\S+\s+\S+$)/,"$1"),r[0]=parseInt(o.replace(/^(.*)\..*$/,"$1"),10),r[1]=parseInt(o.replace(/^.*\.(.*)\s.*$/,"$1"),10),r[2]=/[a-zA-Z]/.test(o)?parseInt(o.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0);else if(typeof L.ActiveXObject!=A)try{var s=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");s&&(o=s.GetVariable("$version"))&&(i=!0,o=o.split(" ")[1].split(","),r=[parseInt(o[0],10),parseInt(o[1],10),parseInt(o[2],10)])}catch(l){}return{w3:e,pv:r,wk:t,ie:i,win:a,mac:n}}();return function(){R.w3&&((typeof k.readyState!=A&&"complete"==k.readyState||typeof k.readyState==A&&(k.getElementsByTagName("body")[0]||k.body))&&e(),M||(typeof k.addEventListener!=A&&k.addEventListener("DOMContentLoaded",e,!1),R.ie&&R.win&&(k.attachEvent("onreadystatechange",function(){"complete"==k.readyState&&(k.detachEvent("onreadystatechange",arguments.callee),e())}),L==top&&function(){if(!M){try{k.documentElement.doScroll("left")}catch(t){return void setTimeout(arguments.callee,0)}e()}}()),R.wk&&function(){M||(/loaded|complete/.test(k.readyState)?e():setTimeout(arguments.callee,0))}(),n(e)))}(),function(){R.ie&&R.win&&window.attachEvent("onunload",function(){for(var e=x.length,t=0;e>t;t++)x[t][0].detachEvent(x[t][1],x[t][2]);for(e=$.length,t=0;e>t;t++)f($[t]);for(var n in R)R[n]=null;R=null;for(var a in swfobject)swfobject[a]=null;swfobject=null})}(),{registerObject:function(e,t,n,a){if(R.w3&&e&&t){var i={};i.id=e,i.swfVersion=t,i.expressInstall=n,i.callbackFn=a,F[F.length]=i,h(e,!1)}else a&&a({success:!1,id:e})},getObjectById:function(e){return R.w3?r(e):void 0},embedSWF:function(e,n,a,i,r,l,c,f,u,p){var y={success:!1,id:n};R.w3&&!(R.wk&&312>R.wk)&&e&&n&&a&&i&&r?(h(n,!1),t(function(){a+="",i+="";var t={};if(u&&typeof u===N)for(var m in u)t[m]=u[m];if(t.data=e,t.width=a,t.height=i,m={},f&&typeof f===N)for(var g in f)m[g]=f[g];if(c&&typeof c===N)for(var w in c)m.flashvars=typeof m.flashvars!=A?m.flashvars+("&"+w+"="+c[w]):w+"="+c[w];if(v(r))g=d(t,m,n),t.id==n&&h(n,!0),y.success=!0,y.ref=g;else{if(l&&o())return t.data=l,void s(t,m,n,p);h(n,!0)}p&&p(y)})):p&&p(y)},switchOffAutoHideShow:function(){P=!1},ua:R,getFlashPlayerVersion:function(){return{major:R.pv[0],minor:R.pv[1],release:R.pv[2]}},hasFlashPlayerVersion:v,createSWF:function(e,t,n){return R.w3?d(e,t,n):void 0},showExpressInstall:function(e,t,n,a){R.w3&&o()&&s(e,t,n,a)},removeSWF:function(e){R.w3&&f(e)},createCSS:function(e,t,n,a){R.w3&&y(e,t,n,a)},addDomLoadEvent:t,addLoadEvent:n,getQueryParamValue:function(e){var t=k.location.search||k.location.hash;if(t){if(/\?/.test(t)&&(t=t.split("?")[1]),null==e)return m(t);for(var t=t.split("&"),n=0;n0:r.val(),f=n.errorClass,l=n.validClass,c=r.attr(n.errorAttribute)||false,h=c?"#"+c.replace(/(:|\.|\[|\])/g,"\\$1"):false,p=false,d=s({element:this,valid:true}),v=e(""),m;if(v.filter("[required]")&&v.filter("[required]").length){p=r.filter("[required]").length&&r.attr("required")!=="false"}else{p=r.attr("required")!==undefined}if(n.debug&&window.console){t.log('Validate called on "'+a+'" with regex "'+o+'". Required: '+p);t.log("Regex test: "+o.test(a)+", Pattern: "+i)}m=parseInt(r.attr("maxlength"),10);if(!isNaN(m)&&a.length>m){d.valid=false;d.tooLong=true}if(p&&!a){d.valid=false;d.valueMissing=true}else if(i&&!o.test(a)&&a){d.valid=false;d.patternMismatch=true}else{if(!n.RODom){n.markValid({element:this,validity:d,errorClass:f,validClass:l,errorID:h,settings:n})}}if(!d.valid){if(!n.RODom){n.markInvalid({element:this,validity:d,errorClass:f,validClass:l,errorID:h,settings:n})}}r.trigger("validated",d);if(u!==null&&n.alreadyCheckingRelatedRadioButtons!==true){n.alreadyCheckingRelatedRadioButtons=true;u.not(r).trigger("validate");n.alreadyCheckingRelatedRadioButtons=false}},delegateEvents:function(t,n,r,i){var s={},o=0,u=function(){i.validate.call(this,i)};e.each(n,function(e,t){if(t){s[e]=e}});for(o in s){if(s.hasOwnProperty(o)){e(r).delegate(t,s[o]+".h5Validate",u)}}return r},bindDelegation:function(t){var n=e(this),r;e.each(i,function(n,r){var i=r.toString();i=i.substring(1,i.length-1);e("."+t.classPrefix+n).attr("pattern",i)});r=n.filter("form").add(n.find("form")).add(n.parents("form"));r.attr("novalidate","novalidate").submit(u);r.find("input[formnovalidate][type='submit']").click(function(){e(this).closest("form").unbind("submit",u)});return this.each(function(){var e={focusout:t.focusout,focusin:t.focusin,change:t.change,keyup:t.keyup},n={click:t.click},r={keyup:t.activeKeyup};t.delegateEvents(":input",t.customEvents,this,t);t.delegateEvents(t.kbSelectors,e,this,t);t.delegateEvents(t.mSelectors,n,this,t);t.delegateEvents(t.activeClassSelector,r,this,t);t.delegateEvents("textarea[maxlength]",{keyup:true},this,t)})}},u=function(t){var n,r=l.call(this),i;if(r.submit!==true){return}n=e(this);i=n.h5Validate("allValid",{revalidate:r.validateOnSubmit===true});if(i!==true){t.preventDefault();if(r.focusFirstInvalidElementOnSubmit===true){var s=e(r.allValidSelectors,n).filter(function(t){return e(this).h5Validate("isValid",{revalidate:false})!==true});s.first().focus()}}return i},a=[],f=function(n){var i=e.extend({},r,n,o),s=i.classPrefix+i.activeClass;return e.extend(i,{activeClass:s,activeClassSelector:"."+s,requiredClass:i.classPrefix+i.requiredClass,el:this})},l=function(){var n=e(this).closest("[data-h5-instanceId]");return a[n.attr("data-h5-instanceId")]},c=function(n){var r=a.push(n)-1;if(n.RODom!==true){e(this).attr("data-h5-instanceId",r)}e(this).trigger("instance",{"data-h5-instanceId":r})};e.h5Validate={addPatterns:function(e){var t=r.patternLibrary,n;for(n in e){if(e.hasOwnProperty(n)){t[n]=e[n]}}return t},validValues:function(t,n){var r=0,i=n.length,s="",o;for(r=0;r1&&!e.isFunction(c)){if(s=e.extend({},u.defaults,s),"number"==typeof s.expires){var a=s.expires,d=s.expires=new Date;d.setMilliseconds(d.getMilliseconds()+864e5*a)}return document.cookie=[n(t),"=",i(c),s.expires?"; expires="+s.expires.toUTCString():"",s.path?"; path="+s.path:"",s.domain?"; domain="+s.domain:"",s.secure?"; secure":""].join("")}for(var f=t?void 0:{},p=document.cookie?document.cookie.split("; "):[],l=0,m=p.length;m>l;l++){var x=p[l].split("="),g=o(x.shift()),j=x.join("=");if(t===g){f=r(j,c);break}t||void 0===(j=r(j))||(f[g]=j)}return f};u.defaults={},e.removeCookie=function(n,o){return e.cookie(n,"",e.extend({},o,{expires:-1})),!e.cookie(n)}}); /* end jQuery cookie */ // // SmoothScroll for websites v1.4.5 (Balazs Galambosi) http://www.smoothscroll.net/ // // *** Uncoment the script to activate **** // !function(){function o(){b.keyboardSupport&&H("keydown",w)}function p(){if(!f&&document.body){f=!0;var a=document.body,e=document.documentElement,k=window.innerHeight,l=a.scrollHeight;if(g=document.compatMode.indexOf("CSS")>=0?e:a,h=a,o(),top!=self)d=!0;else if(_&&l>k&&(a.offsetHeight<=k||e.offsetHeight<=k)){var m=document.createElement("div");m.style.cssText="position:absolute; z-index:-10000; top:0; left:0; right:0; height:"+g.scrollHeight+"px",document.body.appendChild(m);var n;j=function(){n||(n=setTimeout(function(){c||(m.style.height="0",m.style.height=g.scrollHeight+"px",n=null)},500))},setTimeout(j,10),H("resize",j);var p={attributes:!0,childList:!0,characterData:!1};if(i=new R(j),i.observe(a,p),g.offsetHeight<=k){var q=document.createElement("div");q.style.clear="both",a.appendChild(q)}}b.fixedBackground||c||(a.style.backgroundAttachment="scroll",e.style.backgroundAttachment="scroll")}}function q(){i&&i.disconnect(),I(ba,v),I("mousedown",x),I("keydown",w),I("resize",j),I("load",p)}function u(a,c,d){if(K(c,d),1!=b.accelerationMax){var e=Date.now(),f=e-t;if(f1&&(g=Math.min(g,b.accelerationMax),c*=g,d*=g)}t=Date.now()}if(r.push({x:c,y:d,lastX:c<0?.99:-.99,lastY:d<0?.99:-.99,start:Date.now()}),!s){var h=a===document.body,i=function(e){for(var f=Date.now(),g=0,j=0,k=0;k=b.animationTime,o=n?1:m/b.animationTime;b.pulseAlgorithm&&(o=U(o));var p=l.x*o-l.lastX>>0,q=l.y*o-l.lastY>>0;g+=p,j+=q,l.lastX+=p,l.lastY+=q,n&&(r.splice(k,1),k--)}h?window.scrollBy(g,j):(g&&(a.scrollLeft+=g),j&&(a.scrollTop+=j)),c||d||(r=[]),r.length?Q(i,a,1e3/b.frameRate+1):s=!1};Q(i,a,0),s=!0}}function v(a){f||p();var c=a.target;if(a.defaultPrevented||a.ctrlKey)return!0;if(J(h,"embed")||J(c,"embed")&&/\.pdf/i.test(c.src)||J(h,"object")||c.shadowRoot)return!0;var e=-a.wheelDeltaX||a.deltaX||0,g=-a.wheelDeltaY||a.deltaY||0;l&&(a.wheelDeltaX&&N(a.wheelDeltaX,120)&&(e=-120*(a.wheelDeltaX/Math.abs(a.wheelDeltaX))),a.wheelDeltaY&&N(a.wheelDeltaY,120)&&(g=-120*(a.wheelDeltaY/Math.abs(a.wheelDeltaY)))),e||g||(g=-a.wheelDelta||0),1===a.deltaMode&&(e*=40,g*=40);var i=D(c);return i?!(b.touchpadSupport||!M(g))||(Math.abs(e)>1.2&&(e*=b.stepSize/120),Math.abs(g)>1.2&&(g*=b.stepSize/120),u(i,e,g),a.preventDefault(),void B()):!d||!X||(Object.defineProperty(a,"target",{value:window.frameElement}),parent.wheel(a))}function w(a){var c=a.target,e=a.ctrlKey||a.altKey||a.metaKey||a.shiftKey&&a.keyCode!==m.spacebar;document.body.contains(h)||(h=document.activeElement);var f=/^(textarea|select|embed|object)$/i,g=/^(button|submit|radio|checkbox|file|color|image)$/i;if(a.defaultPrevented||f.test(c.nodeName)||J(c,"input")&&!g.test(c.type)||J(h,"video")||P(a)||c.isContentEditable||e)return!0;if((J(c,"button")||J(c,"input")&&g.test(c.type))&&a.keyCode===m.spacebar)return!0;if(J(c,"input")&&"radio"==c.type&&n[a.keyCode])return!0;var i,j=0,k=0,l=D(h);if(!l)return!d||!X||parent.keydown(a);var o=l.clientHeight;switch(l==document.body&&(o=window.innerHeight),a.keyCode){case m.up:k=-b.arrowScroll;break;case m.down:k=b.arrowScroll;break;case m.spacebar:i=a.shiftKey?1:-1,k=-i*o*.9;break;case m.pageup:k=.9*-o;break;case m.pagedown:k=.9*o;break;case m.home:k=-l.scrollTop;break;case m.end:var p=l.scrollHeight-l.scrollTop,q=p-o;k=q>0?q+10:0;break;case m.left:j=-b.arrowScroll;break;case m.right:j=b.arrowScroll;break;default:return!0}u(l,j,k),a.preventDefault(),B()}function x(a){h=a.target}function B(){clearTimeout(A),A=setInterval(function(){z={}},1e3)}function C(a,b){for(var c=a.length;c--;)z[y(a[c])]=b;return b}function D(a){var b=[],c=document.body,e=g.scrollHeight;do{var f=z[y(a)];if(f)return C(b,f);if(b.push(a),e===a.scrollHeight){var h=F(g)&&F(c),i=h||G(g);if(d&&E(g)||!d&&i)return C(b,S())}else if(E(a)&&G(a))return C(b,a)}while(a=a.parentElement)}function E(a){return a.clientHeight+100?1:-1,b=b>0?1:-1,e.x===a&&e.y===b||(e.x=a,e.y=b,r=[],t=0)}function M(a){if(a)return k.length||(k=[a,a,a]),a=Math.abs(a),k.push(a),k.shift(),clearTimeout(L),L=setTimeout(function(){try{localStorage.SS_deltaBuffer=k.join(",")}catch(a){}},1e3),!O(120)&&!O(100)}function N(a,b){return Math.floor(a/b)==a/b}function O(a){return N(k[0],a)&&N(k[1],a)&&N(k[2],a)}function P(a){var b=a.target,c=!1;if(document.URL.indexOf("www.youtube.com/watch")!=-1)do if(c=b.classList&&b.classList.contains("html5-video-controls"))break;while(b=b.parentNode);return c}function T(a){var c,d,e;return a*=b.pulseScale,a<1?c=a-(1-Math.exp(-a)):(d=Math.exp(-1),a-=1,e=1-Math.exp(-a),c=d+e*(1-d)),c*b.pulseNormalize}function U(a){return a>=1?1:a<=0?0:(1==b.pulseNormalize&&(b.pulseNormalize/=T(1)),T(a))}function ca(c){for(var d in c)a.hasOwnProperty(d)&&(b[d]=c[d])}var h,i,j,A,L,a={frameRate:150,animationTime:400,stepSize:100,pulseAlgorithm:!0,pulseScale:4,pulseNormalize:1,accelerationDelta:50,accelerationMax:3,keyboardSupport:!0,arrowScroll:50,touchpadSupport:!1,fixedBackground:!0,excluded:""},b=a,c=!1,d=!1,e={x:0,y:0},f=!1,g=document.documentElement,k=[],l=/^Mac/.test(navigator.platform),m={left:37,up:38,right:39,down:40,spacebar:32,pageup:33,pagedown:34,end:35,home:36},n={37:1,38:1,39:1,40:1},r=[],s=!1,t=Date.now(),y=function(){var a=0;return function(b){return b.uniqueID||(b.uniqueID=a++)}}(),z={};if(window.localStorage&&localStorage.SS_deltaBuffer)try{k=localStorage.SS_deltaBuffer.split(",")}catch(a){}var ba,Q=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(a,b,c){window.setTimeout(a,c||1e3/60)}}(),R=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver,S=function(){var a;return function(){if(!a){var b=document.createElement("div");b.style.cssText="height:10000px;width:1px;",document.body.appendChild(b);var c=document.body.scrollTop;document.documentElement.scrollTop;window.scrollBy(0,3),a=document.body.scrollTop!=c?document.body:document.documentElement,window.scrollBy(0,-3),document.body.removeChild(b)}return a}}(),V=window.navigator.userAgent,W=/Edge/.test(V),X=/chrome/i.test(V)&&!W,Y=/safari/i.test(V)&&!W,Z=/mobile/i.test(V),$=/Windows NT 6.1/i.test(V)&&/rv:11/i.test(V),_=Y&&(/Version\/8/i.test(V)||/Version\/9/i.test(V)),aa=(X||Y||$)&&!Z;"onwheel"in document.createElement("div")?ba="wheel":"onmousewheel"in document.createElement("div")&&(ba="mousewheel"),ba&&aa&&(H(ba,v),H("mousedown",x),H("load",p)),ca.destroy=q,window.SmoothScrollOptions&&ca(window.SmoothScrollOptions),"function"==typeof define&&define.amd?define(function(){return ca}):"object"==typeof exports?module.exports=ca:window.SmoothScroll=ca}(); /* * jQuery appear plugin * * Copyright (c) 2012 Andrey Sidorov * licensed under MIT license. * * https://github.com/morr/jquery.appear/ * * Version: 0.3.3 */ ;(function(e){function a(){r=false;for(var n=0;n=i&&f-(n.data("appear-top-offset")||s.appear_top_offset)<=i+o.height()&&a+n.width()>=r&&a-(n.data("appear-left-offset")||s.appear_left_offset)<=r+o.width()){return true}else{return false}};e.fn.extend({appear:function(o){var u=e.extend({},i,o||{});s=u;var f=this.selector||this;if(!n){var l=function(){if(r){return}r=true;setTimeout(a,u.interval)};e(window).scroll(l).resize(l);n=true}if(u.force_process){setTimeout(a,u.interval)}t.push(f);return e(f)}});e.extend({force_appear:function(){if(n){a();return true}return false}})})(jQuery); /* jQuery SmartResize - Debounced resize event library for jQuery. * http://www.paulirish.com/2009/throttled-smartresize-jquery-event-handler/ */ ;(function(e,t){var n=function(e,t,n){var r;return function(){function u(){if(!n)e.apply(s,o);r=null}var s=this,o=arguments;if(r)clearTimeout(r);else if(n)e.apply(s,o);r=setTimeout(u,t||100)}};jQuery.fn[t]=function(e){return e?this.bind("resize",n(e)):this.trigger(t)}})(jQuery,"smartresize"); /**! * easyPieChart * Lightweight plugin to render simple, animated and retina optimized pie charts * * @license Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. * @author Robert Fleischmann (http://robert-fleischmann.de) * @version 2.0.3 **/ !function(a){var b=function(a,b){var c,d=document.createElement("canvas");"undefined"!=typeof G_vmlCanvasManager&&G_vmlCanvasManager.initElement(d);var e=d.getContext("2d");d.width=d.height=b.size,a.appendChild(d);var f=1;window.devicePixelRatio>1&&(f=window.devicePixelRatio,d.style.width=d.style.height=[b.size,"px"].join(""),d.width=d.height=b.size*f,e.scale(f,f)),e.translate(b.size/2,b.size/2),e.rotate((-0.5+b.rotate/180)*Math.PI);var g=(b.size-b.lineWidth)/2;b.scaleColor&&b.scaleLength&&(g-=b.scaleLength+2),Date.now=Date.now||function(){return+new Date};var h=function(a,b,c){c=Math.min(Math.max(0,c||1),1),e.beginPath(),e.arc(0,0,g,0,2*Math.PI*c,!1),e.strokeStyle=a,e.lineWidth=b,e.stroke()},i=function(){var a,c,d=24;e.lineWidth=1,e.fillStyle=b.scaleColor,e.save();for(var d=24;d>0;--d)0===d%6?(c=b.scaleLength,a=0):(c=.6*b.scaleLength,a=b.scaleLength-c),e.fillRect(-b.size/2+a,0,c,1),e.rotate(Math.PI/12);e.restore()},j=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(a){window.setTimeout(a,1e3/60)}}(),k=function(){b.scaleColor&&i(),b.trackColor&&h(b.trackColor,b.lineWidth)};this.clear=function(){e.clearRect(b.size/-2,b.size/-2,b.size,b.size)},this.draw=function(a){b.scaleColor||b.trackColor?e.getImageData&&e.putImageData?c?e.putImageData(c,0,0):(k(),c=e.getImageData(0,0,b.size*f,b.size*f)):(this.clear(),k()):this.clear(),e.lineCap=b.lineCap;var d;d="function"==typeof b.barColor?b.barColor(a):b.barColor,a>0&&h(d,b.lineWidth,a/100)}.bind(this),this.animate=function(a,c){var d=Date.now();b.onStart(a,c);var e=function(){var f=Math.min(Date.now()-d,b.animate),g=b.easing(this,f,a,c-a,b.animate);this.draw(g),b.onStep(a,c,g),f>=b.animate?b.onStop(a,c):j(e)}.bind(this);j(e)}.bind(this)},c=function(a,c){var d={barColor:"#ef1e25",trackColor:"#f9f9f9",scaleColor:"#dfe0e0",scaleLength:5,lineCap:"round",lineWidth:3,size:110,rotate:0,animate:1e3,easing:function(a,b,c,d,e){return(b/=e/2)<1?d/2*b*b+c:-d/2*(--b*(b-2)-1)+c},onStart:function(){},onStep:function(){},onStop:function(){}};if("undefined"!=typeof b)d.renderer=b;else{if("undefined"==typeof SVGRenderer)throw new Error("Please load either the SVG- or the CanvasRenderer");d.renderer=SVGRenderer}var e={},f=0,g=function(){this.el=a,this.options=e;for(var b in d)d.hasOwnProperty(b)&&(e[b]=c&&"undefined"!=typeof c[b]?c[b]:d[b],"function"==typeof e[b]&&(e[b]=e[b].bind(this)));e.easing="string"==typeof e.easing&&"undefined"!=typeof jQuery&&jQuery.isFunction(jQuery.easing[e.easing])?jQuery.easing[e.easing]:d.easing,this.renderer=new e.renderer(a,e),this.renderer.draw(f),a.dataset&&a.dataset.percent&&this.update(parseInt(a.dataset.percent,10))}.bind(this);this.update=function(a){return a=parseInt(a,10),e.animate?this.renderer.animate(f,a):this.renderer.draw(a),f=a,this}.bind(this),g()};a.fn.easyPieChart=function(b){return this.each(function(){a.data(this,"easyPieChart")||a.data(this,"easyPieChart",new c(this,b))})}}(jQuery); /********************************************************************* * #### Twitter Post Fetcher v18.0.2 #### * Coded by Jason Mayes 2015. A present to all the developers out there. * www.jasonmayes.com * Please keep this disclaimer with my code if you use it. Thanks. :-) * Got feedback or questions, ask here: * http://www.jasonmayes.com/projects/twitterApi/ * Github: https://github.com/jasonmayes/Twitter-Post-Fetcher * Updates will be posted to this site. *********************************************************************/ (function(root,factory){if(typeof define==='function'&&define.amd){define([],factory);}else if(typeof exports==='object'){module.exports=factory();}else{factory();}}(this,function(){var domNode='';var maxTweets=20;var parseLinks=true;var queue=[];var inProgress=false;var printTime=true;var printUser=true;var formatterFunction=null;var supportsClassName=true;var showRts=true;var customCallbackFunction=null;var showInteractionLinks=true;var showImages=false;var useEmoji=false;var targetBlank=true;var lang='en';var permalinks=true;var dataOnly=false;var script=null;var scriptAdded=false;function handleTweets(tweets){if(customCallbackFunction===null){var x=tweets.length;var n=0;var element=document.getElementById(domNode);var html='
    ';while(n'+tweets[n]+'';n++;} html+='
';element.innerHTML=html;}else{customCallbackFunction(tweets);}} function strip(data){return data.replace(/]*>(.*?)<\/b>/gi,function(a,s){return s;}).replace(/class="(?!(tco-hidden|tco-display|tco-ellipsis))+.*?"|data-query-source=".*?"|dir=".*?"|rel=".*?"/gi,'');} function targetLinksToNewWindow(el){var links=el.getElementsByTagName('a');for(var i=links.length-1;i>=0;i--){links[i].setAttribute('target','_blank');links[i].setAttribute('rel','noopener');}} function getElementsByClassName(node,classname){var a=[];var regex=new RegExp('(^| )'+classname+'( |$)');var elems=node.getElementsByTagName('*');for(var i=0,j=elems.length;i=0){var data_src=image_data.innerHTML.match(/data-image=\"([A-z0-9]+:\/\/[A-z0-9]+\.[A-z0-9]+\.[A-z0-9]+\/[A-z0-9]+\/[A-z0-9\-]+)/i)[1];return decodeURIComponent(data_src)+'.jpg';}} var twitterFetcher={fetch:function(config){if(config.maxTweets===undefined){config.maxTweets=20;} if(config.enableLinks===undefined){config.enableLinks=true;} if(config.showUser===undefined){config.showUser=true;} if(config.showTime===undefined){config.showTime=true;} if(config.dateFunction===undefined){config.dateFunction='default';} if(config.showRetweet===undefined){config.showRetweet=true;} if(config.customCallback===undefined){config.customCallback=null;} if(config.showInteraction===undefined){config.showInteraction=true;} if(config.showImages===undefined){config.showImages=false;} if(config.useEmoji===undefined){config.useEmoji=false;} if(config.linksInNewWindow===undefined){config.linksInNewWindow=true;} if(config.showPermalinks===undefined){config.showPermalinks=true;} if(config.dataOnly===undefined){config.dataOnly=false;} if(inProgress){queue.push(config);}else{inProgress=true;domNode=config.domId;maxTweets=config.maxTweets;parseLinks=config.enableLinks;printUser=config.showUser;printTime=config.showTime;showRts=config.showRetweet;formatterFunction=config.dateFunction;customCallbackFunction=config.customCallback;showInteractionLinks=config.showInteraction;showImages=config.showImages;useEmoji=config.useEmoji;targetBlank=config.linksInNewWindow;permalinks=config.showPermalinks;dataOnly=config.dataOnly;var head=document.getElementsByTagName('head')[0];if(script!==null){head.removeChild(script);} script=document.createElement('script');script.type='text/javascript';if(config.list!==undefined){script.src='https://syndication.twitter.com/timeline/list?'+'callback=__twttrf.callback&dnt=false&list_slug='+ config.list.listSlug+'&screen_name='+config.list.screenName+'&suppress_response_codes=true&lang='+(config.lang||lang)+'&rnd='+Math.random();}else if(config.profile!==undefined){script.src='https://syndication.twitter.com/timeline/profile?'+'callback=__twttrf.callback&dnt=false'+'&screen_name='+config.profile.screenName+'&suppress_response_codes=true&lang='+(config.lang||lang)+'&rnd='+Math.random();}else if(config.likes!==undefined){script.src='https://syndication.twitter.com/timeline/likes?'+'callback=__twttrf.callback&dnt=false'+'&screen_name='+config.likes.screenName+'&suppress_response_codes=true&lang='+(config.lang||lang)+'&rnd='+Math.random();}else{script.src='https://cdn.syndication.twimg.com/widgets/timelines/'+ config.id+'?&lang='+(config.lang||lang)+'&callback=__twttrf.callback&'+'suppress_response_codes=true&rnd='+Math.random();} head.appendChild(script);}},callback:function(data){if(data===undefined||data.body===undefined){inProgress=false;if(queue.length>0){twitterFetcher.fetch(queue[0]);queue.splice(0,1);} return;} if(!useEmoji){data.body=data.body.replace(/(]*>)|(]*>)/g,'');} if(!showImages){data.body=data.body.replace(/(]*>|(]*>))/g,'');} if(!printUser){data.body=data.body.replace(/(]*>)/g,'');} var div=document.createElement('div');div.innerHTML=data.body;if(typeof(div.getElementsByClassName)==='undefined'){supportsClassName=false;} function swapDataSrc(element){var avatarImg=element.getElementsByTagName('img')[0];if(avatarImg){avatarImg.src=avatarImg.getAttribute('data-src-2x');}else{var screenName=element.getElementsByTagName('a')[0].getAttribute('href').split('twitter.com/')[1];var img=document.createElement('img');img.setAttribute('src','https://twitter.com/'+screenName+'/profile_image?size=bigger');element.prepend(img);} return element;} var tweets=[];var authors=[];var times=[];var images=[];var rts=[];var tids=[];var permalinksURL=[];var x=0;if(supportsClassName){var tmp=div.getElementsByClassName('timeline-Tweet');while(x0){rts.push(true);}else{rts.push(false);} if(!rts[x]||rts[x]&&showRts){tweets.push(tmp[x].getElementsByClassName('timeline-Tweet-text')[0]);tids.push(tmp[x].getAttribute('data-tweet-id'));if(printUser){authors.push(swapDataSrc(tmp[x].getElementsByClassName('timeline-Tweet-author')[0]));} times.push(tmp[x].getElementsByClassName('dt-updated')[0]);permalinksURL.push(tmp[x].getElementsByClassName('timeline-Tweet-timestamp')[0]);if(tmp[x].getElementsByClassName('timeline-Tweet-media')[0]!==undefined){images.push(tmp[x].getElementsByClassName('timeline-Tweet-media')[0]);}else{images.push(undefined);}} x++;}}else{var tmp=getElementsByClassName(div,'timeline-Tweet');while(x0){rts.push(true);}else{rts.push(false);} if(!rts[x]||rts[x]&&showRts){tweets.push(getElementsByClassName(tmp[x],'timeline-Tweet-text')[0]);tids.push(tmp[x].getAttribute('data-tweet-id'));if(printUser){authors.push(swapDataSrc(getElementsByClassName(tmp[x],'timeline-Tweet-author')[0]));} times.push(getElementsByClassName(tmp[x],'dt-updated')[0]);permalinksURL.push(getElementsByClassName(tmp[x],'timeline-Tweet-timestamp')[0]);if(getElementsByClassName(tmp[x],'timeline-Tweet-media')[0]!==undefined){images.push(getElementsByClassName(tmp[x],'timeline-Tweet-media')[0]);}else{images.push(undefined);}} x++;}} if(tweets.length>maxTweets){tweets.splice(maxTweets,(tweets.length-maxTweets));authors.splice(maxTweets,(authors.length-maxTweets));times.splice(maxTweets,(times.length-maxTweets));rts.splice(maxTweets,(rts.length-maxTweets));images.splice(maxTweets,(images.length-maxTweets));permalinksURL.splice(maxTweets,(permalinksURL.length-maxTweets));} var arrayTweets=[];var x=tweets.length;var n=0;if(dataOnly){while(n';} op+='

'+strip(tweets[n].innerHTML)+'

';if(printTime){if(permalinks){op+='

'+times[n].getAttribute('aria-label')+'

';}else{op+='

'+ times[n].getAttribute('aria-label')+'

';}}}else{if(tweets[n].textContent){if(printUser){op+='

'+authors[n].textContent+'

';} op+='

'+tweets[n].textContent+'

';if(printTime){op+='

'+times[n].textContent+'

';}}else{if(printUser){op+='

'+authors[n].textContent+'

';} op+='

'+tweets[n].textContent+'

';if(printTime){op+='

'+times[n].textContent+'

';}}} if(showInteractionLinks){op+='

'+'

';} if(showImages&&images[n]!==undefined&&extractImageUrl(images[n])!==undefined){op+='
'+'Image from tweet'+'
';} if(showImages){arrayTweets.push(op);}else if(!showImages&&tweets[n].textContent.length){arrayTweets.push(op);} n++;}} handleTweets(arrayTweets);inProgress=false;if(queue.length>0){twitterFetcher.fetch(queue[0]);queue.splice(0,1);}}};window.__twttrf=twitterFetcher;window.twitterFetcher=twitterFetcher;return twitterFetcher;}));(function(arr){arr.forEach(function(item){if(item.hasOwnProperty('prepend')){return;} Object.defineProperty(item,'prepend',{configurable:true,enumerable:true,writable:true,value:function prepend(){var argArr=Array.prototype.slice.call(arguments),docFrag=document.createDocumentFragment();argArr.forEach(function(argItem){var isNode=argItem instanceof Node;docFrag.appendChild(isNode?argItem:document.createTextNode(String(argItem)));});this.insertBefore(docFrag,this.firstChild);}});});})([Element.prototype,Document.prototype,DocumentFragment.prototype]); // Pajinate (function($){$.fn.pajinate=function(options){var current_page="current_page";var items_per_page="items_per_page";var meta;var defaults={item_container_id:".content",items_per_page:10,nav_panel_id:".page_navigation",nav_info_id:".info_text",num_page_links_to_display:20,start_page:0,wrap_around:false,nav_label_first:"",nav_label_prev:"",nav_label_next:"",nav_label_last:"",nav_order:["first","prev","num","next","last"],nav_label_info:"Showing {0}-{1} of {2} results",show_first_last:true,abort_on_small_lists:false,jquery_ui:false,jquery_ui_active:"ui-state-highlight",jquery_ui_default:"ui-state-default",jquery_ui_disabled:"ui-state-disabled"};var options=$.extend(defaults,options);var $item_container;var $page_container;var $items;var $nav_panels;var total_page_no_links;var jquery_ui_default_class=options.jquery_ui?options.jquery_ui_default:"";var jquery_ui_active_class=options.jquery_ui?options.jquery_ui_active:"";var jquery_ui_disabled_class=options.jquery_ui?options.jquery_ui_disabled:"";return this.each(function(){$page_container=$(this);$item_container=$(this).find(options.item_container_id);$items=$page_container.find(options.item_container_id).children();if(options.abort_on_small_lists&&options.items_per_page>=$items.length)return $page_container;meta=$page_container;meta.data(current_page,0);meta.data(items_per_page,options.items_per_page);var total_items=$item_container.children().length;var number_of_pages=Math.ceil(total_items/options.items_per_page);var more='...';var less='...';var first=!options.show_first_last?"":''+options.nav_label_first+"";var last=!options.show_first_last?"":''+options.nav_label_last+"";var navigation_html="";for(var i=0;i'+options.nav_label_next+"";break;case"prev":navigation_html+=''+options.nav_label_prev+"";break;case"num":navigation_html+=less;var current_link=0;while(number_of_pages>current_link){navigation_html+=''+(current_link+1)+"";current_link++}navigation_html+=more;break;default:break}}$nav_panels=$page_container.find(options.nav_panel_id);$nav_panels.html(navigation_html).each(function(){$(this).find(".page_link:first").addClass("first");$(this).find(".page_link:last").addClass("last")});$nav_panels.children(".ellipse").hide();$nav_panels.find(".previous_link").next().next().addClass("active_page "+jquery_ui_active_class);$items.hide();$items.slice(0,meta.data(items_per_page)).show();total_page_no_links=$page_container.find(options.nav_panel_id+":first").children(".page_link").length;options.num_page_links_to_display=Math.min(options.num_page_links_to_display,total_page_no_links);$nav_panels.children(".page_link").hide();$nav_panels.each(function(){$(this).children(".page_link").slice(0,options.num_page_links_to_display).show()});$page_container.find(".first_link").click(function(e){e.preventDefault();movePageNumbersRight($(this),0);gotopage(0)});$page_container.find(".last_link").click(function(e){e.preventDefault();var lastPage=total_page_no_links-1;movePageNumbersLeft($(this),lastPage);gotopage(lastPage)});$page_container.find(".previous_link").click(function(e){e.preventDefault();showPrevPage($(this))});$page_container.find(".next_link").click(function(e){e.preventDefault();showNextPage($(this))});$page_container.find(".page_link").click(function(e){e.preventDefault();gotopage($(this).attr("longdesc"))});gotopage(parseInt(options.start_page));toggleMoreLess();if(!options.wrap_around)tagNextPrev()});function showPrevPage(e){new_page=parseInt(meta.data(current_page))-1;if($(e).siblings(".active_page").prev(".page_link").length==true){movePageNumbersRight(e,new_page);gotopage(new_page)}else if(options.wrap_around){gotopage(total_page_no_links-1)}}function showNextPage(e){new_page=parseInt(meta.data(current_page))+1;if($(e).siblings(".active_page").next(".page_link").length==true){movePageNumbersLeft(e,new_page);gotopage(new_page)}else if(options.wrap_around){gotopage(0)}}function gotopage(page_num){page_num=parseInt(page_num,10);var ipp=parseInt(meta.data(items_per_page));start_from=page_num*ipp;end_on=start_from+ipp;var items=$items.hide().slice(start_from,end_on);items.show();$page_container.find(options.nav_panel_id).children(".page_link[longdesc="+page_num+"]").addClass("active_page "+jquery_ui_active_class).siblings(".active_page").removeClass("active_page "+jquery_ui_active_class);meta.data(current_page,page_num);var $current_page=parseInt(meta.data(current_page)+1);var total_items=$item_container.children().length;var $number_of_pages=Math.ceil(total_items/options.items_per_page);$page_container.find(options.nav_info_id).html(options.nav_label_info.replace("{0}",start_from+1).replace("{1}",start_from+items.length).replace("{2}",$items.length).replace("{3}",$current_page).replace("{4}",$number_of_pages));toggleMoreLess();tagNextPrev();if(typeof options.onPageDisplayed!=="undefined"){options.onPageDisplayed.call(this,page_num+1)}}function movePageNumbersLeft(e,new_p){var new_page=new_p;var $current_active_link=$(e).siblings(".active_page");if($current_active_link.siblings(".page_link[longdesc="+new_page+"]").css("display")=="none"){$nav_panels.each(function(){$(this).children(".page_link").hide().slice(parseInt(new_page-options.num_page_links_to_display+1),new_page+1).show()})}}function movePageNumbersRight(e,new_p){var new_page=new_p;var $current_active_link=$(e).siblings(".active_page");if($current_active_link.siblings(".page_link[longdesc="+new_page+"]").css("display")=="none"){$nav_panels.each(function(){$(this).children(".page_link").hide().slice(new_page,new_page+parseInt(options.num_page_links_to_display)).show()})}}function toggleMoreLess(){if(!$nav_panels.children(".page_link:visible").hasClass("last")){$nav_panels.children(".more").show()}else{$nav_panels.children(".more").hide()}if(!$nav_panels.children(".page_link:visible").hasClass("first")){$nav_panels.children(".less").show()}else{$nav_panels.children(".less").hide()}}function tagNextPrev(){if($nav_panels.children(".last").hasClass("active_page")){$nav_panels.children(".next_link").add(".last_link").addClass("no_more "+jquery_ui_disabled_class)}else{$nav_panels.children(".next_link").add(".last_link").removeClass("no_more "+jquery_ui_disabled_class)}if($nav_panels.children(".first").hasClass("active_page")){$nav_panels.children(".previous_link").add(".first_link").addClass("no_more "+jquery_ui_disabled_class)}else{$nav_panels.children(".previous_link").add(".first_link").removeClass("no_more "+jquery_ui_disabled_class)}}}})(jQuery); /* ========================================================================== Kallyas JS scripts. Contains scripts dedicated for this template. Do not change nothing as it will be constantly updated and your work might get overwritten. ========================================================================== */ //#! Enable with "1" or disable with "0" which functionality you want to use. var KallyasConfig = { // Set your own domain to enable the Google search functionality on your website. searchDomain: 'https://www.natchcenter.com', // Enable Chaser Menu (Chaser menu or Sticky Header, not both on the same time.) enableChaserMenu: 0, // The distance in pixels from the top of the page when to display the chaser menu chaserMenuOffsetDisplay: 150, // Enable Sticky Header enableStickyHeader: 0, // Enable Header ScrollSpy (Especially for One Page layouts that has OnePage menu (Landing Pages).) enableScrollSpy: 0, // Display the back to top button enableBackToTop: 1 }; //!#---------- /* * Closure for Page Load */ (function($, window, document) { "use strict"; // Define global vars var $window = $(window), $html = $("html"), $body = $("body"), $header = $("#header"); // Notice to prevent opening on a local environment $(document).ready(function () { if(window.location.href.indexOf("file:///") > -1) { alert("Local environment warning!! \n\nSome of the features of this template might not work properly if the .html file is opened locally. \n\nFor best results, please preview on a web server (either http://yourdomain.com/kallyas/ or from your computer with an emulated server eg: http://localhost/kallyas/ ). Please read the documentation to learn more. "); } }); // END Notice to prevent opening on a local environment // FIX mask for Safari Browser if(/^((?!chrome|android).)*safari/i.test(navigator.userAgent)){ document.getElementsByTagName('body')[0].className+=' is-safari'; } // END FIX mask for Safari Browser // PRELOADER *to deactivate erase or comment this code* $(window).on('load', function() { $('body').removeClass('preloader'); }); // END PRELOADER // Search panel var searchBtn = $('#search').children('.searchBtn'), searchPanel = searchBtn.next(), searchP = searchBtn.parent(); searchBtn.click(function(e){ e.preventDefault(); var _t = $(this); if(!_t.hasClass('active')) { _t.addClass('active') .find('span') .removeClass('fa-search white-icon') .addClass('fa-times'); searchPanel.show(); } else { _t.removeClass('active') .find('span') .addClass('fa-search white-icon') .removeClass('fa-times'); searchPanel.hide(); } }); // searchBtn.click // $(document).click(function(){ searchBtn.removeClass('active') .find('span') .addClass('fa-search white-icon') .removeClass('fa-times'); searchPanel.hide(0); }); searchP.click(function(event){ event.stopPropagation(); }); // END Search panel // Header search with Google //@! Header Search Form var searchForm = $('#searchform'); if(searchForm){ searchForm.on('submit', function(e){ var searchInput = $(this).find('#q'); var searchTerm = searchInput.val().replace('SEARCH ...', ''); var qs = 'site:'+KallyasConfig.searchDomain +' '+searchInput.val(); $(this).find('#q').val(qs); window.setTimeout(function() { searchInput.val(searchTerm); }, 1000); return true; }); } //@! Sidebar search form searchForm = $('#searchform-sidebar'); if(searchForm){ var searchInput = $('#s', searchForm); searchForm.on('submit', function(e){ var qs = 'site:'+KallyasConfig.searchDomain +' '+searchInput.val(); $(this).find('#sq').val(qs); return true; }); } // END Header search with Google // Search from pages with Google var searchForms = $('.elm-searchbox__form'); if (searchForms) { searchForms.on('submit', function(e) { var searchInput = $(this).find('.elm-searchbox__input'), __search = searchInput.val(), qs = 'site:' + KallyasConfig.searchDomain + ' ' + __search; searchInput.val(qs); window.setTimeout(function() { searchInput.val(__search); }, 1000); return true; }); } // end Search from pages with Google // Add active class for menu items depending on the page loaded (function(){ var pathname = window.location.pathname, page = pathname.split(/[/ ]+/).pop(), menuItems = $('#menu-main-menu a'); menuItems.each(function(){ var mi = $(this), miHrefs = mi.attr("href"), miParents = mi.parents('li'); if(page == miHrefs) { miParents.addClass("active").siblings().removeClass('active'); } }); })(); // END Add active class for menu items depending on the page loaded // Chaser menu if (window.matchMedia('(min-width: 992px)').matches) { if(KallyasConfig.enableChaserMenu && ! KallyasConfig.enableStickyHeader){ var KT_Chaser = { // Whether or not the chaser is visible visible: false, update: function( $header, headerStyleNumber ) { if(headerStyleNumber < 1){ console.warn('[KT_Chaser::update] Error: Invalid header style number provided.'); return; } // Clone needed elements from $header depending on the headerStyleNumber and generate chaser menu this._createChaserByHeaderStyle( $header, headerStyleNumber ); }, // Clone needed elements from $header depending on the headerStyleNumber and generate chaser menu _createChaserByHeaderStyle: function( $header, headerStyleNumber ) { // Show top bar when headerStyleNumber = [1,2,3] var populateTopBar = ($.inArray(parseInt(headerStyleNumber,10), [1,2,3])); // Update chaser's content this._updateChaserHtml( $header, populateTopBar ); }, // Update the chaser menu's content _updateChaserHtml: function( $header, populateTopBar ){ populateTopBar = (populateTopBar > -1); // Create new html structure var chaserMenu = $('body .chaser'); if( ! chaserMenu){ return; } // Create chaser menu $('#chaserMenuRow').html('') //.append('
') .append('
'); // Add logo //$('#left-container').html($('.logo-container', $header).clone(true)); // Add the content in the right area var rightContainer = $('#right-container'); rightContainer // Adding top bar //.append('
') // add main menu .append('
') // Add cta button //.append('
') ; // Add content in the newly created sections // if(populateTopBar) { // if($header.attr('data-header-style') == '2'){ // $('#_wpk-custom-bar').html( $('
') ); // } // else if($header.attr('data-header-style') == '3'){ // $('#_wpk-custom-bar').html( $('.kl-top-header').clone(true) ); // } // else { // $('#_wpk-custom-bar').html( $('.kl-top-header').clone(true) ); // } // } // else { // $('#_wpk-custom-bar').html( $('
') ); // } //$('#_wpk-cta-button').html($('#ctabutton', $header).clone(true)); $('#wpk-main-menu').html($('#menu-main-menu', $header).clone(true)); //#! Remove search chaserMenu.find('#search.header-search').remove(); } }; if(KallyasConfig.enableChaserMenu) { // ON LOAD // the reference to the default header element var _header = $('#header'), // Default value for chaser's visibility forch = KallyasConfig.chaserMenuOffsetDisplay; // ENABLE HEADER STYLE CHANGING (the dropdown in options) var header_style_option = _header.attr('data-header-style') || '1'; // Setup references var docMainMenu = $('#main-menu > ul'); if(docMainMenu) { // Set the default style for header //_header.attr('data-header-style', header_style_option); // Create chaser menu $('
') .appendTo(document.body) .wrap('
'); // Set the chaser's visibility var scrolled = $(window).scrollTop(), // Get the reference to the chaser menu _chaser = $('body .chaser'); if(scrolled > forch) { _chaser.addClass('visible'); KT_Chaser.visible = true; } KT_Chaser.update( _header, _header.attr('data-header-style')); } // END if(docMainMenu) var _chaser = $('body .chaser') // OnScroll $(window).scroll(function(e) { var scrolled = $(window).scrollTop(); if ( scrolled >= forch ) { _chaser.addClass('visible'); KT_Chaser.visible = true; } else if ( scrolled < forch ) { _chaser.removeClass('visible'); KT_Chaser.visible = false; } else { // Triggered when the chaser menu is visible but doesn't have content. // Only happens when the window is scrolled and then the page is refreshed. if(_chaser.hasClass('visible') && $('#chaserMenuRow').html().trim() == ''){ KT_Chaser.visible = true; } } }); // END onScroll } } } // END Chaser menu // Sticky Header if(KallyasConfig.enableStickyHeader && ! KallyasConfig.enableChaserMenu){ var header = $('#header'); $(window).scroll(function(){ var scrolled = $(window).scrollTop(); if(scrolled < 1){ $body.removeClass('sticky-header'); } else if (scrolled > 0 && scrolled <= 9) { $body.addClass('sticky-header'); header.removeClass('header--is-sticked').addClass('header--no-sticked'); } else if (scrolled >= 10) { header.addClass('header--is-sticked'); } else { header.removeClass('header--is-sticked').addClass('header--no-sticked'); } }); } // END Sticky Header // Responsive Main-Menu var page_wrapper = $('#page_wrapper'), responsive_trigger = $('.zn-res-trigger'), zn_back_text = 'Back', back_text = '
  • '+zn_back_text+'
  • ', cloned_menu = $('#main-menu > ul').clone().attr({id:"zn-res-menu", "class":""}); var start_responsive_menu = function(){ var responsive_menu = cloned_menu.prependTo(page_wrapper); var responsive_menu_overlay = $('
    ').insertAfter(cloned_menu); var set_height = function(){ var _menu = $('.zn-menu-visible').last(), height = _menu.css({height:'auto'}).outerHeight(true), window_height = $(window).height(), adminbar_height = 0, admin_bar = $('#wpadminbar'); // CHECK IF WE HAVE THE ADMIN BAR VISIBLE if(height < window_height) { height = window_height; if ( admin_bar.length > 0 ) { adminbar_height = admin_bar.outerHeight(true); height = height - adminbar_height; } } _menu.attr('style',''); page_wrapper.css({'height':height}); }; // BIND OPEN MENU TRIGGER responsive_trigger.click(function(e){ e.preventDefault(); responsive_menu.addClass('zn-menu-visible'); set_height(); }); // Close the menu when a link is clicked responsive_menu.find( 'a:not([rel*="mfp-"])' ).on('click',function(e){ $( '.zn_res_menu_go_back' ).first().trigger( 'click' ); }); // ADD ARROWS TO SUBMENUS TRIGGERS responsive_menu.find('li:has(> ul)').addClass('zn_res_has_submenu').prepend(''); // ADD BACK BUTTONS responsive_menu.find('.zn_res_has_submenu > ul').addBack().prepend(back_text); // REMOVE BACK BUTTON LINK $( '.zn_res_menu_go_back' ).click(function(e){ e.preventDefault(); var active_menu = $(this).closest('.zn-menu-visible'); active_menu.removeClass('zn-menu-visible'); set_height(); if( active_menu.is('#zn-res-menu') ) { page_wrapper.css({'height':'auto'}); } }); // OPEN SUBMENU'S ON CLICK $('.zn_res_submenu_trigger').click(function(e){ e.preventDefault(); $(this).siblings('ul').addClass('zn-menu-visible'); set_height(); }); var closeMenu = function(){ cloned_menu.removeClass('zn-menu-visible'); responsive_trigger.removeClass('is-active'); removeHeight(); }; } // MAIN TRIGGER FOR ACTIVATING THE RESPONSIVE MENU var menu_activated = false, triggerMenu = function(){ if ( $(window).width() < 1200 ) { if ( !menu_activated ){ start_responsive_menu(); menu_activated = true; } page_wrapper.addClass('zn_res_menu_visible'); } else{ // WE SHOULD HIDE THE MENU $('.zn-menu-visible').removeClass('zn-menu-visible'); page_wrapper.css({'height':'auto'}).removeClass('zn_res_menu_visible'); } }; $(document).ready(function() { triggerMenu(); }); $( window ).on( 'load resize' , function(){ triggerMenu(); var is = false; if ( $(window).width() < 1200 ) { if(is) return; //@wpk // Close button for the responsive menu var closeMenuSender = $('.zn-close-menu-button, .zn-res-menu-overlay'); if(closeMenuSender){ closeMenuSender.on('click', function(e){ e.preventDefault(); e.stopPropagation(); var parent = $('#zn-res-menu'); parent.removeClass('zn-menu-visible'); //parent.removeClass('zn-menu-visible'); $('.zn-menu-visible', parent).removeClass('zn-menu-visible'); $('#page_wrapper').css({'height':'auto'}); }); } is = true; } }); // END Responsive Main-Menu // Scroll to top if(KallyasConfig.enableBackToTop){ if ($('#totop').length) { var scrollTrigger = 200, // px backToTop = function () { var scrollTop = $(window).scrollTop(); if (scrollTop > scrollTrigger) { $('#totop').addClass('show'); } else { $('#totop').removeClass('show'); } }; backToTop(); $(window).on('scroll', function () { backToTop(); }); $('#totop').on('click', function (e) { e.preventDefault(); $('html,body').animate({ scrollTop: 0 }, 700); }); } } // END Scroll to top // Load Date in sub-header var selector = $("#current-date"); if( selector && selector.length > 0) { $.ajax({ url: "php_helpers/date.php", success: function(data){ $("#current-date").html(data); } }); } // END Load Date in sub-header // Kallyas Videos // Based on easy background video plugin // Example data setup attribute: // data-setup='{ "position": absolute, "loop": true , "autoplay": true, "muted": true, "mp4":"", "webm":"", "ogg":"" }' if( typeof($('.kl-video')) !== 'undefined'){ $('.kl-video').each(function(index, el) { var $video = $(el), _vid_controls = $video.next('.kl-video--controls'), _vid_playplause = _vid_controls.find('.btn-toggleplay'), _vid_audio = _vid_controls.find('.btn-audio'), _data_attribs = $video.attr("data-setup"), _options = typeof _data_attribs != 'undefined' ? JSON.parse(_data_attribs) : '{}'; if(_options.height_container == true) $video.closest('.kl-video-container').css('height', $video.height()); if(_options.hasOwnProperty('muted') && _options.muted == true) _vid_audio.children('i').addClass('fa-volume-off'); if(_options.hasOwnProperty('autoplay') && _options.autoplay == false) _vid_playplause.children('i').addClass('paused'); if(typeof video_background != 'undefined') { var Video_back = new video_background( $video, { //Stick within the div or fixed "position": _options.hasOwnProperty('position') ? _options.position : "absolute", //Behind everything "z-index": _options.hasOwnProperty('zindex') ? _options.zindex : "-1", //Loop when it reaches the end "loop": _options.hasOwnProperty('loop') ? _options.loop : true, //Autoplay at start "autoplay": _options.hasOwnProperty('autoplay') ? _options.autoplay : false, //Muted at start "muted": _options.hasOwnProperty('muted') ? _options.muted : true, //Path to video mp4 format "mp4": _options.hasOwnProperty('mp4') ? _options.mp4 : false, //Path to video webm format "webm": _options.hasOwnProperty('webm') ? _options.webm : false, //Path to video ogg/ogv format "ogg": _options.hasOwnProperty('ogg') ? _options.ogg : false, //Path to video flv format "flv": _options.hasOwnProperty('flv') ? _options.flv : false, //Fallback image path "fallback_image": _options.hasOwnProperty('poster') ? _options.poster : false, // Youtube Video ID "youtube": _options.hasOwnProperty('youtube') ? _options.youtube : false, // flash || html5 "priority": _options.hasOwnProperty('priority') ? _options.priority : "html5", // width/height -> If none provided sizing of the video is set to adjust "video_ratio": _options.hasOwnProperty('video_ratio') ? _options.video_ratio : false, // fill || adjust "sizing": _options.hasOwnProperty('sizing') ? _options.sizing : "fill", // when to start "start": _options.hasOwnProperty('start') ? _options.start : 0 }); //Toggle play status _vid_playplause.on('click',function(e){ e.preventDefault(); Video_back.toggle_play(); $(this).children('i').toggleClass('paused'); }); //Toggle mute _vid_audio.on('click',function(e){ e.preventDefault(); Video_back.toggle_mute(); $(this).children('i').toggleClass('mute'); }); } }); } // END Kallyas Videos // Magnific Popup if(typeof($.fn.magnificPopup) != 'undefined') { $('a.kl-login-box').magnificPopup({ type: 'inline', closeBtnInside:true, showCloseBtn: true, mainClass: 'mfp-fade mfp-bg-lighter' }); $('a[data-lightbox="image"]:not([data-type="video"])').each(function(i,el){ //single image popup if ($(el).parents('.gallery').length == 0) { $(el).magnificPopup({ type:'image', tLoading: '', mainClass: 'mfp-fade' }); } }); $('.mfp-gallery.images').each(function(i,el) { $(el).magnificPopup({ delegate: 'a', type: 'image', gallery: {enabled:true}, tLoading: '', mainClass: 'mfp-fade' }); }); // Notice the .misc class, this is a gallery which contains a variatey of sources // links in gallery need data-mfp attributes eg: data-mfp="image" $('.mfp-gallery.misc').each(function(){ $(this).magnificPopup({ delegate: 'a[data-lightbox="mfp"]', mainClass: 'mfp-fade', type: 'image', gallery: {enabled:true}, tLoading: '', callbacks: { elementParse: function(item) { item.type = $(item.el).attr('data-mfp'); } } }); }); $('a[data-lightbox="iframe"]').magnificPopup({type: 'iframe', mainClass: 'mfp-fade', tLoading: ''}); $('a[data-lightbox="inline"]').magnificPopup({type: 'inline', mainClass: 'mfp-fade', tLoading: ''}); $('a[data-lightbox="ajax"]').magnificPopup({type: 'ajax', mainClass: 'mfp-fade', tLoading: ''}); $('a[data-lightbox="youtube"], a[data-lightbox="vimeo"], a[data-lightbox="gmaps"], a[data-type="video"]').magnificPopup({ disableOn: 700, type: 'iframe', removalDelay: 160, preloader: true, fixedContentPos: false, mainClass: 'mfp-fade', tLoading: '' }); // Enable WooCommerce lightbox $('.single_product_main_image .images a').magnificPopup({ mainClass: 'mfp-fade', type: 'image', gallery: {enabled:true}, tLoading: '', }); } // END Magnific Popup // Flickr Feed var content = $('.flickrfeed'); if( content ){ var elements = content.find('.flickr_feeds'); if(elements && elements.length){ $.each(elements, function(i, e){ var self = $(e), ff_limit = (self.attr('data-limit') ? self.attr('data-limit') : 6), fid = self.attr('data-fid'); if(typeof($.fn.jflickrfeed) != 'undefined') { self.jflickrfeed({ limit: ff_limit, qstrings: { id: fid }, itemTemplate: '
  • {{title}}
  • ' }, function(data) { self.find(" a[data-lightbox='image']").magnificPopup({type:'image', tLoading: ''}); self.parent().removeClass('loadingz'); }); } }); } } // END Flickr Feed // Tonext button - Scrolls to next block (used for fullscreen slider) if(typeof($(".js-tonext-btn")) != 'undefined'){ $(".js-tonext-btn").on('click',function (e) { e.preventDefault(); var endof = $(this).attr('data-endof') ? $(this).attr('data-endof') : false, dest = 0; if ( endof ) dest = $(endof).height() + $(endof).offset().top; //go to destination $('html,body').animate({scrollTop: dest}, 1000, 'easeOutExpo'); }); } // END Tonext button - Scrolls to next block (used for fullscreen slider) // Blog Isotope item var enable_blog_isotope = function( scope ){ var elements = scope.find( '.hg_blog_columns, .masonry-columns' ); if( elements.length == 0) { return; } if( typeof $.fn.imagesLoaded != 'undefined' && typeof $.fn.isotope != 'undefined' ) { elements.imagesLoaded( function() { elements.isotope({ itemSelector: ".blog-isotope-item, .item", animationEngine: "jquery", animationOptions: { duration: 250, easing: "easeOutExpo", queue: false }, filter: '', sortAscending: true, sortBy: '' }); }); } }; var blog_isotope = $('.hg_blog_archive_element, .portfolio-masonry'); if(blog_isotope){ enable_blog_isotope ( blog_isotope ); } // END Blog Isotope item // Price Filter var priceRange = $( ".price-range-slider" ); if(typeof(priceRange) != 'undefined') { $.each(priceRange, function(index, val) { var _t = $(this), priceResult = _t.parent().find(".price-result"), currency = priceResult.data('currency'); if( typeof($.fn.slider) != 'undefined' ){ _t.slider({ range: true, min: 0, max: 500, values: [ 75, 300 ], slide: function( event, ui ) { priceResult.val( currency + ui.values[ 0 ] + " - "+ currency + ui.values[ 1 ] ); } }); } priceResult.val( currency + _t.slider( "values", 0 ) + " - " + currency + _t.slider( "values", 1 ) ); }); } // END Price Filter // Form Validation & Send Mail code if(typeof($('.contactForm form, .contactForm.pop-up-form form')) != 'undefined') { $.each($('.contactForm form, .contactForm.pop-up-form form'), function(index, el) { var cform = $(el), cResponse = $('
    '); cform.prepend(cResponse); cform.h5Validate(); cform.submit(function(e) { e.preventDefault(); if(cform.h5Validate('allValid')) { cResponse.hide(); $.post( $(this).attr('action'), cform.serialize(), function(data){ cResponse.html(data).fadeIn('fast'); if(data.match('success') != null) { cform.get(0).reset(); } } ); // end post } return false; }); }); } // END Form Validation & Send Mail code // Check portfolio content & Knowledgebase categories read more button var elements = $('.portfolio-item-more-toggle, .kb-item-more-toggle'); if(elements){ $.each(elements, function(a,b){ var element = $(b); element.on('click', function(e){ e.preventDefault(); e.stopPropagation(); var eTarget = element.parents('.portfolio-item-desc, .kb-category').first(); eTarget.toggleClass('is-opened'); }); }); } // END Check portfolio content & Knowledgebase categories read more button // Map toggle panel elements = $('.kl-contentmaps__panel-tgg'); if(elements){ elements.each(function(a, b){ var element = $(b); element.on('click', function(e){ e.preventDefault(); e.stopPropagation(); var targetElement = $(element.data('target')); if(targetElement){ var toggleClass = element.data('targetClass'); if(toggleClass){ targetElement.toggleClass(toggleClass); } } }); }); } // END Map toggle panel // Stage icon boxes element - .kl-ib-point-active => activates the dot (see :hover) elements = $('.kl-iconbox'); if(elements){ $.each(elements, function(a,b){ var element = $(b), target = $(element.data('targetElement')); // data-target-element="kl-ib-point-1" if(target){ element.on('mouseenter', function(e){ target.addClass('kl-ib-point-active'); }).on('mouseleave', function(){ target.removeClass('kl-ib-point-active'); }); } }); } // END Stage icon boxes element // MailChimp working newsletter // read more http://stackoverflow.com/a/15120409/477958 function register($form) { if(! $form){ return false; } $.ajax({ type: $form.attr('method'), url: $form.attr('action'), data: $form.serialize(), cache : false, dataType : 'json', contentType: "application/json; charset=utf-8", error : function(err) { var themessage = $('Could not connect to server. Please try again later.'); $('#notification_container').html(themessage); setTimeout(function(){ themessage.addClass('animate'); }, 300) }, success : function(data) { if (data.result != "success") { var message = data.msg.substring(4), themessage = $(''+message+''); $('#notification_container').html(themessage); setTimeout(function(){ themessage.addClass('animate'); }, 300); } else { var message = data.msg, themessage = $(''+message+''); $('#notification_container').html(themessage); setTimeout(function(){ themessage.addClass('animate'); }, 300) } } }); } var $form = $('#mc-embedded-subscribe-form'); if($form){ $('#mc-embedded-subscribe-form').on('click', function(event) { if(event) event.preventDefault(); register($form); }); } var $form_pop = $('#mc-embedded-subscribe-form-pop'); if($form_pop){ $('#mc-embedded-subscribe-form-pop').on('click', function(event) { if(event) event.preventDefault(); register($form_pop); }); } // END MailChimp working newsletter // Words play jQuery('#textplay .textplay-line').each(function(index, el) { var words = jQuery(el).children('.textplay-word'), randlast; setInterval(function(){ var rand = Math.floor( (Math.random() * words.length) ); if(rand == randlast) rand = Math.floor( (Math.random() * words.length) ); words.removeClass('active'); setTimeout(function(){ words.eq( rand ).addClass('active'); },300); randlast = rand; }, 3000); }); // END Words play // Sub-header mask effect if (matchMedia('only screen and (min-width: 767px)').matches && $html.hasClass('js')){ var scrollSvg = $('.kl-slideshow, #page_header'); if( scrollSvg && scrollSvg.length > 0 ) { var scrollSvgHeight = (parseFloat(scrollSvg.css('height')) + 20), svgEffect = scrollSvg.find('.screffect'); $window.scroll(function(){ var scrollPos = $window.scrollTop(); if(scrollPos < scrollSvgHeight) { var maxSkew = 2; var effectPos = (maxSkew / scrollSvgHeight) * scrollPos; svgEffect.css({ '-webkit-transform': 'skewY(-'+ effectPos +'deg)', 'transform': 'skewY(-'+ effectPos +'deg)' }); } }); } } // END Sub-header mask effect // Bubble Boxes $('.bubble-box').each(function(index, el) { var $el = $(el), $revealAt = $el.attr('data-reveal-at'), $hideAfter = $el.attr('data-hide-after'), defaultRevealAt = 1000; // default reveal when scrolling is at xx px if(typeof $revealAt == 'undefined' && $revealAt.length <= 0) $revealAt = defaultRevealAt; $window.smartscroll(function(event) { // reveal the popup if ($el.length > 0 && $(window).scrollTop() > $revealAt && (!$el.hasClass('bb--anim-show') && !$el.hasClass('bb--anim-hide'))){ $el.addClass("bb--anim-show"); // check if hide after is defined and hide the popupbox if(typeof $hideAfter != 'undefined' && $hideAfter.length >= 0) { setTimeout(function(){ $el.removeClass('bb--anim-show').addClass('bb--anim-hide').one('animationend webkitAnimationEnd oAnimationEnd MSAnimationEnd', function() { $(this).remove(); }); }, $hideAfter) } } }); $el.find('.bb--close').on('click', function(){ $el.addClass('bb--anim-hide').one('animationend webkitAnimationEnd oAnimationEnd MSAnimationEnd', function() { $(this).remove(); }); }); }); // END Bubble Boxes // Popup Box // Works with Magnific popup to open them // data-ppbox-timeout attribute needed to specify the timeout to appear if(typeof($('.kl-pp-box[data-ppbox-timeout]')) != 'undefined') { $('.kl-pp-box[data-ppbox-timeout]').each(function(index, el) { var $el = $(el), pptimeout = $el.attr('data-ppbox-timeout'), timeout = (typeof pptimeout == 'undefined' && $(pptimeout).length <= 0) ? pptimeout : 8000; var cookieExpireAttr = $el.attr('data-cookie-expire'), cookieExpire = (typeof cookieExpireAttr !== 'undefined') ? cookieExpireAttr : 2; // Remove cookie if you want to test // $.removeCookie('ppbox', { path: '/' }); // check if cookie exists if(!$.cookie('ppbox')) { // show the popupbox var timer = setTimeout(function(){ $.magnificPopup.open({ items: { src: $($el.get(0)) }, type: 'inline', mainClass: 'mfp-fade mfp-bg-lighter', tLoading: '' }); }, timeout); } // Set cookie and close popup $(el).find('.dontshow').on('click',function(e){ e.preventDefault(); // Add cookie support $.cookie('ppbox', 'hideit', { expires: parseInt(cookieExpire), path: '/' }); //Close Popup $.magnificPopup.close(); }); }); } // END Popup Box // Login pop-up element & Contact form pop-up element if(typeof($('.popup-with-form, .kl-cta-ribbon')) != 'undefined') { $('.popup-with-form, .kl-cta-ribbon').magnificPopup({ closeBtnInside: true, type: 'inline', preloader: false, focus: '#name', // When elemened is focused, some mobile browsers in some cases zoom in // It looks not nice, so we disable it: callbacks: { beforeOpen: function() { if ($(window).width() < 700) { this.st.focus = false; } else { this.st.focus = '#name'; } } } }); } // END Login pop-up element & Contact form pop-up element // Tooltips // ** for more details how to use tooltips, you can check bootstrap documentation: http://getbootstrap.com/javascript/#tooltips if(typeof($.fn.tooltip) != 'undefined' && typeof($('[data-toggle="tooltip"]')) != 'undefined') { $('[data-toggle="tooltip"]').tooltip(); } // END Tooltips // Hover buttons icons in action bar jQuery(".cms-hov-icon").each(function(index, el) { var $el = jQuery(el), hovIcon = $el.attr('data-hovicon'); $el.on('mouseover', function(){ jQuery("#"+ hovIcon).addClass('hovered'); jQuery("#cms-icon-github-circled").removeClass('hovered'); }).on('mouseout', function(){ jQuery("#"+ hovIcon).removeClass('hovered'); jQuery("#cms-icon-github-circled").addClass('hovered'); }); }); // END Hover buttons icons in action bar // Appear Events if($.fn.appear != 'undefined') { $('[data-animated], .appear').appear({force_process: true}); $('[data-animated="fade"]').on('appear', function() { $(this).each(function(i,el){ $(el).addClass('fade-animation') }); }); $('[data-animated="execute"]').on('appear', function() { $(this).each(function(i,el){ $(el).addClass('started') }); }); } // end Appear Events // // Tweets in Footer // /* ### HOW TO CREATE A VALID ID: ### // * Go to www.twitter.com and sign in as normal, go to your settings page. // * Go to Widgets on the left hand side. // * Create a new widget for what you need eg user timeline or search etc. // * Feel free to check exclude replies if you dont want replies in results. // * Now go back to settings page, and then go back to widgets page, you should // * see the widget you just created. Click edit. // * Now look at the URL in your web browser, you will see a long number like this: // * 345735908357048478 // * Use this as your ID below instead! var twFeed = $('#twitterFeed'); if(twFeed.length > 0 && typeof(twitterFetcher) != 'undefined') { var handleTweets = function(tweets) { var x = tweets.length, element = document.getElementById('twitterFeed'), n = 0, html = '
      '; while(n < x) { html += '
    • ' + tweets[n] + '
    • '; n++; } html += '
    '; element.innerHTML = html; } var twitter_config = { "id": '435730856443797504', "domId": '', "maxTweets": 1, "enableLinks": true, "showUser": false, "showTime": true, "dateFunction": '', "showRetweet": false, "customCallback": handleTweets, "showInteraction": false }; twitterFetcher.fetch(twitter_config); } // END Tweets in Footer /**** Initialize carousels based on CarouFredSel * .caroufredsel class mandatory * data-setup attribute needed (please find examples within the site) * */ var initCarouFredSels = function(dom){ // check if dom param is added, if not use $body dom = typeof dom !== 'undefined' ? dom : $body; // start carousel trigger with options var cfs_container = $(dom).find(".caroufredsel:not(.custom)"); // check if element exists so it can begin the job if (!cfs_container.length) return; // iterate through finds $.each( cfs_container, function(index, el) { var _el = $(el), _data_attribs = _el.attr("data-setup"), _options = typeof _data_attribs != 'undefined' ? JSON.parse(_data_attribs) : '{}', _nav = $('
    '), _pag = $('
    '), _cfParent = _el.closest('.caroufredsel').parent(); if(_options.navigation) ( _options.appendToParent ? _cfParent : _el ).append(_nav); if(_options.pagination) ( _options.appendToParent ? _cfParent : _el ).append(_pag); if(_options.swipe_touch || _options.swipe_mouse) _el.addClass('stl-swiper'); var doCarouFredSels = function(){ _el.children('ul.slides').carouFredSel({ responsive: _options.hasOwnProperty('responsive') ? _options.responsive : true, width: _options.hasOwnProperty('width') ? _options.width : null, height: _options.hasOwnProperty('height') ? _options.height : null, align: _options.hasOwnProperty('align') ? _options.align : 'left', scroll: { items: _options.hasOwnProperty('scroll') ? _options.scroll : 1, fx : _options.hasOwnProperty('fx') ? _options.fx : "scroll" }, items: { visible: _options.hasOwnProperty('items') ? _options.items : 1, minimum: _options.hasOwnProperty('items_minimum') ? _options.items_minimum : 1, start: _options.hasOwnProperty('items_start') ? _options.items_start : 0, width:_options.hasOwnProperty('items_width') ? _options.items_width : null, height: _options.hasOwnProperty('items_height') ? _options.items_height : null }, auto: { play: _options.hasOwnProperty('autoplay') ? _options.autoplay : true, timeoutDuration: _options.hasOwnProperty('auto_duration') ? _options.auto_duration : 10000 }, prev : { button : ( _options.appendToParent ? _cfParent : _el.closest('.caroufredsel') ).find('.cfs--prev'), key : "left" }, next : { button : ( _options.appendToParent ? _cfParent : _el.closest('.caroufredsel') ).find('.cfs--next'), key : "right" }, pagination: { container: ( _options.appendToParent ? _cfParent : _el.closest('.caroufredsel') ).find('.cfs--pagination'), anchorBuilder: function(nr, item) { return ''; } }, swipe: { onTouch: _options.hasOwnProperty('swipe_touch') || Modernizr.touch ? _options.swipe_touch : false, onMouse: _options.hasOwnProperty('swipe_mouse') || Modernizr.touch ? _options.swipe_mouse : false } }); }; cfs_container.imagesLoaded(doCarouFredSels); }); }; // end Initialize carousels based on CarouFredSel /* Photo Gallery Alternative - Caroufredsel */ if($.fn.carouFredSel != 'undefined') { /* Caroufredsel Trigger with options */ initCarouFredSels(); /** * PhotoGallery Widget */ $('.photogallery-widget .caroufredsel').each(function(index, el) { var _cfs_main = $(el), _cfs_main_slides = _cfs_main.children('ul.slides'); _cfs_main_slides.children('li').slice(10).remove(); var updPhotoGalWdgtCounter = function(c) { var cfscounter = c.closest('.caroufredsel').find('.cfs-counter'), current = c.triggerHandler( 'currentPosition' ); cfscounter.html( ( current+1 ) +" of "+ c.children().length ); }, doPhotoGalWdgt = function (){ _cfs_main_slides.carouFredSel({ responsive: true, width: 850, items: 1, auto: 10000, prev : { button : _cfs_main.find('.cfs--prev'), key : "left" }, next : { button : _cfs_main.find('.cfs--next'), key : "right" }, scroll: { fx: 'crossfade', onBefore: function( data ) { updPhotoGalWdgtCounter( _cfs_main_slides ); } }, onCreate: function( data ) { updPhotoGalWdgtCounter( _cfs_main_slides ); }, pagination: { container: _cfs_main.next('.cfs--pagination'), anchorBuilder: function(nr, item) { var th = _cfs_main.height()/5, ths = _cfs_main_slides.children('li'), thbg = ths.eq(nr-1).attr('data-thumb'), thdesc = ths.eq(nr-1).find('.pg-caption'), thdesc_html = thdesc.length > 0 ? thdesc.get(0).outerHTML : ''; return '
    '+ thdesc_html +'
    '; } }, swipe: { onTouch: Modernizr.touch ? true : false, onMouse: Modernizr.touch ? true : false } }); } // append pagination _cfs_main.after('
    '); // Load Carousel after images are loaded _cfs_main.imagesLoaded(doPhotoGalWdgt); }); } // end checking if carouFredSel is loaded /* end Photo Gallery Alternative - Caroufredsel */ // Chart animation based on easyPieChart jQuery plugin if($.fn.appear != 'undefined' && $.fn.easyPieChart != 'undefined') { var chart = $(".fundedperc .chart"); chart.appear(); $(document.body).on('appear', '.fundedperc .chart', function() { jQuery('.chart').easyPieChart({ animate: 2000, barColor : typeof chart.attr('data-color') != 'undefined' ? chart.attr('data-color') : '#CD2122', trackColor: false, lineWidth: 16, size: 300, lineCap: 'square', scaleLength: 0, onStep: function(from, to, percent) { $(this.el).find('.percent span').text( Math.round(percent)); } }); }); } // end Chart animation based on easyPieChart jQuery plugin // Process items: make the line behind the elements var selectors = $(".processitems li"); if( selectors && selectors.length > 0) { $(".processitems li").each(function(i,el) { $(el).on({ 'mouseenter':function(){ $(this).prevAll().each(function() { $(this).addClass("lined"); }); }, 'mouseleave':function(){ $(this).siblings().each(function() { $(this).removeClass("lined"); }); }}); }); } // end Process items: make the line behind the elements // Circular carousel element more buttom function var selectors = $('.ca-container .ca-wrapper'); if( selectors && selectors.length > 0) { selectors.each(function(i, el){ var self = $(el); // Open wrapper panel var opened = false; self.find('.js-ca-more').on('click', function(e){ e.preventDefault(); var th = $(this).closest('.ca-item'), thpos = th.position().left; if(!opened){ self.slick('slickPause'); self.closest('.ca-container').addClass('ca--is-rolling'); th.addClass('ca--opened'); var activeItems = self.find('.ca-item.slick-active'), openedIndex = activeItems.index( th ), moveTo = (self.width() / activeItems.length) * openedIndex; th.css({ "-webkit-transform":"translateX(-"+ moveTo +"px)", "-ms-transform":"translateX(-"+ moveTo +"px)", "transform":"translateX(-"+ moveTo +"px)" }); opened = true; } else if(opened){ if($(this).hasClass('js-ca-more-close')){ self.slick('slickPlay', true); self.closest('.ca-container').removeClass('ca--is-rolling'); th.removeClass('ca--opened'); th.css({ "-webkit-transform":"translateX(0)", "-ms-transform":"translateX(0)", "transform":"translateX(0)" }); opened = false; } } }); // Close wrapper panel self.find('.js-ca-close').on('click', function(e){ e.preventDefault(); var th = $(this).closest('.ca-item'); if(opened){ self.slick('slickPlay', true); self.closest('.ca-container').removeClass('ca--is-rolling'); th.removeClass('ca--opened'); th.css({ "-webkit-transform":"translateX(0)", "-ms-transform":"translateX(0)", "transform":"translateX(0)" }); } opened = false; }); }); } // end Circular carousel element more buttom function })(window.jQuery, window, document); // ScollSpy One page Menu if(KallyasConfig.enableScrollSpy){ //#! [Configure ScrollSpy] Set the attribute on body $(window).on('load scroll resize', function(){ var bodyScrollSpy = $('body[data-spy="scroll"]'); if(KallyasConfig.enableChaserMenu && $(window).scrollTop() > KallyasConfig.chaserMenuOffsetDisplay ) { bodyScrollSpy.attr('data-target', '#wpk-main-menu'); } else { bodyScrollSpy.attr('data-target', '#main-menu'); } }); jQuery(function($){ var bodyScrollSpy = $('body') bodyScrollSpy .css('position', 'relative') .attr('data-spy', 'scroll') .attr('data-offset', '5'); // OnLoad var hash = window.location.hash; if(hash){ // check the main menu first var targets = $('#menu-main-menu > li > a'); $.each(targets, function(a,b){ if( hash == $(b).attr('href')){ $(b).parents('ul').first().find('*').removeClass('active'); $(b).addClass('active'); $(hash).attr('tabindex', '-1'); $(hash).focus(); } }); } // Menu item OnClick $('#menu-main-menu > li > a, .chaser li a').on('click',function(e) { var item = $(this); if(! item.hasClass('active')) { item.parents('ul').find('*').removeClass('active'); item.addClass('active'); } }); }); } // end ScollSpy One page Menu ;(function($){ "use strict"; $(document).ready(function() { var loader_form = document.getElementsByClassName('loader_form')[0]; // contact us popup if(typeof($('.getfree')) != 'undefined') { $('.getfree').magnificPopup({ items: { src: '#contact_panel' }, closeBtnInside: true, type: 'inline', preloader: false, focus: '#name', // When elemened is focused, some mobile browsers in some cases zoom in // It looks not nice, so we disable it: callbacks: { beforeOpen: function() { if ($(window).width() < 700) { this.st.focus = false; } else { this.st.focus = false; } } } }); } // menus slide and nich $(window).scroll(function(){ var header = $('#header'), scrolled = $(window).scrollTop(); if (scrolled > 0 && scrolled <= 9) { $('body').addClass('sticky-header'); header.removeClass('header--is-sticked').addClass('header--no-sticked'); } else if (scrolled >= 10) { header.addClass('header--is-sticked'); $('.kl-header-bg').addClass('darkbg'); } else { header.removeClass('header--is-sticked').addClass('header--no-sticked'); $('.kl-header-bg').removeClass('darkbg'); } }); function logged() { var url = window.location.href; if (url.indexOf('?') > -1){ url += '&logged=1' }else{ url += '?logged=1' } window.location.href = url; } //////////////////////// Ajax forms ////////////////////////// (function(){ $(document).on('submit','.api_form',function(e){ var form = this; var op = form.elements["op"] ; var u = form.elements["u"] ; var v = form.elements["v"] ; var apikey = form.elements["apikey"] ; var p = form.elements["p"] ; var p2 = form.elements["p2"] ; var respDiv = form.getElementsByClassName('api_response_div')[0]; if(!form.getAttribute("data-v")) { //data-attribute doesn't exist }else{ if (form.getAttribute("data-v").indexOf('-') > -1){ var domd5 = ''; form.getAttribute("data-v").split("-").forEach(function (item) { if(item =="p"){ domd5 += p.value; }else if (item =="u"){ domd5 += u.value; }else{ domd5 += item; } }); v.value = md5( domd5 ) ; } } var r = new XMLHttpRequest(); loader_form.style.opacity = "1"; r.onreadystatechange = function(){ if (r.readyState == 4 && r.status == 200) { apiResponse(r.responseText,form); if (r.responseText.startsWith("")){form.reset();} } } r.open('POST', form.action); var data = new FormData(form); r.send(data); e.preventDefault(); }); function apiResponse(r,form) { var op = form.elements["op"] ; loader_form.style.opacity = "0"; resetRecaptcha(); var obj = JSON.parse(r); var respDiv = form.getElementsByClassName('api_response_div')[0]; // if logged action if (obj._status.startsWith("OK") && op.value == "login"){ logged(); return; } if (obj._status.startsWith("OK")) { respDiv.innerHTML = '
    ×'+ obj._message +'
    '; } else { respDiv.innerHTML = '
    ×'+ obj._message +'
    '; } addClass(respDiv, 'active'); setTimeout(function(){ removeClass(respDiv, 'active'); },5000); } })(); //////////////////////// Ajax CART ////////////////////////// (function(){ jQuery(document.body).on('click', '.addtocart_btn' ,function(event){ event.preventDefault(); document.getElementsByClassName("loader_form")[0].style.opacity = "1"; var owner_id_var = $(this).data('ownerid'); owner_id_var = owner_id_var.trim(); if (owner_id_var == "") {owner_id_var = "0";} if ($(this).is('[data-options]')) { var de_options = $(this).attr('data-options'); de_options = de_options.trim(); if (de_options == "") {de_options = "0";} } if ($(this).is('[data-optionsselected]')) { var optionsselected = $(this).attr('data-optionsselected'); optionsselected = optionsselected.trim(); if (optionsselected == "") {optionsselected = "0";} } var datax = new FormData(); datax.append('item_title', $(this).data('itemtitle')); datax.append('nl', lang_parent); datax.append('owner_id', owner_id_var ); datax.append('owner_email', $(this).data('selected')); datax.append('item_key1', $(this).data('itemkey1')); datax.append('item_key2', $(this).data('itemkey2')); datax.append('quantity', $(this).data('quantity')); datax.append('optionsselected', optionsselected); datax.append('options', de_options); datax.append('apikey', cartapi); datax.append('v', md5(cartapi+owner_id_var ) ); datax.append('op', 'putcart'); var r = new XMLHttpRequest(); r.open('POST', mywebrooturl + '/api/v1/cart',true); r.setRequestHeader("Accept", "application/json"); r.onreadystatechange = function(){ document.getElementsByClassName("loader_form")[0].style.opacity = "0"; if (r.readyState == 4 && r.status == 200) { resetRecaptcha(); //document.getElementsByClassName('header-nav')[0].innerHTML += r.responseText; var obj = JSON.parse(r.responseText); if (obj._status == "OK"){ UpdateCart(); swal({ title: obj.message, text: obj.message1, icon: "success", buttons: { cancel: obj.close, catch: { text: obj.message2, value: "viewcart", }, }, }).then((value) => { switch (value) { case "viewcart": window.location = mywebrooturl +"/"+lang_parent+"/cart-"+lang_parent+".html"; break; default: } }); } if (obj._status == "directcheckout"){ window.location = mywebrooturl +"/"+lang_parent+"/checkouts-"+lang_parent+".html"; } if (obj._status == "Error"){ swal({ title: obj.message, text: obj.message1, icon: "error", buttons: { cancel: obj.close, catch: { text: obj.message2, value: "login", }, }, }).then((value) => { switch (value) { case "login": window.location = mywebrooturl +"/"+lang_parent+"/account-"+lang_parent+".html"; break; default: } }); } if (obj._status == "Errorqty"){ swal({ title: obj.message, text: obj.message1, icon: "warning", buttons: { cancel: obj.close, }, }).then((value) => { switch (value) { case "Errorqty": break; default: } }); } if (obj._status == "Erroroption"){ swal({ title: obj.message, text: obj.message1, icon: "warning", buttons: { cancel: obj.close, catch: { text: obj.message2, value: "login", }, }, }).then((value) => { switch (value) { case "login": window.location = obj.link; break; default: } }); } if (obj._message == "Blocked"){ swal({ title: obj._message , text: "Sorry you are blocked from using this method.", icon: "error", buttons: { cancel: "Close", }, }).then((value) => { switch (value) { case "viewcart": break; default: } }); } } } r.send(datax); }); jQuery(document.body).on('click', '.addtowish_btn' ,function(event){ event.preventDefault(); document.getElementsByClassName("loader_form")[0].style.opacity = "1"; var owner_id_var = $(this).data('ownerid'); if (owner_id_var == "") {owner_id_var = "0";} owner_id_var = owner_id_var.trim(); var datax = new FormData(); datax.append('item_title', $(this).data('itemtitle')); datax.append('nl', lang_parent); datax.append('owner_id', owner_id_var ); datax.append('owner_email', $(this).data('selected')); datax.append('item_key1', $(this).data('itemkey1')); datax.append('item_key2', $(this).data('itemkey2')); datax.append('apikey', cartapi); datax.append('v', md5(cartapi+owner_id_var ) ); datax.append('op', 'putwish'); var r = new XMLHttpRequest(); r.open('POST', mywebrooturl + '/api/v1/cart',true); r.setRequestHeader("Accept", "application/json"); r.onreadystatechange = function(){ document.getElementsByClassName("loader_form")[0].style.opacity = "0"; if (r.readyState == 4 && r.status == 200) { resetRecaptcha(); var obj = JSON.parse(r.responseText); if (obj._status == "OK"){ swal({ title: obj.message, text: obj.message1, icon: "success", buttons: { cancel: obj.close, catch: { text: obj.message2, value: "viewcart", }, }, }).then((value) => { switch (value) { case "viewcart": window.location = mywebrooturl +"/"+lang_parent+"/wishlist-"+lang_parent+".html"; break; default: } }); } if (obj._status == "Error"){ swal({ title: obj.message, text: obj.message1, icon: "error", buttons: { cancel: obj.close, catch: { text: obj.message2, value: "login", }, }, }).then((value) => { switch (value) { case "login": window.location = mywebrooturl +"/"+lang_parent+"/login-"+lang_parent+".html"; break; default: } }); } if (obj._message == "Blocked"){ swal({ title: obj._message , text: "Sorry you are blocked from using this method.", icon: "error", buttons: { cancel: "Close", }, }).then((value) => { switch (value) { case "viewcart": break; default: } }); } } } r.send(datax); }); jQuery(document.body).on('click', '.loadmore_reviews' ,function(event){ event.preventDefault(); document.getElementsByClassName("loader_form")[0].style.opacity = "1"; var datarev = new FormData(); datarev.append('nl', lang_parent); datarev.append('item_key1', $(this).data('itemkey1')); datarev.append('pagelimit', $(this).data('pagelimit')); datarev.append('pagex', $(this).attr("data-pagex")); datarev.append('item_key2', $(this).data('itemkey2')); datarev.append('apikey', ratingapi); datarev.append('v', md5( ratingapi ) ); datarev.append('op', 'get'); var rx = new XMLHttpRequest(); rx.open('POST', mywebrooturl + '/api/v1/rating',true); $(this).attr("data-pagex",+$(this).attr("data-pagex") + 1); rx.onreadystatechange = function(){ document.getElementsByClassName("loader_form")[0].style.opacity = "0"; if (rx.readyState == 4 && rx.status == 200) { //document.getElementsByClassName('header-nav')[0].innerHTML += rx.responseText; var obj = JSON.parse(rx.responseText); var Holder_div = document.getElementsByClassName("reviews_pulled")[0]; if (obj._status == "OK"){ for (var key in obj) { if(obj[key].hasOwnProperty('fields') ) { var rating1 = ""; var rating2 = ""; var rating3 = ""; var rating4 = ""; var rating5 = ""; if(obj[key].hasOwnProperty('fields') && obj[key]['fields'].hasOwnProperty('rating')){ if (+obj[key]['fields']["rating"]['value'] >= 1 ){ rating1 = "selected"; } if (+obj[key]['fields']["rating"]['value'] >= 2 ){ rating2 = "selected"; } if (+obj[key]['fields']["rating"]['value'] >= 3 ){ rating3 = "selected"; } if (+obj[key]['fields']["rating"]['value'] >= 4 ){ rating4 = "selected"; } if (+obj[key]['fields']["rating"]['value'] >= 5 ){ rating5 = "selected"; } } var des =''; if (obj[key].hasOwnProperty('fields') && obj[key]['fields'].hasOwnProperty('description') && obj[key]['fields']["description"]['value'].length > 1 ){ des = obj[key]['fields']["description"]['value']; }else{ des ='...'; } Holder_div.innerHTML +='
    '+obj[key]["title"]+' - '+obj[key]["time_passed"]+'
    " '+des+' "
    '; } } } if (obj._status == "Error"){ swal({ title: obj.message, text: obj.message1, icon: "error", buttons: { cancel: obj.close, catch: { text: obj.message2, value: "login", }, }, }).then((value) => { switch (value) { case "login": window.location = mywebrooturl +"/"+lang_parent+"/login-"+lang_parent+".html"; break; default: } }); } if (obj._message == "Blocked"){ swal({ title: obj._message , text: "Sorry you are blocked from using this method.", icon: "error", buttons: { cancel: "Close", }, }).then((value) => { switch (value) { case "viewcart": break; default: } }); } } } rx.send(datarev); }); })(); });// end of document ready })(jQuery); /* * JavaScript MD5 * https://github.com/blueimp/JavaScript-MD5 * * Copyright 2011, Sebastian Tschan * https://blueimp.net * * Licensed under the MIT license: * https://opensource.org/licenses/MIT * * Based on * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message * Digest Algorithm, as defined in RFC 1321. * Version 2.2 Copyright (C) Paul Johnston 1999 - 2009 * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet * Distributed under the BSD License * See http://pajhome.org.uk/crypt/md5 for more info. */ /* global define */ ;(function ($) { 'use strict' /* * Add integers, wrapping at 2^32. This uses 16-bit operations internally * to work around bugs in some JS interpreters. */ function safeAdd (x, y) { var lsw = (x & 0xffff) + (y & 0xffff) var msw = (x >> 16) + (y >> 16) + (lsw >> 16) return (msw << 16) | (lsw & 0xffff) } /* * Bitwise rotate a 32-bit number to the left. */ function bitRotateLeft (num, cnt) { return (num << cnt) | (num >>> (32 - cnt)) } /* * These functions implement the four basic operations the algorithm uses. */ function md5cmn (q, a, b, x, s, t) { return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b) } function md5ff (a, b, c, d, x, s, t) { return md5cmn((b & c) | (~b & d), a, b, x, s, t) } function md5gg (a, b, c, d, x, s, t) { return md5cmn((b & d) | (c & ~d), a, b, x, s, t) } function md5hh (a, b, c, d, x, s, t) { return md5cmn(b ^ c ^ d, a, b, x, s, t) } function md5ii (a, b, c, d, x, s, t) { return md5cmn(c ^ (b | ~d), a, b, x, s, t) } /* * Calculate the MD5 of an array of little-endian words, and a bit length. */ function binlMD5 (x, len) { /* append padding */ x[len >> 5] |= 0x80 << (len % 32) x[((len + 64) >>> 9 << 4) + 14] = len var i var olda var oldb var oldc var oldd var a = 1732584193 var b = -271733879 var c = -1732584194 var d = 271733878 for (i = 0; i < x.length; i += 16) { olda = a oldb = b oldc = c oldd = d a = md5ff(a, b, c, d, x[i], 7, -680876936) d = md5ff(d, a, b, c, x[i + 1], 12, -389564586) c = md5ff(c, d, a, b, x[i + 2], 17, 606105819) b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330) a = md5ff(a, b, c, d, x[i + 4], 7, -176418897) d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426) c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341) b = md5ff(b, c, d, a, x[i + 7], 22, -45705983) a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416) d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417) c = md5ff(c, d, a, b, x[i + 10], 17, -42063) b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162) a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682) d = md5ff(d, a, b, c, x[i + 13], 12, -40341101) c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290) b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329) a = md5gg(a, b, c, d, x[i + 1], 5, -165796510) d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632) c = md5gg(c, d, a, b, x[i + 11], 14, 643717713) b = md5gg(b, c, d, a, x[i], 20, -373897302) a = md5gg(a, b, c, d, x[i + 5], 5, -701558691) d = md5gg(d, a, b, c, x[i + 10], 9, 38016083) c = md5gg(c, d, a, b, x[i + 15], 14, -660478335) b = md5gg(b, c, d, a, x[i + 4], 20, -405537848) a = md5gg(a, b, c, d, x[i + 9], 5, 568446438) d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690) c = md5gg(c, d, a, b, x[i + 3], 14, -187363961) b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501) a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467) d = md5gg(d, a, b, c, x[i + 2], 9, -51403784) c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473) b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734) a = md5hh(a, b, c, d, x[i + 5], 4, -378558) d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463) c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562) b = md5hh(b, c, d, a, x[i + 14], 23, -35309556) a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060) d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353) c = md5hh(c, d, a, b, x[i + 7], 16, -155497632) b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640) a = md5hh(a, b, c, d, x[i + 13], 4, 681279174) d = md5hh(d, a, b, c, x[i], 11, -358537222) c = md5hh(c, d, a, b, x[i + 3], 16, -722521979) b = md5hh(b, c, d, a, x[i + 6], 23, 76029189) a = md5hh(a, b, c, d, x[i + 9], 4, -640364487) d = md5hh(d, a, b, c, x[i + 12], 11, -421815835) c = md5hh(c, d, a, b, x[i + 15], 16, 530742520) b = md5hh(b, c, d, a, x[i + 2], 23, -995338651) a = md5ii(a, b, c, d, x[i], 6, -198630844) d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415) c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905) b = md5ii(b, c, d, a, x[i + 5], 21, -57434055) a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571) d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606) c = md5ii(c, d, a, b, x[i + 10], 15, -1051523) b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799) a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359) d = md5ii(d, a, b, c, x[i + 15], 10, -30611744) c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380) b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649) a = md5ii(a, b, c, d, x[i + 4], 6, -145523070) d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379) c = md5ii(c, d, a, b, x[i + 2], 15, 718787259) b = md5ii(b, c, d, a, x[i + 9], 21, -343485551) a = safeAdd(a, olda) b = safeAdd(b, oldb) c = safeAdd(c, oldc) d = safeAdd(d, oldd) } return [a, b, c, d] } /* * Convert an array of little-endian words to a string */ function binl2rstr (input) { var i var output = '' var length32 = input.length * 32 for (i = 0; i < length32; i += 8) { output += String.fromCharCode((input[i >> 5] >>> (i % 32)) & 0xff) } return output } /* * Convert a raw string to an array of little-endian words * Characters >255 have their high-byte silently ignored. */ function rstr2binl (input) { var i var output = [] output[(input.length >> 2) - 1] = undefined for (i = 0; i < output.length; i += 1) { output[i] = 0 } var length8 = input.length * 8 for (i = 0; i < length8; i += 8) { output[i >> 5] |= (input.charCodeAt(i / 8) & 0xff) << (i % 32) } return output } /* * Calculate the MD5 of a raw string */ function rstrMD5 (s) { return binl2rstr(binlMD5(rstr2binl(s), s.length * 8)) } /* * Calculate the HMAC-MD5, of a key and some data (raw strings) */ function rstrHMACMD5 (key, data) { var i var bkey = rstr2binl(key) var ipad = [] var opad = [] var hash ipad[15] = opad[15] = undefined if (bkey.length > 16) { bkey = binlMD5(bkey, key.length * 8) } for (i = 0; i < 16; i += 1) { ipad[i] = bkey[i] ^ 0x36363636 opad[i] = bkey[i] ^ 0x5c5c5c5c } hash = binlMD5(ipad.concat(rstr2binl(data)), 512 + data.length * 8) return binl2rstr(binlMD5(opad.concat(hash), 512 + 128)) } /* * Convert a raw string to a hex string */ function rstr2hex (input) { var hexTab = '0123456789abcdef' var output = '' var x var i for (i = 0; i < input.length; i += 1) { x = input.charCodeAt(i) output += hexTab.charAt((x >>> 4) & 0x0f) + hexTab.charAt(x & 0x0f) } return output } /* * Encode a string as utf-8 */ function str2rstrUTF8 (input) { return unescape(encodeURIComponent(input)) } /* * Take string arguments and return either raw or hex encoded strings */ function rawMD5 (s) { return rstrMD5(str2rstrUTF8(s)) } function hexMD5 (s) { return rstr2hex(rawMD5(s)) } function rawHMACMD5 (k, d) { return rstrHMACMD5(str2rstrUTF8(k), str2rstrUTF8(d)) } function hexHMACMD5 (k, d) { return rstr2hex(rawHMACMD5(k, d)) } function md5 (string, key, raw) { if (!key) { if (!raw) { return hexMD5(string) } return rawMD5(string) } if (!raw) { return hexHMACMD5(key, string) } return rawHMACMD5(key, string) } if (typeof define === 'function' && define.amd) { define(function () { return md5 }) } else if (typeof module === 'object' && module.exports) { module.exports = md5 } else { $.md5 = md5 } })(this) var resetRecaptcha = function () { try { grecaptcha.reset(0);} catch(err) {} try { grecaptcha.reset(1);} catch(err) {} try { grecaptcha.reset(2);} catch(err) {} try { grecaptcha.reset(3);} catch(err) {} try { grecaptcha.reset(4);} catch(err) {} try { grecaptcha.reset(5);} catch(err) {} try { grecaptcha.reset(6);} catch(err) {} try { grecaptcha.reset(7);} catch(err) {} }; function hasClass(element, classToCheck) { if (element.className != "") { var classArray = element.className.split(" "); for (i = 0; i < classArray.length; i++) { if (classArray[i] == classToCheck) { return true; break; } } } } function addClass(element, classToAdd) { if (element != null && element != undefined) { if (!hasClass(element, classToAdd)) { if (element.className != "") { element.className = element.className+" "+classToAdd; } else { element.className = classToAdd; } } } } function removeClass(element, classToRemove) { if ((element.className == classToRemove) || (element.className == "")) { element.className = ""; } else { var classArray = element.className.split(" "); var newClass = ""; for (i = 0; i < classArray.length; i++) { if (classArray[i] != classToRemove) { newClass += classArray[i]+" "; } } element.className = newClass.trim(); } } function serialize (form) { 'use strict'; var i, j, len, jLen, formElement, q = []; function urlencode (str) { // http://kevin.vanzonneveld.net // Tilde should be allowed unescaped in future versions of PHP (as reflected below), // but if you want to reflect current PHP behavior, // you would need to add ".replace(/~/g, '%7E');" to the following. return encodeURIComponent(str).replace(/!/g, '%21').replace(/'/g, '%27').replace(/\(/g, '%28'). replace(/\)/g, '%29').replace(/\*/g, '%2A').replace(/%20/g, '+').replace(/~/g, '%7E'); } function addNameValue(name, value) { q.push(urlencode(name) + '=' + urlencode(value)); } if (!form || !form.nodeName || form.nodeName.toLowerCase() !== 'form') { throw 'You must supply a form element'; } for (i = 0, len = form.elements.length; i < len; i++) { formElement = form.elements[i]; if (formElement.name === '' || formElement.disabled) { continue; } switch (formElement.nodeName.toLowerCase()) { case 'input': switch (formElement.type) { case 'text': case 'hidden': case 'password': case 'button': // Not submitted when submitting form manually, though jQuery does serialize this and it can be an HTML4 successful control case 'submit': case 'email': addNameValue(formElement.name, formElement.value); break; case 'checkbox': case 'tel': case 'radio': if (formElement.checked) { addNameValue(formElement.name, formElement.value); } break; case 'file': //addNameValue(formElement.name, formElement.value); // Will work and part of HTML4 "successful controls", but not used in jQuery break; case 'reset': break; } break; case 'textarea': addNameValue(formElement.name, formElement.value); break; case 'select': switch (formElement.type) { case 'select-one': addNameValue(formElement.name, formElement.value); break; case 'select-multiple': for (j = 0, jLen = formElement.options.length; j < jLen; j++) { if (formElement.options[j].selected) { addNameValue(formElement.name, formElement.options[j].value); } } break; } break; case 'button': // jQuery does not submit these, though it is an HTML4 successful control switch (formElement.type) { case 'reset': case 'submit': case 'button': addNameValue(formElement.name, formElement.value); break; } break; } } return q.join('&'); } /* * International Telephone Input v11.0.14 * https://github.com/jackocnr/intl-tel-input.git * Licensed under the MIT license */ // wrap in UMD - see https://github.com/umdjs/umd/blob/master/jqueryPluginCommonjs.js (function(factory) { if (typeof define === "function" && define.amd) { define([ "jquery" ], function($) { factory($, window, document); }); } else if (typeof module === "object" && module.exports) { module.exports = factory(require("jquery"), window, document); } else { factory(jQuery, window, document); } })(function($, window, document, undefined) { "use strict"; // these vars persist through all instances of the plugin var pluginName = "intlTelInput", id = 1, // give each instance it's own id for namespaced event handling defaults = { // whether or not to allow the dropdown allowDropdown: true, // if there is just a dial code in the input: remove it on blur, and re-add it on focus autoHideDialCode: true, // add a placeholder in the input with an example number for the selected country autoPlaceholder: "polite", // modify the auto placeholder customPlaceholder: null, // append menu to a specific element dropdownContainer: "", // don't display these countries excludeCountries: [], // format the input value during initialisation and on setNumber formatOnDisplay: true, // geoIp lookup function geoIpLookup: null, // initial country initialCountry: "", // don't insert international dial codes nationalMode: true, // display only these countries onlyCountries: [], // number type to use for placeholders placeholderNumberType: "MOBILE", // the countries at the top of the list. defaults to united states and united kingdom preferredCountries: [ "us", "gb" ], // display the country dial code next to the selected flag so it's not part of the typed number separateDialCode: false, // specify the path to the libphonenumber script to enable validation/formatting utilsScript: "" }, keys = { UP: 38, DOWN: 40, ENTER: 13, ESC: 27, PLUS: 43, A: 65, Z: 90, SPACE: 32, TAB: 9 }, // https://en.wikipedia.org/wiki/List_of_North_American_Numbering_Plan_area_codes#Non-geographic_area_codes regionlessNanpNumbers = [ "800", "822", "833", "844", "855", "866", "877", "880", "881", "882", "883", "884", "885", "886", "887", "888", "889" ]; // keep track of if the window.load event has fired as impossible to check after the fact $(window).on("load", function() { // UPDATE: use a public static field so we can fudge it in the tests $.fn[pluginName].windowLoaded = true; }); function Plugin(element, options) { this.telInput = $(element); this.options = $.extend({}, defaults, options); // event namespace this.ns = "." + pluginName + id++; // Chrome, FF, Safari, IE9+ this.isGoodBrowser = Boolean(element.setSelectionRange); this.hadInitialPlaceholder = Boolean($(element).attr("placeholder")); } Plugin.prototype = { _init: function() { // if in nationalMode, disable options relating to dial codes if (this.options.nationalMode) { this.options.autoHideDialCode = false; } // if separateDialCode then doesn't make sense to A) insert dial code into input (autoHideDialCode), and B) display national numbers (because we're displaying the country dial code next to them) if (this.options.separateDialCode) { this.options.autoHideDialCode = this.options.nationalMode = false; } // we cannot just test screen size as some smartphones/website meta tags will report desktop resolutions // Note: for some reason jasmine breaks if you put this in the main Plugin function with the rest of these declarations // Note: to target Android Mobiles (and not Tablets), we must find "Android" and "Mobile" this.isMobile = /Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent); if (this.isMobile) { // trigger the mobile dropdown css $("body").addClass("iti-mobile"); // on mobile, we want a full screen dropdown, so we must append it to the body if (!this.options.dropdownContainer) { this.options.dropdownContainer = "body"; } } // we return these deferred objects from the _init() call so they can be watched, and then we resolve them when each specific request returns // Note: again, jasmine breaks when I put these in the Plugin function this.autoCountryDeferred = new $.Deferred(); this.utilsScriptDeferred = new $.Deferred(); // in various situations there could be no country selected initially, but we need to be able to assume this variable exists this.selectedCountryData = {}; // process all the data: onlyCountries, excludeCountries, preferredCountries etc this._processCountryData(); // generate the markup this._generateMarkup(); // set the initial state of the input value and the selected flag this._setInitialState(); // start all of the event listeners: autoHideDialCode, input keydown, selectedFlag click this._initListeners(); // utils script, and auto country this._initRequests(); // return the deferreds return [ this.autoCountryDeferred, this.utilsScriptDeferred ]; }, /******************** * PRIVATE METHODS ********************/ // prepare all of the country data, including onlyCountries, excludeCountries and preferredCountries options _processCountryData: function() { // process onlyCountries or excludeCountries array if present this._processAllCountries(); // process the countryCodes map this._processCountryCodes(); // process the preferredCountries this._processPreferredCountries(); }, // add a country code to this.countryCodes _addCountryCode: function(iso2, dialCode, priority) { if (!(dialCode in this.countryCodes)) { this.countryCodes[dialCode] = []; } var index = priority || 0; this.countryCodes[dialCode][index] = iso2; }, // process onlyCountries or excludeCountries array if present _processAllCountries: function() { if (this.options.onlyCountries.length) { var lowerCaseOnlyCountries = this.options.onlyCountries.map(function(country) { return country.toLowerCase(); }); this.countries = allCountries.filter(function(country) { return lowerCaseOnlyCountries.indexOf(country.iso2) > -1; }); } else if (this.options.excludeCountries.length) { var lowerCaseExcludeCountries = this.options.excludeCountries.map(function(country) { return country.toLowerCase(); }); this.countries = allCountries.filter(function(country) { return lowerCaseExcludeCountries.indexOf(country.iso2) === -1; }); } else { this.countries = allCountries; } }, // process the countryCodes map _processCountryCodes: function() { this.countryCodes = {}; for (var i = 0; i < this.countries.length; i++) { var c = this.countries[i]; this._addCountryCode(c.iso2, c.dialCode, c.priority); // area codes if (c.areaCodes) { for (var j = 0; j < c.areaCodes.length; j++) { // full dial code is country code + dial code this._addCountryCode(c.iso2, c.dialCode + c.areaCodes[j]); } } } }, // process preferred countries - iterate through the preferences, fetching the country data for each one _processPreferredCountries: function() { this.preferredCountries = []; for (var i = 0; i < this.options.preferredCountries.length; i++) { var countryCode = this.options.preferredCountries[i].toLowerCase(), countryData = this._getCountryData(countryCode, false, true); if (countryData) { this.preferredCountries.push(countryData); } } }, // generate all of the markup for the plugin: the selected flag overlay, and the dropdown _generateMarkup: function() { // prevent autocomplete as there's no safe, cross-browser event we can react to, so it can easily put the plugin in an inconsistent state e.g. the wrong flag selected for the autocompleted number, which on submit could mean the wrong number is saved (esp in nationalMode) this.telInput.attr("autocomplete", "off"); // containers (mostly for positioning) var parentClass = "intl-tel-input"; if (this.options.allowDropdown) { parentClass += " allow-dropdown"; } if (this.options.separateDialCode) { parentClass += " separate-dial-code"; } this.telInput.wrap($("
    ", { "class": parentClass })); this.flagsContainer = $("
    ", { "class": "flag-container" }).insertBefore(this.telInput); // currently selected flag (displayed to left of input) var selectedFlag = $("
    ", { "class": "selected-flag" }); selectedFlag.appendTo(this.flagsContainer); this.selectedFlagInner = $("
    ", { "class": "iti-flag" }).appendTo(selectedFlag); if (this.options.separateDialCode) { this.selectedDialCode = $("
    ", { "class": "selected-dial-code" }).appendTo(selectedFlag); } if (this.options.allowDropdown) { // make element focusable and tab naviagable selectedFlag.attr("tabindex", "0"); // CSS triangle $("
    ", { "class": "iti-arrow" }).appendTo(selectedFlag); // country dropdown: preferred countries, then divider, then all countries this.countryList = $("
      ", { "class": "country-list hide" }); if (this.preferredCountries.length) { this._appendListItems(this.preferredCountries, "preferred"); $("
    • ", { "class": "divider" }).appendTo(this.countryList); } this._appendListItems(this.countries, ""); // this is useful in lots of places this.countryListItems = this.countryList.children(".country"); // create dropdownContainer markup if (this.options.dropdownContainer) { this.dropdown = $("
      ", { "class": "intl-tel-input iti-container" }).append(this.countryList); } else { this.countryList.appendTo(this.flagsContainer); } } else { // a little hack so we don't break anything this.countryListItems = $(); } }, // add a country
    • to the countryList
        container _appendListItems: function(countries, className) { // we create so many DOM elements, it is faster to build a temp string // and then add everything to the DOM in one go at the end var tmp = ""; // for each country for (var i = 0; i < countries.length; i++) { var c = countries[i]; // open the list item tmp += "
      • "; // add the flag tmp += "
        "; // and the country name and dial code tmp += "" + c.name + ""; tmp += "+" + c.dialCode + ""; // close the list item tmp += "
      • "; } this.countryList.append(tmp); }, // set the initial state of the input value and the selected flag by: // 1. extracting a dial code from the given number // 2. using explicit initialCountry // 3. picking the first preferred country // 4. picking the first country _setInitialState: function() { var val = this.telInput.val(); // if we already have a dial code, and it's not a regionlessNanp we can go ahead and set the flag, else fall back to default if (this._getDialCode(val) && !this._isRegionlessNanp(val)) { this._updateFlagFromNumber(val); } else if (this.options.initialCountry !== "auto") { // see if we should select a flag if (this.options.initialCountry) { this._setFlag(this.options.initialCountry.toLowerCase()); } else { // no dial code and no initialCountry, so default to first in list this.defaultCountry = this.preferredCountries.length ? this.preferredCountries[0].iso2 : this.countries[0].iso2; if (!val) { this._setFlag(this.defaultCountry); } } // if empty and no nationalMode and no autoHideDialCode then insert the default dial code if (!val && !this.options.nationalMode && !this.options.autoHideDialCode && !this.options.separateDialCode) { this.telInput.val("+" + this.selectedCountryData.dialCode); } } // NOTE: if initialCountry is set to auto, that will be handled separately // format if (val) { // this wont be run after _updateDialCode as that's only called if no val this._updateValFromNumber(val); } }, // initialise the main event listeners: input keyup, and click selected flag _initListeners: function() { this._initKeyListeners(); if (this.options.autoHideDialCode) { this._initFocusListeners(); } if (this.options.allowDropdown) { this._initDropdownListeners(); } }, // initialise the dropdown listeners _initDropdownListeners: function() { var that = this; // hack for input nested inside label: clicking the selected-flag to open the dropdown would then automatically trigger a 2nd click on the input which would close it again var label = this.telInput.closest("label"); if (label.length) { label.on("click" + this.ns, function(e) { // if the dropdown is closed, then focus the input, else ignore the click if (that.countryList.hasClass("hide")) { that.telInput.focus(); } else { e.preventDefault(); } }); } // toggle country dropdown on click var selectedFlag = this.selectedFlagInner.parent(); selectedFlag.on("click" + this.ns, function(e) { // only intercept this event if we're opening the dropdown // else let it bubble up to the top ("click-off-to-close" listener) // we cannot just stopPropagation as it may be needed to close another instance if (that.countryList.hasClass("hide") && !that.telInput.prop("disabled") && !that.telInput.prop("readonly")) { that._showDropdown(); } }); // open dropdown list if currently focused this.flagsContainer.on("keydown" + that.ns, function(e) { var isDropdownHidden = that.countryList.hasClass("hide"); if (isDropdownHidden && (e.which == keys.UP || e.which == keys.DOWN || e.which == keys.SPACE || e.which == keys.ENTER)) { // prevent form from being submitted if "ENTER" was pressed e.preventDefault(); // prevent event from being handled again by document e.stopPropagation(); that._showDropdown(); } // allow navigation from dropdown to input on TAB if (e.which == keys.TAB) { that._closeDropdown(); } }); }, // init many requests: utils script / geo ip lookup _initRequests: function() { var that = this; // if the user has specified the path to the utils script, fetch it on window.load, else resolve if (this.options.utilsScript) { // if the plugin is being initialised after the window.load event has already been fired if ($.fn[pluginName].windowLoaded) { $.fn[pluginName].loadUtils(this.options.utilsScript, this.utilsScriptDeferred); } else { // wait until the load event so we don't block any other requests e.g. the flags image $(window).on("load", function() { $.fn[pluginName].loadUtils(that.options.utilsScript, that.utilsScriptDeferred); }); } } else { this.utilsScriptDeferred.resolve(); } if (this.options.initialCountry === "auto") { this._loadAutoCountry(); } else { this.autoCountryDeferred.resolve(); } }, // perform the geo ip lookup _loadAutoCountry: function() { var that = this; // 3 options: // 1) already loaded (we're done) // 2) not already started loading (start) // 3) already started loading (do nothing - just wait for loading callback to fire) if ($.fn[pluginName].autoCountry) { this.handleAutoCountry(); } else if (!$.fn[pluginName].startedLoadingAutoCountry) { // don't do this twice! $.fn[pluginName].startedLoadingAutoCountry = true; if (typeof this.options.geoIpLookup === "function") { this.options.geoIpLookup(function(countryCode) { $.fn[pluginName].autoCountry = countryCode.toLowerCase(); // tell all instances the auto country is ready // TODO: this should just be the current instances // UPDATE: use setTimeout in case their geoIpLookup function calls this callback straight away (e.g. if they have already done the geo ip lookup somewhere else). Using setTimeout means that the current thread of execution will finish before executing this, which allows the plugin to finish initialising. setTimeout(function() { $(".intl-tel-input input").intlTelInput("handleAutoCountry"); }); }); } } }, // initialize any key listeners _initKeyListeners: function() { var that = this; // update flag on keyup // (keep this listener separate otherwise the setTimeout breaks all the tests) this.telInput.on("keyup" + this.ns, function() { if (that._updateFlagFromNumber(that.telInput.val())) { that._triggerCountryChange(); } }); // update flag on cut/paste events (now supported in all major browsers) this.telInput.on("cut" + this.ns + " paste" + this.ns, function() { // hack because "paste" event is fired before input is updated setTimeout(function() { if (that._updateFlagFromNumber(that.telInput.val())) { that._triggerCountryChange(); } }); }); }, // adhere to the input's maxlength attr _cap: function(number) { var max = this.telInput.attr("maxlength"); return max && number.length > max ? number.substr(0, max) : number; }, // listen for mousedown, focus and blur _initFocusListeners: function() { var that = this; // mousedown decides where the cursor goes, so if we're focusing we must preventDefault as we'll be inserting the dial code, and we want the cursor to be at the end no matter where they click this.telInput.on("mousedown" + this.ns, function(e) { if (!that.telInput.is(":focus") && !that.telInput.val()) { e.preventDefault(); // but this also cancels the focus, so we must trigger that manually that.telInput.focus(); } }); // on focus: if empty, insert the dial code for the currently selected flag this.telInput.on("focus" + this.ns, function(e) { if (!that.telInput.val() && !that.telInput.prop("readonly") && that.selectedCountryData.dialCode) { // insert the dial code that.telInput.val("+" + that.selectedCountryData.dialCode); // after auto-inserting a dial code, if the first key they hit is '+' then assume they are entering a new number, so remove the dial code. use keypress instead of keydown because keydown gets triggered for the shift key (required to hit the + key), and instead of keyup because that shows the new '+' before removing the old one that.telInput.one("keypress.plus" + that.ns, function(e) { if (e.which == keys.PLUS) { that.telInput.val(""); } }); // after tabbing in, make sure the cursor is at the end we must use setTimeout to get outside of the focus handler as it seems the selection happens after that setTimeout(function() { var input = that.telInput[0]; if (that.isGoodBrowser) { var len = that.telInput.val().length; input.setSelectionRange(len, len); } }); } }); // on blur or form submit: if just a dial code then remove it var form = this.telInput.prop("form"); if (form) { $(form).on("submit" + this.ns, function() { that._removeEmptyDialCode(); }); } this.telInput.on("blur" + this.ns, function() { that._removeEmptyDialCode(); }); }, _removeEmptyDialCode: function() { var value = this.telInput.val(), startsPlus = value.charAt(0) == "+"; if (startsPlus) { var numeric = this._getNumeric(value); // if just a plus, or if just a dial code if (!numeric || this.selectedCountryData.dialCode == numeric) { this.telInput.val(""); } } // remove the keypress listener we added on focus this.telInput.off("keypress.plus" + this.ns); }, // extract the numeric digits from the given string _getNumeric: function(s) { return s.replace(/\D/g, ""); }, // show the dropdown _showDropdown: function() { this._setDropdownPosition(); // update highlighting and scroll to active list item var activeListItem = this.countryList.children(".active"); if (activeListItem.length) { this._highlightListItem(activeListItem); this._scrollTo(activeListItem); } // bind all the dropdown-related listeners: mouseover, click, click-off, keydown this._bindDropdownListeners(); // update the arrow this.selectedFlagInner.children(".iti-arrow").addClass("up"); }, // decide where to position dropdown (depends on position within viewport, and scroll) _setDropdownPosition: function() { var that = this; if (this.options.dropdownContainer) { this.dropdown.appendTo(this.options.dropdownContainer); } // show the menu and grab the dropdown height this.dropdownHeight = this.countryList.removeClass("hide").outerHeight(); if (!this.isMobile) { var pos = this.telInput.offset(), inputTop = pos.top, windowTop = $(window).scrollTop(), // dropdownFitsBelow = (dropdownBottom < windowBottom) dropdownFitsBelow = inputTop + this.telInput.outerHeight() + this.dropdownHeight < windowTop + $(window).height(), dropdownFitsAbove = inputTop - this.dropdownHeight > windowTop; // by default, the dropdown will be below the input. If we want to position it above the input, we add the dropup class. this.countryList.toggleClass("dropup", !dropdownFitsBelow && dropdownFitsAbove); // if dropdownContainer is enabled, calculate postion if (this.options.dropdownContainer) { // by default the dropdown will be directly over the input because it's not in the flow. If we want to position it below, we need to add some extra top value. var extraTop = !dropdownFitsBelow && dropdownFitsAbove ? 0 : this.telInput.innerHeight(); // calculate placement this.dropdown.css({ top: inputTop + extraTop, left: pos.left }); // close menu on window scroll $(window).on("scroll" + this.ns, function() { that._closeDropdown(); }); } } }, // we only bind dropdown listeners when the dropdown is open _bindDropdownListeners: function() { var that = this; // when mouse over a list item, just highlight that one // we add the class "highlight", so if they hit "enter" we know which one to select this.countryList.on("mouseover" + this.ns, ".country", function(e) { that._highlightListItem($(this)); }); // listen for country selection this.countryList.on("click" + this.ns, ".country", function(e) { that._selectListItem($(this)); }); // click off to close // (except when this initial opening click is bubbling up) // we cannot just stopPropagation as it may be needed to close another instance var isOpening = true; $("html").on("click" + this.ns, function(e) { if (!isOpening) { that._closeDropdown(); } isOpening = false; }); // listen for up/down scrolling, enter to select, or letters to jump to country name. // use keydown as keypress doesn't fire for non-char keys and we want to catch if they // just hit down and hold it to scroll down (no keyup event). // listen on the document because that's where key events are triggered if no input has focus var query = "", queryTimer = null; $(document).on("keydown" + this.ns, function(e) { // prevent down key from scrolling the whole page, // and enter key from submitting a form etc e.preventDefault(); if (e.which == keys.UP || e.which == keys.DOWN) { // up and down to navigate that._handleUpDownKey(e.which); } else if (e.which == keys.ENTER) { // enter to select that._handleEnterKey(); } else if (e.which == keys.ESC) { // esc to close that._closeDropdown(); } else if (e.which >= keys.A && e.which <= keys.Z || e.which == keys.SPACE) { // upper case letters (note: keyup/keydown only return upper case letters) // jump to countries that start with the query string if (queryTimer) { clearTimeout(queryTimer); } query += String.fromCharCode(e.which); that._searchForCountry(query); // if the timer hits 1 second, reset the query queryTimer = setTimeout(function() { query = ""; }, 1e3); } }); }, // highlight the next/prev item in the list (and ensure it is visible) _handleUpDownKey: function(key) { var current = this.countryList.children(".highlight").first(); var next = key == keys.UP ? current.prev() : current.next(); if (next.length) { // skip the divider if (next.hasClass("divider")) { next = key == keys.UP ? next.prev() : next.next(); } this._highlightListItem(next); this._scrollTo(next); } }, // select the currently highlighted item _handleEnterKey: function() { var currentCountry = this.countryList.children(".highlight").first(); if (currentCountry.length) { this._selectListItem(currentCountry); } }, // find the first list item whose name starts with the query string _searchForCountry: function(query) { for (var i = 0; i < this.countries.length; i++) { if (this._startsWith(this.countries[i].name, query)) { var listItem = this.countryList.children("[data-country-code=" + this.countries[i].iso2 + "]").not(".preferred"); // update highlighting and scroll this._highlightListItem(listItem); this._scrollTo(listItem, true); break; } } }, // check if (uppercase) string a starts with string b _startsWith: function(a, b) { return a.substr(0, b.length).toUpperCase() == b; }, // update the input's value to the given val (format first if possible) // NOTE: this is called from _setInitialState, handleUtils and setNumber _updateValFromNumber: function(number) { if (this.options.formatOnDisplay && window.intlTelInputUtils && this.selectedCountryData) { var format = !this.options.separateDialCode && (this.options.nationalMode || number.charAt(0) != "+") ? intlTelInputUtils.numberFormat.NATIONAL : intlTelInputUtils.numberFormat.INTERNATIONAL; number = intlTelInputUtils.formatNumber(number, this.selectedCountryData.iso2, format); } number = this._beforeSetNumber(number); this.telInput.val(number); }, // check if need to select a new flag based on the given number // Note: called from _setInitialState, keyup handler, setNumber _updateFlagFromNumber: function(number) { // if we're in nationalMode and we already have US/Canada selected, make sure the number starts with a +1 so _getDialCode will be able to extract the area code // update: if we dont yet have selectedCountryData, but we're here (trying to update the flag from the number), that means we're initialising the plugin with a number that already has a dial code, so fine to ignore this bit if (number && this.options.nationalMode && this.selectedCountryData.dialCode == "1" && number.charAt(0) != "+") { if (number.charAt(0) != "1") { number = "1" + number; } number = "+" + number; } // try and extract valid dial code from input var dialCode = this._getDialCode(number), countryCode = null, numeric = this._getNumeric(number); if (dialCode) { // check if one of the matching countries is already selected var countryCodes = this.countryCodes[this._getNumeric(dialCode)], alreadySelected = $.inArray(this.selectedCountryData.iso2, countryCodes) > -1, // check if the given number contains a NANP area code i.e. the only dialCode that could be extracted was +1 (instead of say +1204) and the actual number's length is >=4 isNanpAreaCode = dialCode == "+1" && numeric.length >= 4, nanpSelected = this.selectedCountryData.dialCode == "1"; // only update the flag if: // A) NOT (we currently have a NANP flag selected, and the number is a regionlessNanp) // AND // B) either a matching country is not already selected OR the number contains a NANP area code (ensure the flag is set to the first matching country) if (!(nanpSelected && this._isRegionlessNanp(numeric)) && (!alreadySelected || isNanpAreaCode)) { // if using onlyCountries option, countryCodes[0] may be empty, so we must find the first non-empty index for (var j = 0; j < countryCodes.length; j++) { if (countryCodes[j]) { countryCode = countryCodes[j]; break; } } } } else if (number.charAt(0) == "+" && numeric.length) { // invalid dial code, so empty // Note: use getNumeric here because the number has not been formatted yet, so could contain bad chars countryCode = ""; } else if (!number || number == "+") { // empty, or just a plus, so default countryCode = this.defaultCountry; } if (countryCode !== null) { return this._setFlag(countryCode); } return false; }, // check if the given number is a regionless NANP number (expects the number to contain an international dial code) _isRegionlessNanp: function(number) { var numeric = this._getNumeric(number); if (numeric.charAt(0) == "1") { var areaCode = numeric.substr(1, 3); return $.inArray(areaCode, regionlessNanpNumbers) > -1; } return false; }, // remove highlighting from other list items and highlight the given item _highlightListItem: function(listItem) { this.countryListItems.removeClass("highlight"); listItem.addClass("highlight"); }, // find the country data for the given country code // the ignoreOnlyCountriesOption is only used during init() while parsing the onlyCountries array _getCountryData: function(countryCode, ignoreOnlyCountriesOption, allowFail) { var countryList = ignoreOnlyCountriesOption ? allCountries : this.countries; for (var i = 0; i < countryList.length; i++) { if (countryList[i].iso2 == countryCode) { return countryList[i]; } } if (allowFail) { return null; } else { throw new Error("No country data for '" + countryCode + "'"); } }, // select the given flag, update the placeholder and the active list item // Note: called from _setInitialState, _updateFlagFromNumber, _selectListItem, setCountry _setFlag: function(countryCode) { var prevCountry = this.selectedCountryData.iso2 ? this.selectedCountryData : {}; // do this first as it will throw an error and stop if countryCode is invalid this.selectedCountryData = countryCode ? this._getCountryData(countryCode, false, false) : {}; // update the defaultCountry - we only need the iso2 from now on, so just store that if (this.selectedCountryData.iso2) { this.defaultCountry = this.selectedCountryData.iso2; } this.selectedFlagInner.attr("class", "iti-flag " + countryCode); // update the selected country's title attribute var title = countryCode ? this.selectedCountryData.name + ": +" + this.selectedCountryData.dialCode : "Unknown"; this.selectedFlagInner.parent().attr("title", title); if (this.options.separateDialCode) { var dialCode = this.selectedCountryData.dialCode ? "+" + this.selectedCountryData.dialCode : "", parent = this.telInput.parent(); if (prevCountry.dialCode) { parent.removeClass("iti-sdc-" + (prevCountry.dialCode.length + 1)); } if (dialCode) { parent.addClass("iti-sdc-" + dialCode.length); } this.selectedDialCode.text(dialCode); } // and the input's placeholder this._updatePlaceholder(); // update the active list item this.countryListItems.removeClass("active"); if (countryCode) { this.countryListItems.find(".iti-flag." + countryCode).first().closest(".country").addClass("active"); } // return if the flag has changed or not return prevCountry.iso2 !== countryCode; }, // update the input placeholder to an example number from the currently selected country _updatePlaceholder: function() { var shouldSetPlaceholder = this.options.autoPlaceholder === "aggressive" || !this.hadInitialPlaceholder && (this.options.autoPlaceholder === true || this.options.autoPlaceholder === "polite"); if (window.intlTelInputUtils && shouldSetPlaceholder) { var numberType = intlTelInputUtils.numberType[this.options.placeholderNumberType], placeholder = this.selectedCountryData.iso2 ? intlTelInputUtils.getExampleNumber(this.selectedCountryData.iso2, this.options.nationalMode, numberType) : ""; placeholder = this._beforeSetNumber(placeholder); if (typeof this.options.customPlaceholder === "function") { placeholder = this.options.customPlaceholder(placeholder, this.selectedCountryData); } this.telInput.attr("placeholder", placeholder); } }, // called when the user selects a list item from the dropdown _selectListItem: function(listItem) { // update selected flag and active list item var flagChanged = this._setFlag(listItem.attr("data-country-code")); this._closeDropdown(); this._updateDialCode(listItem.attr("data-dial-code"), true); // focus the input this.telInput.focus(); // put cursor at end - this fix is required for FF and IE11 (with nationalMode=false i.e. auto inserting dial code), who try to put the cursor at the beginning the first time if (this.isGoodBrowser) { var len = this.telInput.val().length; this.telInput[0].setSelectionRange(len, len); } if (flagChanged) { this._triggerCountryChange(); } }, // close the dropdown and unbind any listeners _closeDropdown: function() { this.countryList.addClass("hide"); // update the arrow this.selectedFlagInner.children(".iti-arrow").removeClass("up"); // unbind key events $(document).off(this.ns); // unbind click-off-to-close $("html").off(this.ns); // unbind hover and click listeners this.countryList.off(this.ns); // remove menu from container if (this.options.dropdownContainer) { if (!this.isMobile) { $(window).off("scroll" + this.ns); } this.dropdown.detach(); } }, // check if an element is visible within it's container, else scroll until it is _scrollTo: function(element, middle) { var container = this.countryList, containerHeight = container.height(), containerTop = container.offset().top, containerBottom = containerTop + containerHeight, elementHeight = element.outerHeight(), elementTop = element.offset().top, elementBottom = elementTop + elementHeight, newScrollTop = elementTop - containerTop + container.scrollTop(), middleOffset = containerHeight / 2 - elementHeight / 2; if (elementTop < containerTop) { // scroll up if (middle) { newScrollTop -= middleOffset; } container.scrollTop(newScrollTop); } else if (elementBottom > containerBottom) { // scroll down if (middle) { newScrollTop += middleOffset; } var heightDifference = containerHeight - elementHeight; container.scrollTop(newScrollTop - heightDifference); } }, // replace any existing dial code with the new one // Note: called from _selectListItem and setCountry _updateDialCode: function(newDialCode, hasSelectedListItem) { var inputVal = this.telInput.val(), newNumber; // save having to pass this every time newDialCode = "+" + newDialCode; if (inputVal.charAt(0) == "+") { // there's a plus so we're dealing with a replacement (doesn't matter if nationalMode or not) var prevDialCode = this._getDialCode(inputVal); if (prevDialCode) { // current number contains a valid dial code, so replace it newNumber = inputVal.replace(prevDialCode, newDialCode); } else { // current number contains an invalid dial code, so ditch it // (no way to determine where the invalid dial code ends and the rest of the number begins) newNumber = newDialCode; } } else if (this.options.nationalMode || this.options.separateDialCode) { // don't do anything return; } else { // nationalMode is disabled if (inputVal) { // there is an existing value with no dial code: prefix the new dial code newNumber = newDialCode + inputVal; } else if (hasSelectedListItem || !this.options.autoHideDialCode) { // no existing value and either they've just selected a list item, or autoHideDialCode is disabled: insert new dial code newNumber = newDialCode; } else { return; } } this.telInput.val(newNumber); }, // try and extract a valid international dial code from a full telephone number // Note: returns the raw string inc plus character and any whitespace/dots etc _getDialCode: function(number) { var dialCode = ""; // only interested in international numbers (starting with a plus) if (number.charAt(0) == "+") { var numericChars = ""; // iterate over chars for (var i = 0; i < number.length; i++) { var c = number.charAt(i); // if char is number if ($.isNumeric(c)) { numericChars += c; // if current numericChars make a valid dial code if (this.countryCodes[numericChars]) { // store the actual raw string (useful for matching later) dialCode = number.substr(0, i + 1); } // longest dial code is 4 chars if (numericChars.length == 4) { break; } } } } return dialCode; }, // get the input val, adding the dial code if separateDialCode is enabled _getFullNumber: function() { var val = $.trim(this.telInput.val()), dialCode = this.selectedCountryData.dialCode, prefix, numericVal = this._getNumeric(val), // normalized means ensure starts with a 1, so we can match against the full dial code normalizedVal = numericVal.charAt(0) == "1" ? numericVal : "1" + numericVal; if (this.options.separateDialCode) { prefix = "+" + dialCode; } else if (val.charAt(0) != "+" && val.charAt(0) != "1" && dialCode && dialCode.charAt(0) == "1" && dialCode.length == 4 && dialCode != normalizedVal.substr(0, 4)) { // if the user has entered a national NANP number, then ensure it includes the full dial code / area code prefix = dialCode.substr(1); } else { prefix = ""; } return prefix + val; }, // remove the dial code if separateDialCode is enabled _beforeSetNumber: function(number) { if (this.options.separateDialCode) { var dialCode = this._getDialCode(number); if (dialCode) { // US dialCode is "+1", which is what we want // CA dialCode is "+1 123", which is wrong - should be "+1" (as it has multiple area codes) // AS dialCode is "+1 684", which is what we want // Solution: if the country has area codes, then revert to just the dial code if (this.selectedCountryData.areaCodes !== null) { dialCode = "+" + this.selectedCountryData.dialCode; } // a lot of numbers will have a space separating the dial code and the main number, and some NANP numbers will have a hyphen e.g. +1 684-733-1234 - in both cases we want to get rid of it // NOTE: don't just trim all non-numerics as may want to preserve an open parenthesis etc var start = number[dialCode.length] === " " || number[dialCode.length] === "-" ? dialCode.length + 1 : dialCode.length; number = number.substr(start); } } return this._cap(number); }, // trigger the 'countrychange' event _triggerCountryChange: function() { this.telInput.trigger("countrychange", this.selectedCountryData); }, /************************** * SECRET PUBLIC METHODS **************************/ // this is called when the geoip call returns handleAutoCountry: function() { if (this.options.initialCountry === "auto") { // we must set this even if there is an initial val in the input: in case the initial val is invalid and they delete it - they should see their auto country this.defaultCountry = $.fn[pluginName].autoCountry; // if there's no initial value in the input, then update the flag if (!this.telInput.val()) { this.setCountry(this.defaultCountry); } this.autoCountryDeferred.resolve(); } }, // this is called when the utils request completes handleUtils: function() { // if the request was successful if (window.intlTelInputUtils) { // if there's an initial value in the input, then format it if (this.telInput.val()) { this._updateValFromNumber(this.telInput.val()); } this._updatePlaceholder(); } this.utilsScriptDeferred.resolve(); }, /******************** * PUBLIC METHODS ********************/ // remove plugin destroy: function() { if (this.allowDropdown) { // make sure the dropdown is closed (and unbind listeners) this._closeDropdown(); // click event to open dropdown this.selectedFlagInner.parent().off(this.ns); // label click hack this.telInput.closest("label").off(this.ns); } // unbind submit event handler on form if (this.options.autoHideDialCode) { var form = this.telInput.prop("form"); if (form) { $(form).off(this.ns); } } // unbind all events: key events, and focus/blur events if autoHideDialCode=true this.telInput.off(this.ns); // remove markup (but leave the original input) var container = this.telInput.parent(); container.before(this.telInput).remove(); }, // get the extension from the current number getExtension: function() { if (window.intlTelInputUtils) { return intlTelInputUtils.getExtension(this._getFullNumber(), this.selectedCountryData.iso2); } return ""; }, // format the number to the given format getNumber: function(format) { if (window.intlTelInputUtils) { return intlTelInputUtils.formatNumber(this._getFullNumber(), this.selectedCountryData.iso2, format); } return ""; }, // get the type of the entered number e.g. landline/mobile getNumberType: function() { if (window.intlTelInputUtils) { return intlTelInputUtils.getNumberType(this._getFullNumber(), this.selectedCountryData.iso2); } return -99; }, // get the country data for the currently selected flag getSelectedCountryData: function() { return this.selectedCountryData; }, // get the validation error getValidationError: function() { if (window.intlTelInputUtils) { return intlTelInputUtils.getValidationError(this._getFullNumber(), this.selectedCountryData.iso2); } return -99; }, // validate the input val - assumes the global function isValidNumber (from utilsScript) isValidNumber: function() { var val = $.trim(this._getFullNumber()), countryCode = this.options.nationalMode ? this.selectedCountryData.iso2 : ""; return window.intlTelInputUtils ? intlTelInputUtils.isValidNumber(val, countryCode) : null; }, // update the selected flag, and update the input val accordingly setCountry: function(countryCode) { countryCode = countryCode.toLowerCase(); // check if already selected if (!this.selectedFlagInner.hasClass(countryCode)) { this._setFlag(countryCode); this._updateDialCode(this.selectedCountryData.dialCode, false); this._triggerCountryChange(); } }, // set the input value and update the flag setNumber: function(number) { // we must update the flag first, which updates this.selectedCountryData, which is used for formatting the number before displaying it var flagChanged = this._updateFlagFromNumber(number); this._updateValFromNumber(number); if (flagChanged) { this._triggerCountryChange(); } } }; // using https://github.com/jquery-boilerplate/jquery-boilerplate/wiki/Extending-jQuery-Boilerplate // (adapted to allow public functions) $.fn[pluginName] = function(options) { var args = arguments; // Is the first parameter an object (options), or was omitted, // instantiate a new instance of the plugin. if (options === undefined || typeof options === "object") { // collect all of the deferred objects for all instances created with this selector var deferreds = []; this.each(function() { if (!$.data(this, "plugin_" + pluginName)) { var instance = new Plugin(this, options); var instanceDeferreds = instance._init(); // we now have 2 deffereds: 1 for auto country, 1 for utils script deferreds.push(instanceDeferreds[0]); deferreds.push(instanceDeferreds[1]); $.data(this, "plugin_" + pluginName, instance); } }); // return the promise from the "master" deferred object that tracks all the others return $.when.apply(null, deferreds); } else if (typeof options === "string" && options[0] !== "_") { // If the first parameter is a string and it doesn't start // with an underscore or "contains" the `init`-function, // treat this as a call to a public method. // Cache the method call to make it possible to return a value var returns; this.each(function() { var instance = $.data(this, "plugin_" + pluginName); // Tests that there's already a plugin-instance // and checks that the requested public method exists if (instance instanceof Plugin && typeof instance[options] === "function") { // Call the method of our plugin instance, // and pass it the supplied arguments. returns = instance[options].apply(instance, Array.prototype.slice.call(args, 1)); } // Allow instances to be destroyed via the 'destroy' method if (options === "destroy") { $.data(this, "plugin_" + pluginName, null); } }); // If the earlier cached method gives a value back return the value, // otherwise return this to preserve chainability. return returns !== undefined ? returns : this; } }; /******************** * STATIC METHODS ********************/ // get the country data object $.fn[pluginName].getCountryData = function() { return allCountries; }; // load the utils script $.fn[pluginName].loadUtils = function(path, utilsScriptDeferred) { if (!$.fn[pluginName].loadedUtilsScript) { // don't do this twice! (dont just check if window.intlTelInputUtils exists as if init plugin multiple times in quick succession, it may not have finished loading yet) $.fn[pluginName].loadedUtilsScript = true; // dont use $.getScript as it prevents caching $.ajax({ type: "GET", url: path, complete: function() { // tell all instances that the utils request is complete $(".intl-tel-input input").intlTelInput("handleUtils"); }, dataType: "script", cache: true }); } else if (utilsScriptDeferred) { utilsScriptDeferred.resolve(); } }; // default options $.fn[pluginName].defaults = defaults; // version $.fn[pluginName].version = "11.0.14"; // Array of country objects for the flag dropdown. // Here is the criteria for the plugin to support a given country/territory // - It has an iso2 code: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 // - It has it's own country calling code (it is not a sub-region of another country): https://en.wikipedia.org/wiki/List_of_country_calling_codes // - It has a flag in the region-flags project: https://github.com/behdad/region-flags/tree/gh-pages/png // - It is supported by libphonenumber (it must be listed on this page): https://github.com/googlei18n/libphonenumber/blob/master/resources/ShortNumberMetadata.xml // Each country array has the following information: // [ // Country name, // iso2 code, // International dial code, // Order (if >1 country with same dial code), // Area codes // ] var allCountries = [ [ "Afghanistan (‫افغانستان‬‎)", "af", "93" ], [ "Albania (Shqipëri)", "al", "355" ], [ "Algeria (‫الجزائر‬‎)", "dz", "213" ], [ "American Samoa", "as", "1684" ], [ "Andorra", "ad", "376" ], [ "Angola", "ao", "244" ], [ "Anguilla", "ai", "1264" ], [ "Antigua and Barbuda", "ag", "1268" ], [ "Argentina", "ar", "54" ], [ "Armenia (Հայաստան)", "am", "374" ], [ "Aruba", "aw", "297" ], [ "Australia", "au", "61", 0 ], [ "Austria (Österreich)", "at", "43" ], [ "Azerbaijan (Azərbaycan)", "az", "994" ], [ "Bahamas", "bs", "1242" ], [ "Bahrain (‫البحرين‬‎)", "bh", "973" ], [ "Bangladesh (বাংলাদেশ)", "bd", "880" ], [ "Barbados", "bb", "1246" ], [ "Belarus (Беларусь)", "by", "375" ], [ "Belgium (België)", "be", "32" ], [ "Belize", "bz", "501" ], [ "Benin (Bénin)", "bj", "229" ], [ "Bermuda", "bm", "1441" ], [ "Bhutan (འབྲུག)", "bt", "975" ], [ "Bolivia", "bo", "591" ], [ "Bosnia and Herzegovina (Босна и Херцеговина)", "ba", "387" ], [ "Botswana", "bw", "267" ], [ "Brazil (Brasil)", "br", "55" ], [ "British Indian Ocean Territory", "io", "246" ], [ "British Virgin Islands", "vg", "1284" ], [ "Brunei", "bn", "673" ], [ "Bulgaria (България)", "bg", "359" ], [ "Burkina Faso", "bf", "226" ], [ "Burundi (Uburundi)", "bi", "257" ], [ "Cambodia (កម្ពុជា)", "kh", "855" ], [ "Cameroon (Cameroun)", "cm", "237" ], [ "Canada", "ca", "1", 1, [ "204", "226", "236", "249", "250", "289", "306", "343", "365", "387", "403", "416", "418", "431", "437", "438", "450", "506", "514", "519", "548", "579", "581", "587", "604", "613", "639", "647", "672", "705", "709", "742", "778", "780", "782", "807", "819", "825", "867", "873", "902", "905" ] ], [ "Cape Verde (Kabu Verdi)", "cv", "238" ], [ "Caribbean Netherlands", "bq", "599", 1 ], [ "Cayman Islands", "ky", "1345" ], [ "Central African Republic (République centrafricaine)", "cf", "236" ], [ "Chad (Tchad)", "td", "235" ], [ "Chile", "cl", "56" ], [ "China (中国)", "cn", "86" ], [ "Christmas Island", "cx", "61", 2 ], [ "Cocos (Keeling) Islands", "cc", "61", 1 ], [ "Colombia", "co", "57" ], [ "Comoros (‫جزر القمر‬‎)", "km", "269" ], [ "Congo (DRC) (Jamhuri ya Kidemokrasia ya Kongo)", "cd", "243" ], [ "Congo (Republic) (Congo-Brazzaville)", "cg", "242" ], [ "Cook Islands", "ck", "682" ], [ "Costa Rica", "cr", "506" ], [ "Côte d’Ivoire", "ci", "225" ], [ "Croatia (Hrvatska)", "hr", "385" ], [ "Cuba", "cu", "53" ], [ "Curaçao", "cw", "599", 0 ], [ "Cyprus (Κύπρος)", "cy", "357" ], [ "Czech Republic (Česká republika)", "cz", "420" ], [ "Denmark (Danmark)", "dk", "45" ], [ "Djibouti", "dj", "253" ], [ "Dominica", "dm", "1767" ], [ "Dominican Republic (República Dominicana)", "do", "1", 2, [ "809", "829", "849" ] ], [ "Ecuador", "ec", "593" ], [ "Egypt (‫مصر‬‎)", "eg", "20" ], [ "El Salvador", "sv", "503" ], [ "Equatorial Guinea (Guinea Ecuatorial)", "gq", "240" ], [ "Eritrea", "er", "291" ], [ "Estonia (Eesti)", "ee", "372" ], [ "Ethiopia", "et", "251" ], [ "Falkland Islands (Islas Malvinas)", "fk", "500" ], [ "Faroe Islands (Føroyar)", "fo", "298" ], [ "Fiji", "fj", "679" ], [ "Finland (Suomi)", "fi", "358", 0 ], [ "France", "fr", "33" ], [ "French Guiana (Guyane française)", "gf", "594" ], [ "French Polynesia (Polynésie française)", "pf", "689" ], [ "Gabon", "ga", "241" ], [ "Gambia", "gm", "220" ], [ "Georgia (საქართველო)", "ge", "995" ], [ "Germany (Deutschland)", "de", "49" ], [ "Ghana (Gaana)", "gh", "233" ], [ "Gibraltar", "gi", "350" ], [ "Greece (Ελλάδα)", "gr", "30" ], [ "Greenland (Kalaallit Nunaat)", "gl", "299" ], [ "Grenada", "gd", "1473" ], [ "Guadeloupe", "gp", "590", 0 ], [ "Guam", "gu", "1671" ], [ "Guatemala", "gt", "502" ], [ "Guernsey", "gg", "44", 1 ], [ "Guinea (Guinée)", "gn", "224" ], [ "Guinea-Bissau (Guiné Bissau)", "gw", "245" ], [ "Guyana", "gy", "592" ], [ "Haiti", "ht", "509" ], [ "Honduras", "hn", "504" ], [ "Hong Kong (香港)", "hk", "852" ], [ "Hungary (Magyarország)", "hu", "36" ], [ "Iceland (Ísland)", "is", "354" ], [ "India (भारत)", "in", "91" ], [ "Indonesia", "id", "62" ], [ "Iran (‫ایران‬‎)", "ir", "98" ], [ "Iraq (‫العراق‬‎)", "iq", "964" ], [ "Ireland", "ie", "353" ], [ "Isle of Man", "im", "44", 2 ], [ "Israel (‫ישראל‬‎)", "il", "972" ], [ "Italy (Italia)", "it", "39", 0 ], [ "Jamaica", "jm", "1876" ], [ "Japan (日本)", "jp", "81" ], [ "Jersey", "je", "44", 3 ], [ "Jordan (‫الأردن‬‎)", "jo", "962" ], [ "Kazakhstan (Казахстан)", "kz", "7", 1 ], [ "Kenya", "ke", "254" ], [ "Kiribati", "ki", "686" ], [ "Kosovo", "xk", "383" ], [ "Kuwait (‫الكويت‬‎)", "kw", "965" ], [ "Kyrgyzstan (Кыргызстан)", "kg", "996" ], [ "Laos (ລາວ)", "la", "856" ], [ "Latvia (Latvija)", "lv", "371" ], [ "Lebanon (‫لبنان‬‎)", "lb", "961" ], [ "Lesotho", "ls", "266" ], [ "Liberia", "lr", "231" ], [ "Libya (‫ليبيا‬‎)", "ly", "218" ], [ "Liechtenstein", "li", "423" ], [ "Lithuania (Lietuva)", "lt", "370" ], [ "Luxembourg", "lu", "352" ], [ "Macau (澳門)", "mo", "853" ], [ "Macedonia (FYROM) (Македонија)", "mk", "389" ], [ "Madagascar (Madagasikara)", "mg", "261" ], [ "Malawi", "mw", "265" ], [ "Malaysia", "my", "60" ], [ "Maldives", "mv", "960" ], [ "Mali", "ml", "223" ], [ "Malta", "mt", "356" ], [ "Marshall Islands", "mh", "692" ], [ "Martinique", "mq", "596" ], [ "Mauritania (‫موريتانيا‬‎)", "mr", "222" ], [ "Mauritius (Moris)", "mu", "230" ], [ "Mayotte", "yt", "262", 1 ], [ "Mexico (México)", "mx", "52" ], [ "Micronesia", "fm", "691" ], [ "Moldova (Republica Moldova)", "md", "373" ], [ "Monaco", "mc", "377" ], [ "Mongolia (Монгол)", "mn", "976" ], [ "Montenegro (Crna Gora)", "me", "382" ], [ "Montserrat", "ms", "1664" ], [ "Morocco (‫المغرب‬‎)", "ma", "212", 0 ], [ "Mozambique (Moçambique)", "mz", "258" ], [ "Myanmar (Burma) (မြန်မာ)", "mm", "95" ], [ "Namibia (Namibië)", "na", "264" ], [ "Nauru", "nr", "674" ], [ "Nepal (नेपाल)", "np", "977" ], [ "Netherlands (Nederland)", "nl", "31" ], [ "New Caledonia (Nouvelle-Calédonie)", "nc", "687" ], [ "New Zealand", "nz", "64" ], [ "Nicaragua", "ni", "505" ], [ "Niger (Nijar)", "ne", "227" ], [ "Nigeria", "ng", "234" ], [ "Niue", "nu", "683" ], [ "Norfolk Island", "nf", "672" ], [ "North Korea (조선 민주주의 인민 공화국)", "kp", "850" ], [ "Northern Mariana Islands", "mp", "1670" ], [ "Norway (Norge)", "no", "47", 0 ], [ "Oman (‫عُمان‬‎)", "om", "968" ], [ "Pakistan (‫پاکستان‬‎)", "pk", "92" ], [ "Palau", "pw", "680" ], [ "Palestine (‫فلسطين‬‎)", "ps", "970" ], [ "Panama (Panamá)", "pa", "507" ], [ "Papua New Guinea", "pg", "675" ], [ "Paraguay", "py", "595" ], [ "Peru (Perú)", "pe", "51" ], [ "Philippines", "ph", "63" ], [ "Poland (Polska)", "pl", "48" ], [ "Portugal", "pt", "351" ], [ "Puerto Rico", "pr", "1", 3, [ "787", "939" ] ], [ "Qatar (‫قطر‬‎)", "qa", "974" ], [ "Réunion (La Réunion)", "re", "262", 0 ], [ "Romania (România)", "ro", "40" ], [ "Russia (Россия)", "ru", "7", 0 ], [ "Rwanda", "rw", "250" ], [ "Saint Barthélemy (Saint-Barthélemy)", "bl", "590", 1 ], [ "Saint Helena", "sh", "290" ], [ "Saint Kitts and Nevis", "kn", "1869" ], [ "Saint Lucia", "lc", "1758" ], [ "Saint Martin (Saint-Martin (partie française))", "mf", "590", 2 ], [ "Saint Pierre and Miquelon (Saint-Pierre-et-Miquelon)", "pm", "508" ], [ "Saint Vincent and the Grenadines", "vc", "1784" ], [ "Samoa", "ws", "685" ], [ "San Marino", "sm", "378" ], [ "São Tomé and Príncipe (São Tomé e Príncipe)", "st", "239" ], [ "Saudi Arabia (‫المملكة العربية السعودية‬‎)", "sa", "966" ], [ "Senegal (Sénégal)", "sn", "221" ], [ "Serbia (Србија)", "rs", "381" ], [ "Seychelles", "sc", "248" ], [ "Sierra Leone", "sl", "232" ], [ "Singapore", "sg", "65" ], [ "Sint Maarten", "sx", "1721" ], [ "Slovakia (Slovensko)", "sk", "421" ], [ "Slovenia (Slovenija)", "si", "386" ], [ "Solomon Islands", "sb", "677" ], [ "Somalia (Soomaaliya)", "so", "252" ], [ "South Africa", "za", "27" ], [ "South Korea (대한민국)", "kr", "82" ], [ "South Sudan (‫جنوب السودان‬‎)", "ss", "211" ], [ "Spain (España)", "es", "34" ], [ "Sri Lanka (ශ්‍රී ලංකාව)", "lk", "94" ], [ "Sudan (‫السودان‬‎)", "sd", "249" ], [ "Suriname", "sr", "597" ], [ "Svalbard and Jan Mayen", "sj", "47", 1 ], [ "Swaziland", "sz", "268" ], [ "Sweden (Sverige)", "se", "46" ], [ "Switzerland (Schweiz)", "ch", "41" ], [ "Syria (‫سوريا‬‎)", "sy", "963" ], [ "Taiwan (台灣)", "tw", "886" ], [ "Tajikistan", "tj", "992" ], [ "Tanzania", "tz", "255" ], [ "Thailand (ไทย)", "th", "66" ], [ "Timor-Leste", "tl", "670" ], [ "Togo", "tg", "228" ], [ "Tokelau", "tk", "690" ], [ "Tonga", "to", "676" ], [ "Trinidad and Tobago", "tt", "1868" ], [ "Tunisia (‫تونس‬‎)", "tn", "216" ], [ "Turkey (Türkiye)", "tr", "90" ], [ "Turkmenistan", "tm", "993" ], [ "Turks and Caicos Islands", "tc", "1649" ], [ "Tuvalu", "tv", "688" ], [ "U.S. Virgin Islands", "vi", "1340" ], [ "Uganda", "ug", "256" ], [ "Ukraine (Україна)", "ua", "380" ], [ "United Arab Emirates (‫الإمارات العربية المتحدة‬‎)", "ae", "971" ], [ "United Kingdom", "gb", "44", 0 ], [ "United States", "us", "1", 0 ], [ "Uruguay", "uy", "598" ], [ "Uzbekistan (Oʻzbekiston)", "uz", "998" ], [ "Vanuatu", "vu", "678" ], [ "Vatican City (Città del Vaticano)", "va", "39", 1 ], [ "Venezuela", "ve", "58" ], [ "Vietnam (Việt Nam)", "vn", "84" ], [ "Wallis and Futuna", "wf", "681" ], [ "Western Sahara (‫الصحراء الغربية‬‎)", "eh", "212", 1 ], [ "Yemen (‫اليمن‬‎)", "ye", "967" ], [ "Zambia", "zm", "260" ], [ "Zimbabwe", "zw", "263" ], [ "Åland Islands", "ax", "358", 1 ] ]; // loop over all of the countries above for (var i = 0; i < allCountries.length; i++) { var c = allCountries[i]; allCountries[i] = { name: c[0], iso2: c[1], dialCode: c[2], priority: c[3] || 0, areaCodes: c[4] || null }; } }); (function (factory) { if ( typeof define === 'function' && define.amd ) { // AMD. Register as an anonymous module. define([], factory); } else if ( typeof exports === 'object' ) { // Node/CommonJS module.exports = factory(); } else { // Browser globals window.wNumb = factory(); } }(function(){ 'use strict'; var FormatOptions = [ 'decimals', 'thousand', 'mark', 'prefix', 'suffix', 'encoder', 'decoder', 'negativeBefore', 'negative', 'edit', 'undo' ]; // General // Reverse a string function strReverse ( a ) { return a.split('').reverse().join(''); } // Check if a string starts with a specified prefix. function strStartsWith ( input, match ) { return input.substring(0, match.length) === match; } // Check is a string ends in a specified suffix. function strEndsWith ( input, match ) { return input.slice(-1 * match.length) === match; } // Throw an error if formatting options are incompatible. function throwEqualError( F, a, b ) { if ( (F[a] || F[b]) && (F[a] === F[b]) ) { throw new Error(a); } } // Check if a number is finite and not NaN function isValidNumber ( input ) { return typeof input === 'number' && isFinite( input ); } // Provide rounding-accurate toFixed method. // Borrowed: http://stackoverflow.com/a/21323330/775265 function toFixed ( value, exp ) { value = value.toString().split('e'); value = Math.round(+(value[0] + 'e' + (value[1] ? (+value[1] + exp) : exp))); value = value.toString().split('e'); return (+(value[0] + 'e' + (value[1] ? (+value[1] - exp) : -exp))).toFixed(exp); } // Formatting // Accept a number as input, output formatted string. function formatTo ( decimals, thousand, mark, prefix, suffix, encoder, decoder, negativeBefore, negative, edit, undo, input ) { var originalInput = input, inputIsNegative, inputPieces, inputBase, inputDecimals = '', output = ''; // Apply user encoder to the input. // Expected outcome: number. if ( encoder ) { input = encoder(input); } // Stop if no valid number was provided, the number is infinite or NaN. if ( !isValidNumber(input) ) { return false; } // Rounding away decimals might cause a value of -0 // when using very small ranges. Remove those cases. if ( decimals !== false && parseFloat(input.toFixed(decimals)) === 0 ) { input = 0; } // Formatting is done on absolute numbers, // decorated by an optional negative symbol. if ( input < 0 ) { inputIsNegative = true; input = Math.abs(input); } // Reduce the number of decimals to the specified option. if ( decimals !== false ) { input = toFixed( input, decimals ); } // Transform the number into a string, so it can be split. input = input.toString(); // Break the number on the decimal separator. if ( input.indexOf('.') !== -1 ) { inputPieces = input.split('.'); inputBase = inputPieces[0]; if ( mark ) { inputDecimals = mark + inputPieces[1]; } } else { // If it isn't split, the entire number will do. inputBase = input; } // Group numbers in sets of three. if ( thousand ) { inputBase = strReverse(inputBase).match(/.{1,3}/g); inputBase = strReverse(inputBase.join( strReverse( thousand ) )); } // If the number is negative, prefix with negation symbol. if ( inputIsNegative && negativeBefore ) { output += negativeBefore; } // Prefix the number if ( prefix ) { output += prefix; } // Normal negative option comes after the prefix. Defaults to '-'. if ( inputIsNegative && negative ) { output += negative; } // Append the actual number. output += inputBase; output += inputDecimals; // Apply the suffix. if ( suffix ) { output += suffix; } // Run the output through a user-specified post-formatter. if ( edit ) { output = edit ( output, originalInput ); } // All done. return output; } // Accept a sting as input, output decoded number. function formatFrom ( decimals, thousand, mark, prefix, suffix, encoder, decoder, negativeBefore, negative, edit, undo, input ) { var originalInput = input, inputIsNegative, output = ''; // User defined pre-decoder. Result must be a non empty string. if ( undo ) { input = undo(input); } // Test the input. Can't be empty. if ( !input || typeof input !== 'string' ) { return false; } // If the string starts with the negativeBefore value: remove it. // Remember is was there, the number is negative. if ( negativeBefore && strStartsWith(input, negativeBefore) ) { input = input.replace(negativeBefore, ''); inputIsNegative = true; } // Repeat the same procedure for the prefix. if ( prefix && strStartsWith(input, prefix) ) { input = input.replace(prefix, ''); } // And again for negative. if ( negative && strStartsWith(input, negative) ) { input = input.replace(negative, ''); inputIsNegative = true; } // Remove the suffix. // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/slice if ( suffix && strEndsWith(input, suffix) ) { input = input.slice(0, -1 * suffix.length); } // Remove the thousand grouping. if ( thousand ) { input = input.split(thousand).join(''); } // Set the decimal separator back to period. if ( mark ) { input = input.replace(mark, '.'); } // Prepend the negative symbol. if ( inputIsNegative ) { output += '-'; } // Add the number output += input; // Trim all non-numeric characters (allow '.' and '-'); output = output.replace(/[^0-9\.\-.]/g, ''); // The value contains no parse-able number. if ( output === '' ) { return false; } // Covert to number. output = Number(output); // Run the user-specified post-decoder. if ( decoder ) { output = decoder(output); } // Check is the output is valid, otherwise: return false. if ( !isValidNumber(output) ) { return false; } return output; } // Framework // Validate formatting options function validate ( inputOptions ) { var i, optionName, optionValue, filteredOptions = {}; if ( inputOptions['suffix'] === undefined ) { inputOptions['suffix'] = inputOptions['postfix']; } for ( i = 0; i < FormatOptions.length; i+=1 ) { optionName = FormatOptions[i]; optionValue = inputOptions[optionName]; if ( optionValue === undefined ) { // Only default if negativeBefore isn't set. if ( optionName === 'negative' && !filteredOptions.negativeBefore ) { filteredOptions[optionName] = '-'; // Don't set a default for mark when 'thousand' is set. } else if ( optionName === 'mark' && filteredOptions.thousand !== '.' ) { filteredOptions[optionName] = '.'; } else { filteredOptions[optionName] = false; } // Floating points in JS are stable up to 7 decimals. } else if ( optionName === 'decimals' ) { if ( optionValue >= 0 && optionValue < 8 ) { filteredOptions[optionName] = optionValue; } else { throw new Error(optionName); } // These options, when provided, must be functions. } else if ( optionName === 'encoder' || optionName === 'decoder' || optionName === 'edit' || optionName === 'undo' ) { if ( typeof optionValue === 'function' ) { filteredOptions[optionName] = optionValue; } else { throw new Error(optionName); } // Other options are strings. } else { if ( typeof optionValue === 'string' ) { filteredOptions[optionName] = optionValue; } else { throw new Error(optionName); } } } // Some values can't be extracted from a // string if certain combinations are present. throwEqualError(filteredOptions, 'mark', 'thousand'); throwEqualError(filteredOptions, 'prefix', 'negative'); throwEqualError(filteredOptions, 'prefix', 'negativeBefore'); return filteredOptions; } // Pass all options as function arguments function passAll ( options, method, input ) { var i, args = []; // Add all options in order of FormatOptions for ( i = 0; i < FormatOptions.length; i+=1 ) { args.push(options[FormatOptions[i]]); } // Append the input, then call the method, presenting all // options as arguments. args.push(input); return method.apply('', args); } function wNumb ( options ) { if ( !(this instanceof wNumb) ) { return new wNumb ( options ); } if ( typeof options !== "object" ) { return; } options = validate(options); // Call 'formatTo' with proper arguments. this.to = function ( input ) { return passAll(options, formatTo, input); }; // Call 'formatFrom' with proper arguments. this.from = function ( input ) { return passAll(options, formatFrom, input); }; } return wNumb; })); !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.swal=e():t.swal=e()}(this,function(){return function(t){function e(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,o){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:o})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=8)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o="swal-button";e.CLASS_NAMES={MODAL:"swal-modal",OVERLAY:"swal-overlay",SHOW_MODAL:"swal-overlay--show-modal",MODAL_TITLE:"swal-title",MODAL_TEXT:"swal-text",ICON:"swal-icon",ICON_CUSTOM:"swal-icon--custom",CONTENT:"swal-content",FOOTER:"swal-footer",BUTTON_CONTAINER:"swal-button-container",BUTTON:o,CONFIRM_BUTTON:o+"--confirm",CANCEL_BUTTON:o+"--cancel",DANGER_BUTTON:o+"--danger",BUTTON_LOADING:o+"--loading",BUTTON_LOADER:o+"__loader"},e.default=e.CLASS_NAMES},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getNode=function(t){var e="."+t;return document.querySelector(e)},e.stringToNode=function(t){var e=document.createElement("div");return e.innerHTML=t.trim(),e.firstChild},e.insertAfter=function(t,e){var n=e.nextSibling;e.parentNode.insertBefore(t,n)},e.removeNode=function(t){t.parentElement.removeChild(t)},e.throwErr=function(t){throw t=t.replace(/ +(?= )/g,""),"SweetAlert: "+(t=t.trim())},e.isPlainObject=function(t){if("[object Object]"!==Object.prototype.toString.call(t))return!1;var e=Object.getPrototypeOf(t);return null===e||e===Object.prototype},e.ordinalSuffixOf=function(t){var e=t%10,n=t%100;return 1===e&&11!==n?t+"st":2===e&&12!==n?t+"nd":3===e&&13!==n?t+"rd":t+"th"}},function(t,e,n){"use strict";function o(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),o(n(25));var r=n(26);e.overlayMarkup=r.default,o(n(27)),o(n(28)),o(n(29));var i=n(0),a=i.default.MODAL_TITLE,s=i.default.MODAL_TEXT,c=i.default.ICON,l=i.default.FOOTER;e.iconMarkup='\n
        ',e.titleMarkup='\n
        \n',e.textMarkup='\n
        ',e.footerMarkup='\n
        \n'},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(1);e.CONFIRM_KEY="confirm",e.CANCEL_KEY="cancel";var r={visible:!0,text:null,value:null,className:"",closeModal:!0},i=Object.assign({},r,{visible:!1,text:"Cancel",value:null}),a=Object.assign({},r,{text:"OK",value:!0});e.defaultButtonList={cancel:i,confirm:a};var s=function(t){switch(t){case e.CONFIRM_KEY:return a;case e.CANCEL_KEY:return i;default:var n=t.charAt(0).toUpperCase()+t.slice(1);return Object.assign({},r,{text:n,value:t})}},c=function(t,e){var n=s(t);return!0===e?Object.assign({},n,{visible:!0}):"string"==typeof e?Object.assign({},n,{visible:!0,text:e}):o.isPlainObject(e)?Object.assign({visible:!0},n,e):Object.assign({},n,{visible:!1})},l=function(t){for(var e={},n=0,o=Object.keys(t);n=0&&w.splice(e,1)}function s(t){var e=document.createElement("style");return t.attrs.type="text/css",l(e,t.attrs),i(t,e),e}function c(t){var e=document.createElement("link");return t.attrs.type="text/css",t.attrs.rel="stylesheet",l(e,t.attrs),i(t,e),e}function l(t,e){Object.keys(e).forEach(function(n){t.setAttribute(n,e[n])})}function u(t,e){var n,o,r,i;if(e.transform&&t.css){if(!(i=e.transform(t.css)))return function(){};t.css=i}if(e.singleton){var l=h++;n=g||(g=s(e)),o=f.bind(null,n,l,!1),r=f.bind(null,n,l,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=c(e),o=p.bind(null,n,e),r=function(){a(n),n.href&&URL.revokeObjectURL(n.href)}):(n=s(e),o=d.bind(null,n),r=function(){a(n)});return o(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;o(t=e)}else r()}}function f(t,e,n,o){var r=n?"":o.css;if(t.styleSheet)t.styleSheet.cssText=x(e,r);else{var i=document.createTextNode(r),a=t.childNodes;a[e]&&t.removeChild(a[e]),a.length?t.insertBefore(i,a[e]):t.appendChild(i)}}function d(t,e){var n=e.css,o=e.media;if(o&&t.setAttribute("media",o),t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}function p(t,e,n){var o=n.css,r=n.sourceMap,i=void 0===e.convertToAbsoluteUrls&&r;(e.convertToAbsoluteUrls||i)&&(o=y(o)),r&&(o+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */");var a=new Blob([o],{type:"text/css"}),s=t.href;t.href=URL.createObjectURL(a),s&&URL.revokeObjectURL(s)}var m={},b=function(t){var e;return function(){return void 0===e&&(e=t.apply(this,arguments)),e}}(function(){return window&&document&&document.all&&!window.atob}),v=function(t){var e={};return function(n){return void 0===e[n]&&(e[n]=t.call(this,n)),e[n]}}(function(t){return document.querySelector(t)}),g=null,h=0,w=[],y=n(15);t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");e=e||{},e.attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||(e.singleton=b()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var n=r(t,e);return o(n,e),function(t){for(var i=[],a=0;athis.length)&&-1!==this.indexOf(t,e)}),Array.prototype.includes||Object.defineProperty(Array.prototype,"includes",{value:function(t,e){if(null==this)throw new TypeError('"this" is null or not defined');var n=Object(this),o=n.length>>>0;if(0===o)return!1;for(var r=0|e,i=Math.max(r>=0?r:o-Math.abs(r),0);i=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},n(19),e.setImmediate=setImmediate,e.clearImmediate=clearImmediate},function(t,e,n){(function(t,e){!function(t,n){"use strict";function o(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n1)for(var n=1;n
    ',e.default=e.modalMarkup},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=o.default.OVERLAY,i='
    \n
    ';e.default=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=o.default.ICON;e.errorIconMarkup=function(){var t=r+"--error",e=t+"__line";return'\n
    \n \n \n
    \n '},e.warningIconMarkup=function(){var t=r+"--warning";return'\n \n \n \n '},e.successIconMarkup=function(){var t=r+"--success";return'\n \n \n\n
    \n
    \n '}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=o.default.CONTENT;e.contentMarkup='\n
    \n\n
    \n'},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=o.default.BUTTON_CONTAINER,i=o.default.BUTTON,a=o.default.BUTTON_LOADER;e.buttonMarkup='\n
    \n\n \n\n
    \n
    \n
    \n
    \n
    \n\n
    \n'},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(4),r=n(2),i=n(0),a=i.default.ICON,s=i.default.ICON_CUSTOM,c=["error","warning","success","info"],l={error:r.errorIconMarkup(),warning:r.warningIconMarkup(),success:r.successIconMarkup()},u=function(t,e){var n=a+"--"+t;e.classList.add(n);var o=l[t];o&&(e.innerHTML=o)},f=function(t,e){e.classList.add(s);var n=document.createElement("img");n.src=t,e.appendChild(n)},d=function(t){if(t){var e=o.injectElIntoModal(r.iconMarkup);c.includes(t)?u(t,e):f(t,e)}};e.default=d},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(2),r=n(4),i=function(t){navigator.userAgent.includes("AppleWebKit")&&(t.style.display="none",t.offsetHeight,t.style.display="")};e.initTitle=function(t){if(t){var e=r.injectElIntoModal(o.titleMarkup);e.textContent=t,i(e)}},e.initText=function(t){if(t){var e=document.createDocumentFragment();t.split("\n").forEach(function(t,n,o){e.appendChild(document.createTextNode(t)),n0}).forEach(function(t){b.classList.add(t)})}n&&t===c.CONFIRM_KEY&&b.classList.add(s),b.textContent=r;var g={};return g[t]=i,f.setActionValue(g),f.setActionOptionsFor(t,{closeModal:p}),b.addEventListener("click",function(){return u.onAction(t)}),m},p=function(t,e){var n=r.injectElIntoModal(l.footerMarkup);for(var o in t){var i=t[o],a=d(o,i,e);i.visible&&n.appendChild(a)}0===n.children.length&&n.remove()};e.default=p},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(3),r=n(4),i=n(2),a=n(5),s=n(6),c=n(0),l=c.default.CONTENT,u=function(t){t.addEventListener("input",function(t){var e=t.target,n=e.value;a.setActionValue(n)}),t.addEventListener("keyup",function(t){if("Enter"===t.key)return s.onAction(o.CONFIRM_KEY)}),setTimeout(function(){t.focus(),a.setActionValue("")},0)},f=function(t,e,n){var o=document.createElement(e),r=l+"__"+e;o.classList.add(r);for(var i in n){var a=n[i];o[i]=a}"input"===e&&u(o),t.appendChild(o)},d=function(t){if(t){var e=r.injectElIntoModal(i.contentMarkup),n=t.element,o=t.attributes;"string"==typeof n?f(e,n,o):e.appendChild(n)}};e.default=d},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(1),r=n(2),i=function(){var t=o.stringToNode(r.overlayMarkup);document.body.appendChild(t)};e.default=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(5),r=n(6),i=n(1),a=n(3),s=n(0),c=s.default.MODAL,l=s.default.BUTTON,u=s.default.OVERLAY,f=function(t){t.preventDefault(),v()},d=function(t){t.preventDefault(),g()},p=function(t){if(o.default.isOpen)switch(t.key){case"Escape":return r.onAction(a.CANCEL_KEY)}},m=function(t){if(o.default.isOpen)switch(t.key){case"Tab":return f(t)}},b=function(t){if(o.default.isOpen)return"Tab"===t.key&&t.shiftKey?d(t):void 0},v=function(){var t=i.getNode(l);t&&(t.tabIndex=0,t.focus())},g=function(){var t=i.getNode(c),e=t.querySelectorAll("."+l),n=e.length-1,o=e[n];o&&o.focus()},h=function(t){t[t.length-1].addEventListener("keydown",m)},w=function(t){t[0].addEventListener("keydown",b)},y=function(){var t=i.getNode(c),e=t.querySelectorAll("."+l);e.length&&(h(e),w(e))},x=function(t){if(i.getNode(u)===t.target)return r.onAction(a.CANCEL_KEY)},_=function(t){var e=i.getNode(u);e.removeEventListener("click",x),t&&e.addEventListener("click",x)},k=function(t){o.default.timer&&clearTimeout(o.default.timer),t&&(o.default.timer=window.setTimeout(function(){return r.onAction(a.CANCEL_KEY)},t))},O=function(t){t.closeOnEsc?document.addEventListener("keyup",p):document.removeEventListener("keyup",p),t.dangerMode?v():g(),y(),_(t.closeOnClickOutside),k(t.timer)};e.default=O},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(1),r=n(3),i=n(37),a=n(38),s={title:null,text:null,icon:null,buttons:r.defaultButtonList,content:null,className:null,closeOnClickOutside:!0,closeOnEsc:!0,dangerMode:!1,timer:null},c=Object.assign({},s);e.setDefaults=function(t){c=Object.assign({},s,t)};var l=function(t){var e=t&&t.button,n=t&&t.buttons;return void 0!==e&&void 0!==n&&o.throwErr("Cannot set both 'button' and 'buttons' options!"),void 0!==e?{confirm:e}:n},u=function(t){return o.ordinalSuffixOf(t+1)},f=function(t,e){o.throwErr(u(e)+" argument ('"+t+"') is invalid")},d=function(t,e){var n=t+1,r=e[n];o.isPlainObject(r)||void 0===r||o.throwErr("Expected "+u(n)+" argument ('"+r+"') to be a plain object")},p=function(t,e){var n=t+1,r=e[n];void 0!==r&&o.throwErr("Unexpected "+u(n)+" argument ("+r+")")},m=function(t,e,n,r){var i=typeof e,a="string"===i,s=e instanceof Element;if(a){if(0===n)return{text:e};if(1===n)return{text:e,title:r[0]};if(2===n)return d(n,r),{icon:e};f(e,n)}else{if(s&&0===n)return d(n,r),{content:e};if(o.isPlainObject(e))return p(n,r),e;f(e,n)}};e.getOpts=function(){for(var t=[],e=0;e