// source --> https://totaalonlinemarketing.nl/wp-content/plugins/masterslider/public/assets/js/jquery.easing.min.js?ver=30.2.14
/*
* jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
*
* Uses the built in easing capabilities added In jQuery 1.1
* to offer multiple easing options
*
* TERMS OF USE - EASING EQUATIONS
*
* Open source under the BSD License.
*
* Copyright © 2001 Robert Penner
* All rights reserved.
*
* TERMS OF USE - jQuery Easing
*
* Open source under the BSD License.
*
* Copyright © 2008 George McGinley Smith
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* Neither the name of the author nor the names of contributors may be used to endorse
* or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
jQuery.easing.jswing=jQuery.easing.swing;jQuery.extend(jQuery.easing,{def:"easeOutQuad",swing:function(e,f,a,h,g){return jQuery.easing[jQuery.easing.def](e,f,a,h,g)},easeInQuad:function(e,f,a,h,g){return h*(f/=g)*f+a},easeOutQuad:function(e,f,a,h,g){return -h*(f/=g)*(f-2)+a},easeInOutQuad:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f+a}return -h/2*((--f)*(f-2)-1)+a},easeInCubic:function(e,f,a,h,g){return h*(f/=g)*f*f+a},easeOutCubic:function(e,f,a,h,g){return h*((f=f/g-1)*f*f+1)+a},easeInOutCubic:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f*f+a}return h/2*((f-=2)*f*f+2)+a},easeInQuart:function(e,f,a,h,g){return h*(f/=g)*f*f*f+a},easeOutQuart:function(e,f,a,h,g){return -h*((f=f/g-1)*f*f*f-1)+a},easeInOutQuart:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f*f*f+a}return -h/2*((f-=2)*f*f*f-2)+a},easeInQuint:function(e,f,a,h,g){return h*(f/=g)*f*f*f*f+a},easeOutQuint:function(e,f,a,h,g){return h*((f=f/g-1)*f*f*f*f+1)+a},easeInOutQuint:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f*f*f*f+a}return h/2*((f-=2)*f*f*f*f+2)+a},easeInSine:function(e,f,a,h,g){return -h*Math.cos(f/g*(Math.PI/2))+h+a},easeOutSine:function(e,f,a,h,g){return h*Math.sin(f/g*(Math.PI/2))+a},easeInOutSine:function(e,f,a,h,g){return -h/2*(Math.cos(Math.PI*f/g)-1)+a},easeInExpo:function(e,f,a,h,g){return(f==0)?a:h*Math.pow(2,10*(f/g-1))+a},easeOutExpo:function(e,f,a,h,g){return(f==g)?a+h:h*(-Math.pow(2,-10*f/g)+1)+a},easeInOutExpo:function(e,f,a,h,g){if(f==0){return a}if(f==g){return a+h}if((f/=g/2)<1){return h/2*Math.pow(2,10*(f-1))+a}return h/2*(-Math.pow(2,-10*--f)+2)+a},easeInCirc:function(e,f,a,h,g){return -h*(Math.sqrt(1-(f/=g)*f)-1)+a},easeOutCirc:function(e,f,a,h,g){return h*Math.sqrt(1-(f=f/g-1)*f)+a},easeInOutCirc:function(e,f,a,h,g){if((f/=g/2)<1){return -h/2*(Math.sqrt(1-f*f)-1)+a}return h/2*(Math.sqrt(1-(f-=2)*f)+1)+a},easeInElastic:function(f,h,e,l,k){var i=1.70158;var j=0;var g=l;if(h==0){return e}if((h/=k)==1){return e+l}if(!j){j=k*0.3}if(g https://totaalonlinemarketing.nl/wp-content/plugins/masterslider/public/assets/js/masterslider.min.js?ver=30.2.14
/*!
* Master Slider – Responsive Touch Swipe Slider
* Copyright © 2018 All Rights Reserved.
*
* @author Averta [www.averta.net]
* @version 2.61.2
* @date Jul 2018
*/
window.averta={},function($){function getVendorPrefix(){if("result"in arguments.callee)return arguments.callee.result;var regex=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,someScript=document.getElementsByTagName("script")[0];for(var prop in someScript.style)if(regex.test(prop))return arguments.callee.result=prop.match(regex)[0];return arguments.callee.result="WebkitOpacity"in someScript.style?"Webkit":"KhtmlOpacity"in someScript.style?"Khtml":""}function checkStyleValue(prop){var b=document.body||document.documentElement,s=b.style,p=prop;if("string"==typeof s[p])return!0;v=["Moz","Webkit","Khtml","O","ms"],p=p.charAt(0).toUpperCase()+p.substr(1);for(var i=0;i0&&"none"!==has3d}window["package"]=function(name){window[name]||(window[name]={})};var extend=function(target,object){for(var key in object)target[key]=object[key]};Function.prototype.extend=function(superclass){"function"==typeof superclass.prototype.constructor?(extend(this.prototype,superclass.prototype),this.prototype.constructor=this):(this.prototype.extend(superclass),this.prototype.constructor=this)};var trans={Moz:"-moz-",Webkit:"-webkit-",Khtml:"-khtml-",O:"-o-",ms:"-ms-",Icab:"-icab-"};window._mobile=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),window._touch="ontouchstart"in document,$(document).ready(function(){window._jcsspfx=getVendorPrefix(),window._csspfx=trans[window._jcsspfx],window._cssanim=supportsTransitions(),window._css3d=supports3DTransforms(),window._css2d=supportsTransforms()}),window.parseQueryString=function(url){var queryString={};return url.replace(new RegExp("([^?=&]+)(=([^&]*))?","g"),function($0,$1,$2,$3){queryString[$1]=$3}),queryString};var fps60=50/3;if(window.requestAnimationFrame||(window.requestAnimationFrame=function(){return window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(callback){window.setTimeout(callback,fps60)}}()),window.getComputedStyle||(window.getComputedStyle=function(el){return this.el=el,this.getPropertyValue=function(prop){var re=/(\-([a-z]){1})/g;return"float"==prop&&(prop="styleFloat"),re.test(prop)&&(prop=prop.replace(re,function(){return arguments[2].toUpperCase()})),el.currentStyle[prop]?el.currentStyle[prop]:null},el.currentStyle}),Array.prototype.indexOf||(Array.prototype.indexOf=function(elt){var len=this.length>>>0,from=Number(arguments[1])||0;for(from=0>from?Math.ceil(from):Math.floor(from),0>from&&(from+=len);len>from;from++)if(from in this&&this[from]===elt)return from;return-1}),window.isMSIE=function(version){if(!$.browser.msie)return!1;if(!version)return!0;var ieVer=$.browser.version.slice(0,$.browser.version.indexOf("."));return"string"==typeof version?eval(-1!==version.indexOf("<")||-1!==version.indexOf(">")?ieVer+version:version+"=="+ieVer):version==ieVer},$.removeDataAttrs=function($target,exclude){var i,attrName,dataAttrsToDelete=[],dataAttrs=$target[0].attributes,dataAttrsLen=dataAttrs.length;for(exclude=exclude||[],i=0;dataAttrsLen>i;i++)attrName=dataAttrs[i].name,"data-"===attrName.substring(0,5)&&-1===exclude.indexOf(attrName)&&dataAttrsToDelete.push(dataAttrs[i].name);$.each(dataAttrsToDelete,function(index,attrName){$target.removeAttr(attrName)})},jQuery){$.jqLoadFix=function(){if(this.complete){var that=this;setTimeout(function(){$(that).trigger("load")},1)}},jQuery.uaMatch=jQuery.uaMatch||function(ua){ua=ua.toLowerCase();var match=/(chrome)[ \/]([\w.]+)/.exec(ua)||/(webkit)[ \/]([\w.]+)/.exec(ua)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua)||/(msie) ([\w.]+)/.exec(ua)||ua.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua)||[];return{browser:match[1]||"",version:match[2]||"0"}},matched=jQuery.uaMatch(navigator.userAgent),browser={},matched.browser&&(browser[matched.browser]=!0,browser.version=matched.version),browser.chrome?browser.webkit=!0:browser.webkit&&(browser.safari=!0);var isIE11=!!navigator.userAgent.match(/Trident\/7\./);isIE11&&(browser.msie="true",delete browser.mozilla),jQuery.browser=browser,$.fn.preloadImg=function(src,_event){return this.each(function(){var $this=$(this),self=this,img=new Image;img.onload=function(event){null==event&&(event={}),$this.attr("src",src),event.width=img.width,event.height=img.height,$this.data("width",img.width),$this.data("height",img.height),setTimeout(function(){_event.call(self,event)},50),img=null},img.src=src}),this}}}(jQuery),function(){"use strict";averta.EventDispatcher=function(){this.listeners={}},averta.EventDispatcher.extend=function(_proto){var instance=new averta.EventDispatcher;for(var key in instance)"constructor"!=key&&(_proto[key]=averta.EventDispatcher.prototype[key])},averta.EventDispatcher.prototype={constructor:averta.EventDispatcher,addEventListener:function(event,listener,ref){this.listeners[event]||(this.listeners[event]=[]),this.listeners[event].push({listener:listener,ref:ref})},removeEventListener:function(event,listener,ref){if(this.listeners[event]){for(var i=0;ii;++i)this.listeners[event.type][i].listener.call(this.listeners[event.type][i].ref,event)}}}(),function($){"use strict";var isTouch="ontouchstart"in document,isPointer=window.navigator.pointerEnabled,isMSPoiner=!isPointer&&window.navigator.msPointerEnabled,usePointer=isPointer||isMSPoiner,ev_start=(isPointer?"pointerdown ":"")+(isMSPoiner?"MSPointerDown ":"")+(isTouch?"touchstart ":"")+"mousedown",ev_move=(isPointer?"pointermove ":"")+(isMSPoiner?"MSPointerMove ":"")+(isTouch?"touchmove ":"")+"mousemove",ev_end=(isPointer?"pointerup ":"")+(isMSPoiner?"MSPointerUp ":"")+(isTouch?"touchend ":"")+"mouseup",ev_cancel=(isPointer?"pointercancel ":"")+(isMSPoiner?"MSPointerCancel ":"")+"touchcancel";averta.TouchSwipe=function($element){this.$element=$element,this.enabled=!0,$element.bind(ev_start,{target:this},this.__touchStart),$element[0].swipe=this,this.onSwipe=null,this.swipeType="horizontal",this.noSwipeSelector="input, textarea, button, .no-swipe, .ms-no-swipe",this.lastStatus={}};var p=averta.TouchSwipe.prototype;p.getDirection=function(new_x,new_y){switch(this.swipeType){case"horizontal":return new_x<=this.start_x?"left":"right";case"vertical":return new_y<=this.start_y?"up":"down";case"all":return Math.abs(new_x-this.start_x)>Math.abs(new_y-this.start_y)?new_x<=this.start_x?"left":"right":new_y<=this.start_y?"up":"down"}},p.priventDefultEvent=function(new_x,new_y){var dx=Math.abs(new_x-this.start_x),dy=Math.abs(new_y-this.start_y),horiz=dx>dy;return"horizontal"===this.swipeType&&horiz||"vertical"===this.swipeType&&!horiz},p.createStatusObject=function(evt){var temp_x,temp_y,status_data={};return temp_x=this.lastStatus.distanceX||0,temp_y=this.lastStatus.distanceY||0,status_data.distanceX=evt.pageX-this.start_x,status_data.distanceY=evt.pageY-this.start_y,status_data.moveX=status_data.distanceX-temp_x,status_data.moveY=status_data.distanceY-temp_y,status_data.distance=parseInt(Math.sqrt(Math.pow(status_data.distanceX,2)+Math.pow(status_data.distanceY,2))),status_data.duration=(new Date).getTime()-this.start_time,status_data.direction=this.getDirection(evt.pageX,evt.pageY),status_data},p.__reset=function(event,jqevt){this.reset=!1,this.lastStatus={},this.start_time=(new Date).getTime();var point=this.__getPoint(event,jqevt);this.start_x=point.pageX,this.start_y=point.pageY},p.__touchStart=function(event){var swipe=event.data.target,jqevt=event;if(swipe.enabled&&!($(event.target).closest(swipe.noSwipeSelector,swipe.$element).length>0)){if(event=event.originalEvent,usePointer&&$(this).css("-ms-touch-action","horizontal"===swipe.swipeType?"pan-y":"pan-x"),!swipe.onSwipe)return void $.error("Swipe listener is undefined");if(!(swipe.touchStarted||isTouch&&swipe.start_time&&"mousedown"===event.type&&(new Date).getTime()-swipe.start_time<600)){var point=swipe.__getPoint(event,jqevt);swipe.start_x=point.pageX,swipe.start_y=point.pageY,swipe.start_time=(new Date).getTime(),$(document).bind(ev_end,{target:swipe},swipe.__touchEnd).bind(ev_move,{target:swipe},swipe.__touchMove).bind(ev_cancel,{target:swipe},swipe.__touchCancel);var status=swipe.createStatusObject(point);status.phase="start",swipe.onSwipe.call(null,status),isTouch||jqevt.preventDefault(),swipe.lastStatus=status,swipe.touchStarted=!0}}},p.__touchMove=function(event){var swipe=event.data.target,jqevt=event;if(event=event.originalEvent,swipe.touchStarted){clearTimeout(swipe.timo),swipe.timo=setTimeout(function(){swipe.__reset(event,jqevt)},60);var point=swipe.__getPoint(event,jqevt),status=swipe.createStatusObject(point);swipe.priventDefultEvent(point.pageX,point.pageY)&&jqevt.preventDefault(),status.phase="move",swipe.lastStatus=status,swipe.onSwipe.call(null,status)}},p.__touchEnd=function(event){var swipe=event.data.target,jqevt=event;event=event.originalEvent,clearTimeout(swipe.timo);var status=swipe.lastStatus;isTouch||jqevt.preventDefault(),status.phase="end",swipe.touchStarted=!1,swipe.priventEvt=null,$(document).unbind(ev_end,swipe.__touchEnd).unbind(ev_move,swipe.__touchMove).unbind(ev_cancel,swipe.__touchCancel),status.speed=status.distance/status.duration,swipe.onSwipe.call(null,status)},p.__touchCancel=function(event){var swipe=event.data.target;swipe.__touchEnd(event)},p.__getPoint=function(event,jqEvent){return isTouch&&-1===event.type.indexOf("mouse")?event.touches[0]:usePointer?event:jqEvent},p.enable=function(){this.enabled||(this.enabled=!0)},p.disable=function(){this.enabled&&(this.enabled=!1)}}(jQuery),function(){"use strict";averta.Ticker=function(){};var st=averta.Ticker,list=[],len=0,__stopped=!0;st.add=function(listener,ref){return list.push([listener,ref]),1===list.length&&st.start(),len=list.length},st.remove=function(listener,ref){for(var i=0,l=list.length;l>i;++i)list[i]&&list[i][0]===listener&&list[i][1]===ref&&list.splice(i,1);len=list.length,0===len&&st.stop()},st.start=function(){__stopped&&(__stopped=!1,__tick())},st.stop=function(){__stopped=!0};var __tick=function(){if(!st.__stopped){for(var item,i=0;i!==len;i++)item=list[i],item[0].call(item[1]);requestAnimationFrame(__tick)}}}(),function(){"use strict";Date.now||(Date.now=function(){return(new Date).getTime()}),averta.Timer=function(delay,autoStart){this.delay=delay,this.currentCount=0,this.paused=!1,this.onTimer=null,this.refrence=null,autoStart&&this.start()},averta.Timer.prototype={constructor:averta.Timer,start:function(){this.paused=!1,this.lastTime=Date.now(),averta.Ticker.add(this.update,this)},stop:function(){this.paused=!0,averta.Ticker.remove(this.update,this)},reset:function(){this.currentCount=0,this.paused=!0,this.lastTime=Date.now()},update:function(){this.paused||Date.now()-this.lastTime0?that.delay+"ms":"",element.style[window._jcsspfx+"TransitionTimingFunction"]=that.ease,that.to_cb&&that.to_cb.call(that.to_cb_target),that.end_to=setTimeout(function(){that.onTransComplete()},that.duration+(that.delay||0)))},1),this}}(),function(){"use strict";function transPos(element,properties){if(void 0!==properties.x||void 0!==properties.y)if(_cssanim){var trans=window._jcsspfx+"Transform";void 0!==properties.x&&(properties[trans]=(properties[trans]||"")+" translateX("+properties.x+"px)",delete properties.x),void 0!==properties.y&&(properties[trans]=(properties[trans]||"")+" translateY("+properties.y+"px)",delete properties.y)}else{if(void 0!==properties.x){var posx="auto"!==element.css("right")?"right":"left";properties[posx]=properties.x+"px",delete properties.x}if(void 0!==properties.y){var posy="auto"!==element.css("bottom")?"bottom":"top";properties[posy]=properties.y+"px",delete properties.y}}return properties}var _cssanim=null;window.CTween={},CTween.setPos=function(element,pos){element.css(transPos(element,pos))},CTween.animate=function(element,duration,properties,options){if(null==_cssanim&&(_cssanim=window._cssanim),options=options||{},transPos(element,properties),_cssanim){var tween=new CSSTween(element,duration,options.delay,EaseDic[options.ease]);return options.transProperty&&(tween.transProperty=options.transProperty),tween.to(function(){element.css(properties)}),options.complete&&tween.onComplete(options.complete,options.target),tween.start(),tween.stop=tween.reset,tween}var onCl;return options.delay&&element.delay(options.delay),options.complete&&(onCl=function(){options.complete.call(options.target)}),element.stop(!0).animate(properties,duration,options.ease||"linear",onCl),element},CTween.fadeOut=function(target,duration,remove){var options={};remove===!0?options.complete=function(){target.remove()}:2===remove&&(options.complete=function(){target.css("display","none")}),CTween.animate(target,duration||1e3,{opacity:0},options)},CTween.fadeIn=function(target,duration,reset){reset!==!1&&target.css("opacity",0).css("display",""),CTween.animate(target,duration||1e3,{opacity:1})}}(),function(){window.EaseDic={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",easeInCubic:"cubic-bezier(.55,.055,.675,.19)",easeOutCubic:"cubic-bezier(.215,.61,.355,1)",easeInOutCubic:"cubic-bezier(.645,.045,.355,1)",easeInCirc:"cubic-bezier(.6,.04,.98,.335)",easeOutCirc:"cubic-bezier(.075,.82,.165,1)",easeInOutCirc:"cubic-bezier(.785,.135,.15,.86)",easeInExpo:"cubic-bezier(.95,.05,.795,.035)",easeOutExpo:"cubic-bezier(.19,1,.22,1)",easeInOutExpo:"cubic-bezier(1,0,0,1)",easeInQuad:"cubic-bezier(.55,.085,.68,.53)",easeOutQuad:"cubic-bezier(.25,.46,.45,.94)",easeInOutQuad:"cubic-bezier(.455,.03,.515,.955)",easeInQuart:"cubic-bezier(.895,.03,.685,.22)",easeOutQuart:"cubic-bezier(.165,.84,.44,1)",easeInOutQuart:"cubic-bezier(.77,0,.175,1)",easeInQuint:"cubic-bezier(.755,.05,.855,.06)",easeOutQuint:"cubic-bezier(.23,1,.32,1)",easeInOutQuint:"cubic-bezier(.86,0,.07,1)",easeInSine:"cubic-bezier(.47,0,.745,.715)",easeOutSine:"cubic-bezier(.39,.575,.565,1)",easeInOutSine:"cubic-bezier(.445,.05,.55,.95)",easeInBack:"cubic-bezier(.6,-.28,.735,.045)",easeOutBack:"cubic-bezier(.175, .885,.32,1.275)",easeInOutBack:"cubic-bezier(.68,-.55,.265,1.55)"}}(),function(){"use strict";window.MSAligner=function(type,$container,$img){this.$container=$container,this.$img=$img,this.type=type||"stretch",this.widthOnly=!1,this.heightOnly=!1};var p=MSAligner.prototype;p.init=function(w,h){switch(this.baseWidth=w,this.baseHeight=h,this.imgRatio=w/h,this.imgRatio2=h/w,this.type){case"tile":this.$container.css("background-image","url("+this.$img.attr("src")+")"),this.$img.remove();break;case"center":this.$container.css("background-image","url("+this.$img.attr("src")+")"),this.$container.css({backgroundPosition:"center center",backgroundRepeat:"no-repeat"}),this.$img.remove();break;case"stretch":this.$img.css({width:"100%",height:"100%"});break;case"fill":case"fit":this.needAlign=!0,this.align()}},p.align=function(){if(this.needAlign){var cont_w=this.$container[0].offsetWidth,cont_h=this.$container[0].offsetHeight,contRatio=cont_w/cont_h;"fill"==this.type?this.imgRatio
*/
function($){var Polyfill=function(userOptions){this.options=$.extend({},Polyfill.defaultOptions,userOptions),this.isEnabled=!1,(this.options.forcePolyfill||!this.supportsPointerEvents())&&(this.registerEvents(),this.isEnabled=!0)};Polyfill.defaultOptions={forcePolyfill:!1,selector:"*",listenOn:["click","dblclick","mousedown","mouseup"],pointerEventsNoneClass:null,pointerEventsAllClass:null,eventNamespace:"pointer-events-polyfill"},Polyfill.prototype.registerEvents=function(){$(document).on(this.getEventNames(),this.options.selector,$.proxy(this.onElementClick,this))},Polyfill.prototype.getEventNames=function(){var eventNamespace=this.options.eventNamespace?"."+this.options.eventNamespace:"";return this.options.listenOn.join(eventNamespace+" ")+eventNamespace},Polyfill.prototype.supportsPointerEvents=function(){var style=document.createElement("a").style;return style.cssText="pointer-events:auto","auto"===style.pointerEvents},Polyfill.prototype.isClickThrough=function($el){var elPointerEventsCss=$el.css("pointer-events");return 0===$el.length||"all"===elPointerEventsCss||$el.is(":root")||$el.hasClass(this.options.pointerEventsAllClass)?!1:"none"===elPointerEventsCss||$el.hasClass(this.options.pointerEventsNoneClass)||this.isClickThrough($el.parent())?!0:!1},Polyfill.prototype.onElementClick=function(e){var $elOrg=$(e.target);if(!this.isClickThrough($elOrg))return!0;$elOrg.hide();var elBelow=document.elementFromPoint(e.clientX,e.clientY);return e.target=elBelow,$(elBelow).trigger(e),"A"===elBelow.tagName&&(2===e.which?window.open(elBelow.getAttribute("href"),"_blank"):elBelow.click()),$elOrg.show(),!1},Polyfill.prototype.destroy=function(){$(document).off(this.getEventNames()),this.isEnabled=!1},window.pointerEventsPolyfill=function(userOptions){return new Polyfill(userOptions)}}(jQuery),function(){"use strict";var _options={bouncing:!0,snapping:!1,snapsize:null,friction:.05,outFriction:.05,outAcceleration:.09,minValidDist:.3,snappingMinSpeed:2,paging:!1,endless:!1,maxSpeed:160},Controller=function(min,max,options){if(null===max||null===min)throw new Error("Max and Min values are required.");this.options=options||{};for(var key in _options)key in this.options||(this.options[key]=_options[key]);this._max_value=max,this._min_value=min,this.value=min,this.end_loc=min,this.current_snap=this.getSnapNum(min),this.__extrStep=0,this.__extraMove=0,this.__animID=-1},p=Controller.prototype;p.changeTo=function(value,animate,speed,snap_num,dispatch){if(this.stopped=!1,this._internalStop(),value=this._checkLimits(value),speed=Math.abs(speed||0),this.options.snapping&&(snap_num=snap_num||this.getSnapNum(value),dispatch!==!1&&this._callsnapChange(snap_num),this.current_snap=snap_num),animate){this.animating=!0;var self=this,active_id=++self.__animID,amplitude=value-self.value,timeStep=0,targetPosition=value,animFrict=1-self.options.friction,timeconst=animFrict+(speed-20)*animFrict*1.3/self.options.maxSpeed,tick=function(){if(active_id===self.__animID){var dis=value-self.value;if(!(Math.abs(dis)>self.options.minValidDist&&self.animating))return self.animating&&(self.value=value,self._callrenderer()),self.animating=!1,active_id!==self.__animID&&(self.__animID=-1),void self._callonComplete("anim");window.requestAnimationFrame(tick),self.value=targetPosition-amplitude*Math.exp(-++timeStep*timeconst),self._callrenderer()}};return void tick()}this.value=value,this._callrenderer()},p.drag=function(move){this.start_drag&&(this.drag_start_loc=this.value,this.start_drag=!1),this.animating=!1,this._deceleration=!1,this.value-=move,!this.options.endless&&(this.value>this._max_value||this.value<0)?this.options.bouncing?(this.__isout=!0,this.value+=.6*move):this.value=this.value>this._max_value?this._max_value:0:!this.options.endless&&this.options.bouncing&&(this.__isout=!1),this._callrenderer()},p.push=function(speed){if(this.stopped=!1,this.options.snapping&&Math.abs(speed)<=this.options.snappingMinSpeed)return void this.cancel();if(this.__speed=speed,this.__startSpeed=speed,this.end_loc=this._calculateEnd(),this.options.snapping){var snap_loc=this.getSnapNum(this.value),end_snap=this.getSnapNum(this.end_loc);if(this.options.paging)return snap_loc=this.getSnapNum(this.drag_start_loc),this.__isout=!1,void(speed>0?this.gotoSnap(snap_loc+1,!0,speed):this.gotoSnap(snap_loc-1,!0,speed));if(snap_loc===end_snap)return void this.cancel();this._callsnapChange(end_snap),this.current_snap=end_snap}this.animating=!1,this.__needsSnap=this.options.endless||this.end_loc>this._min_value&&this.end_locthis._max_value?(this.__speed=8,this.__needsSnap=!1,this._startDecelaration()):this.gotoSnap(curr_snap+1,!0)},p.prevSnap=function(){this._internalStop();var curr_snap=this.getSnapNum(this.value);!this.options.endless&&(curr_snap-1)*this.options.snapsizethis.options.minValidDist;)temp_value+=temp_speed,temp_speed*=this.options.friction,i++;return step?i:temp_value},p._checkLimits=function(value){return this.options.endless?value:valuethis._max_value?this._max_value:value},p._callrenderer=function(){this.__renderHook&&this.__renderHook.fun.call(this.__renderHook.ref,this,this.value)},p._callsnapChange=function(targetSnap){this.__snapHook&&targetSnap!==this.current_snap&&this.__snapHook.fun.call(this.__snapHook.ref,this,targetSnap,targetSnap-this.current_snap)},p._callonComplete=function(type){this.__compHook&&!this.stopped&&this.__compHook.fun.call(this.__compHook.ref,this,this.current_snap,type)},p._computeDeceleration=function(){if(this.options.snapping&&this.__needsSnap){var xtr_move=(this.__startSpeed-this.__speed)/this.__startSpeed*this.__extraMove;this.value+=this.__speed+xtr_move-this.__extrStep,this.__extrStep=xtr_move}else this.value+=this.__speed;if(this.__speed*=this.options.friction,this.options.endless||this.options.bouncing||(this.value<=this._min_value?(this.value=this._min_value,this.__speed=0):this.value>=this._max_value&&(this.value=this._max_value,this.__speed=0)),this._callrenderer(),!this.options.endless&&this.options.bouncing){var out_value=0;this.valuethis._max_value&&(out_value=this._max_value-this.value),this.__isout=Math.abs(out_value)>=this.options.minValidDist,this.__isout&&(this.__speed*out_value<=0?this.__speed+=out_value*this.options.outFriction:this.__speed=out_value*this.options.outAcceleration)}},p._startDecelaration=function(){if(!this._deceleration){this._deceleration=!0;var self=this,tick=function(){self._deceleration&&(self._computeDeceleration(),Math.abs(self.__speed)>self.options.minValidDist||self.__isout?window.requestAnimationFrame(tick):(self._deceleration=!1,self.__isout=!1,self.value=self.__needsSnap&&self.options.snapping&&!self.options.paging?self._checkLimits(self.end_loc+self.__extraMove):Math.round(self.value),self._callrenderer(),self._callonComplete("decel")))};tick()}},window.Controller=Controller}(),function(window,document,$){window.MSLayerController=function(slide){this.slide=slide,this.slider=slide.slider,this.layers=[],this.layersCount=0,this.preloadCount=0,this.$layers=$("
").addClass("ms-slide-layers"),this.$staticLayers=$("
").addClass("ms-static-layers"),this.$fixedLayers=$("
").addClass("ms-fixed-layers"),this.$animLayers=$("
").addClass("ms-anim-layers")};var p=MSLayerController.prototype;p.addLayer=function(layer){switch(layer.slide=this.slide,layer.controller=this,layer.$element.data("position")){case"static":this.hasStaticLayer=!0,layer.$element.appendTo(this.$staticLayers);break;case"fixed":this.hasFixedLayer=!0,layer.$element.appendTo(this.$fixedLayers);break;default:layer.$element.appendTo(this.$animLayers)}layer.create(),this.layers.push(layer),this.layersCount++,layer.parallax&&(this.hasParallaxLayer=!0),layer.needPreload&&this.preloadCount++},p.create=function(){this.slide.$element.append(this.$layers),this.$layers.append(this.$animLayers),this.hasStaticLayer&&this.$layers.append(this.$staticLayers),"center"==this.slider.options.layersMode&&(this.$layers.css("max-width",this.slider.options.width+"px"),this.hasFixedLayer&&this.$fixedLayers.css("max-width",this.slider.options.width+"px"))},p.loadLayers=function(callback){if(this._onReadyCallback=callback,0===this.preloadCount)return void this._onlayersReady();for(var i=0;i!==this.layersCount;++i)this.layers[i].needPreload&&this.layers[i].loadImage()},p.prepareToShow=function(){this.hasParallaxLayer&&this._enableParallaxEffect(),this.hasFixedLayer&&this.$fixedLayers.prependTo(this.slide.view.$element)},p.showLayers=function(){this.layersHideTween&&this.layersHideTween.stop(!0),this.fixedLayersHideTween&&this.fixedLayersHideTween.stop(!0),this._resetLayers(),this.$animLayers.css("opacity","").css("display",""),this.hasFixedLayer&&this.$fixedLayers.css("opacity","").css("display",""),this.ready&&(this._initLayers(),this._locateLayers(),this._startLayers())},p.hideLayers=function(){if(this.slide.selected||this.slider.options.instantStartLayers){var that=this;that.layersHideTween=CTween.animate(this.$animLayers,500,{opacity:0},{complete:function(){that._resetLayers()}}),this.hasFixedLayer&&(this.fixedLayersHideTween=CTween.animate(this.$fixedLayers,500,{opacity:0},{complete:function(){that.$fixedLayers.detach()}})),this.hasParallaxLayer&&this._disableParallaxEffect()}},p.animHideLayers=function(){if(this.ready)for(var i=0;i!==this.layersCount;++i)this.layers[i].hide()},p.setSize=function(width,height,hard){if(this.ready&&(this.slide.selected||this.hasStaticLayer)&&(hard&&this._initLayers(!0),this._locateLayers(!this.slide.selected)),this.slider.options.autoHeight&&this.updateHeight(),"center"==this.slider.options.layersMode){var left=Math.max(0,(width-this.slider.options.width)/2)+"px";this.$layers[0].style.left=left,this.$fixedLayers[0].style.left=left}},p.updateHeight=function(){},p._onlayersReady=function(){this.ready=!0,this.hasStaticLayer&&!this.slide.isSleeping&&this._initLayers(!1,!0),this._onReadyCallback.call(this.slide)},p.onSlideSleep=function(){},p.onSlideWakeup=function(){this.hasStaticLayer&&this.ready&&this._initLayers(!1,!0)},p.getLayerById=function(layerId){if(!layerId)return null;for(var i=0;i").addClass("ms-layer-mask"),this.link?(this.link.wrap(this.$mask),this.$mask=this.link.parent()):(this.$element.wrap(this.$mask),this.$mask=this.$element.parent()),this.maskWidth&&this.$mask.width(this.maskWidth),this.maskHeight&&(this.$mask.height(this.maskHeight),-1===this.__cssConfig.indexOf("height")&&this.__cssConfig.push("height")));var layerOrigin=this.layerOrigin=this.$element.data("origin");if(layerOrigin){var vOrigin=layerOrigin.charAt(0),hOrigin=layerOrigin.charAt(1),offsetX=this.$element.data("offset-x"),offsetY=this.$element.data("offset-y"),layerEle=this.masked?this.$mask[0]:this.$element[0];switch(void 0===offsetY&&(offsetY=0),vOrigin){case"t":layerEle.style.top=offsetY+"px";break;case"b":layerEle.style.bottom=offsetY+"px";break;case"m":layerEle.style.top=offsetY+"px",this.middleAlign=!0}switch(void 0===offsetX&&(offsetX=0),hOrigin){case"l":layerEle.style.left=offsetX+"px";break;case"r":layerEle.style.right=offsetX+"px";break;case"c":layerEle.style.left=offsetX+"px",this.centerAlign=!0}}this.parallax=this.$element.data("parallax"),null!=this.parallax&&(this.parallax/=100,this.$parallaxElement=$("
").addClass("ms-parallax-layer"),this.masked?(this.$mask.wrap(this.$parallaxElement),this.$parallaxElement=this.$mask.parent()):this.link?(this.link.wrap(this.$parallaxElement),this.$parallaxElement=this.link.parent()):(this.$element.wrap(this.$parallaxElement),this.$parallaxElement=this.$element.parent()),this._lastParaX=0,this._lastParaY=0,this._paraX=0,this._paraY=0,this.alignedToBot=this.layerOrigin&&-1!==this.layerOrigin.indexOf("b"),this.alignedToBot&&this.$parallaxElement.css("bottom",0),this.parallaxRender=window._css3d?this._parallaxCSS3DRenderer:window._css2d?this._parallaxCSS2DRenderer:this._parallax2DRenderer,"swipe"!==this.slider.options.parallaxMode&&averta.Ticker.add(this.parallaxRender,this)),$.removeDataAttrs(this.$element,["data-src"])},p.init=function(){this.initialized=!0;var value;this.$element.css("visibility","");for(var i=0,l=this.__cssConfig.length;l>i;i++){var key=this.__cssConfig[i];if(this._isPosition(key)&&this.masked)value=this.$mask.css(key);else if("text"!==this.type||"width"!==key||this.masked||this.maskWidth){value=this.$element.css(key);var isSize="width"===key||"height"===key;isSize&&this.masked&&(this.maskWidth&&"width"===key?value=this.maskWidth+"px":this.maskHeight&&"height"===key&&(value=this.maskHeight+"px")),isSize&&"0px"===value&&(value=this.$element.data(key)+"px")}else value=this.$element[0].style.width;this.layerOrigin&&("top"===key&&-1===this.layerOrigin.indexOf("t")&&-1===this.layerOrigin.indexOf("m")||"bottom"===key&&-1===this.layerOrigin.indexOf("b")||"left"===key&&-1===this.layerOrigin.indexOf("l")&&-1===this.layerOrigin.indexOf("c")||"right"===key&&-1===this.layerOrigin.indexOf("r"))||"auto"!=value&&""!=value&&"normal"!=value&&(this.baseStyle[key]=parseInt(value))}this.middleAlign&&(this.baseHeight=this.$element.outerHeight(!1)),this.centerAlign&&(this.baseWidth=this.$element.outerWidth(!1))},p.locate=function(){if(this.slide.ready){var factor,isPosition,isSize,width=parseFloat(this.layersCont.css("width")),height=parseFloat(this.layersCont.css("height"));!this.staticLayer&&"none"===this.$element.css("display")&&this.isVisible&&this.$element.css("display","").css("visibility","hidden"),this.staticLayer&&this.$element.addClass("ms-hover-active"),factor=this.resizeFactor=width/this.slide.slider.options.width;var $layerEle=this.masked?this.$mask:this.$element;for(var key in this.baseStyle)isPosition=this._isPosition(key),isSize="width"===key||"height"===key,factor=this.fixed&&isPosition?1:this.resizeFactor,(this.resizable||isPosition)&&("top"===key&&this.middleAlign?($layerEle[0].style.top="0px",this.baseHeight=$layerEle.outerHeight(!1),$layerEle[0].style.top=this.baseStyle.top*factor+(height-this.baseHeight)/2+"px"):"left"===key&&this.centerAlign?($layerEle[0].style.left="0px",this.baseWidth=$layerEle.outerWidth(!1),$layerEle[0].style.left=this.baseStyle.left*factor+(width-this.baseWidth)/2+"px"):isPosition&&this.masked?$layerEle[0].style[key]=this.baseStyle[key]*factor+"px":isSize&&("width"===key&&this.maskWidth||"height"===key&&this.maskHeight)?$layerEle[0].style[key]=this.baseStyle[key]*factor+"px":this.$element.css(key,this.baseStyle[key]*factor+"px"));
this.visible(this.minWidthi;++i)value=eff_params[i],value in MSLayerEffects.presetEffParams&&(value=MSLayerEffects.presetEffParams[value]),eff_params[i]=value}return{eff_name:eff_name,eff_params:eff_params}},p._parseEffParams=function(params){for(var eff_params=[],i=0,l=params.length;l>i;++i){var value=params[i];"string"==typeof value&&-1!==value.indexOf("|")&&(value=this._randomParam(value)),eff_params[i]=value}return eff_params},p._checkPosKey=function(key,style){return"left"===key&&!(key in this.baseStyle)&&"right"in this.baseStyle?(style.right=-parseInt(style.left)+"px",delete style.left,!0):"top"===key&&!(key in this.baseStyle)&&"bottom"in this.baseStyle?(style.bottom=-parseInt(style.top)+"px",delete style.top,!0):!1},p._isPosition=function(key){return"top"===key||"left"===key||"bottom"===key||"right"===key},p._parallaxCalc=function(){var x_def=this._paraX-this._lastParaX,y_def=this._paraY-this._lastParaY;this._lastParaX+=x_def/12,this._lastParaY+=y_def/12,Math.abs(x_def)<.019&&(this._lastParaX=this._paraX),Math.abs(y_def)<.019&&(this._lastParaY=this._paraY)},p._parallaxCSS3DRenderer=function(){this._parallaxCalc(),this.$parallaxElement[0].style[window._jcsspfx+"Transform"]="translateX("+this._lastParaX*this.parallax+"px) translateY("+this._lastParaY*this.parallax+"px) translateZ(0)"},p._parallaxCSS2DRenderer=function(){this._parallaxCalc(),this.$parallaxElement[0].style[window._jcsspfx+"Transform"]="translateX("+this._lastParaX*this.parallax+"px) translateY("+this._lastParaY*this.parallax+"px)"},p._parallax2DRenderer=function(){this._parallaxCalc(),this.alignedToBot?this.$parallaxElement[0].style.bottom=this._lastParaY*this.parallax+"px":this.$parallaxElement[0].style.top=this._lastParaY*this.parallax+"px",this.$parallaxElement[0].style.left=this._lastParaX*this.parallax+"px"}}(jQuery),function($){window.MSImageLayerElement=function(){MSLayerElement.call(this),this.needPreload=!0,this.__cssConfig=["width","height","margin-top","padding-top","margin-bottom","padding-left","margin-right","padding-right","margin-left","padding-bottom","left","right","top","bottom"],this.type="image"},MSImageLayerElement.extend(MSLayerElement);var p=MSImageLayerElement.prototype,_super=MSLayerElement.prototype;p.create=function(){if(this.link){var p=this.$element.parent();p.append(this.link),this.link.append(this.$element),this.link.removeClass("ms-layer"),this.$element.addClass("ms-layer"),p=null}if(_super.create.call(this),void 0!=this.$element.data("src"))this.img_src=this.$element.data("src"),this.$element.removeAttr("data-src");else{var that=this;this.$element.on("load",function(){that.controller.preloadCount--,0===that.controller.preloadCount&&that.controller._onlayersReady()}).each($.jqLoadFix)}$.browser.msie&&this.$element.on("dragstart",function(event){event.preventDefault()})},p.loadImage=function(){var that=this;this.$element.preloadImg(this.img_src,function(){that.controller.preloadCount--,0===that.controller.preloadCount&&that.controller._onlayersReady()})}}(jQuery),function($){window.MSVideoLayerElement=function(){MSLayerElement.call(this),this.__cssConfig.push("height"),this.type="video"},MSVideoLayerElement.extend(MSLayerElement);var p=MSVideoLayerElement.prototype,_super=MSLayerElement.prototype;p.__playVideo=function(){this.img&&CTween.fadeOut(this.img,500,2),CTween.fadeOut(this.video_btn,500,2),this.video_frame.attr("src","about:blank").css("display","block"),-1==this.video_url.indexOf("?")&&(this.video_url+="?"),this.video_frame.attr("src",this.video_url+"&autoplay=1")},p.start=function(){_super.start.call(this),this.$element.data("autoplay")&&this.__playVideo()},p.reset=function(){return _super.reset.call(this),(this.needPreload||this.$element.data("btn"))&&(this.video_btn.css("opacity",1).css("display","block"),this.video_frame.attr("src","about:blank").css("display","none")),this.needPreload?void this.img.css("opacity",1).css("display","block"):void this.video_frame.attr("src",this.video_url)},p.create=function(){_super.create.call(this),this.video_frame=this.$element.find("iframe").css({width:"100%",height:"100%"}),this.video_url=this.video_frame.attr("src");var has_img=0!=this.$element.has("img").length;if(has_img||this.$element.data("btn")){this.video_frame.attr("src","about:blank").css("display","none");var that=this;if(this.video_btn=$("
").appendTo(this.$element).addClass("ms-video-btn").click(function(){that.__playVideo()}),has_img){if(this.needPreload=!0,this.img=this.$element.find("img:first").addClass("ms-video-img"),void 0!==this.img.data("src"))this.img_src=this.img.data("src"),this.img.removeAttr("data-src");else{var that=this;this.img.attr("src",this.img_src).on("load",function(){that.controller.preloadCount--,0===that.controller.preloadCount&&that.controller._onlayersReady()}).each($.jqLoadFix)}$.browser.msie&&this.img.on("dragstart",function(event){event.preventDefault()})}}},p.loadImage=function(){var that=this;this.img.preloadImg(this.img_src,function(){that.controller.preloadCount--,0===that.controller.preloadCount&&that.controller._onlayersReady()})}}(jQuery),function($){"use strict";window.MSHotspotLayer=function(){MSLayerElement.call(this),this.__cssConfig=["margin-top","padding-top","margin-bottom","padding-left","margin-right","padding-right","margin-left","padding-bottom","left","right","top","bottom"],this.ease="Expo",this.hide_start=!0,this.type="hotspot"},MSHotspotLayer.extend(MSLayerElement);var p=MSHotspotLayer.prototype,_super=MSLayerElement.prototype;p._showTT=function(){this.show_cl&&(clearTimeout(this.hto),this._tween&&this._tween.stop(!0),this.hide_start&&(this.align=this._orgAlign,this._locateTT(),this.tt.css({display:"block"}),this._tween=CTween.animate(this.tt,900,this.to,{ease:"easeOut"+this.ease}),this.hide_start=!1))},p._hideTT=function(){if(this.show_cl){this._tween&&this._tween.stop(!0);var that=this;clearTimeout(this.hto),this.hto=setTimeout(function(){that.hide_start=!0,that._tween=CTween.animate(that.tt,900,that.from,{ease:"easeOut"+that.ease,complete:function(){that.tt.css("display","none")}})},200)}},p._updateClassName=function(name){this._lastClass&&this.tt.removeClass(this._lastClass),this.tt.addClass(name),this._lastClass=name},p._alignPolicy=function(){{var w=(this.tt.outerHeight(!1),Math.max(this.tt.outerWidth(!1),parseInt(this.tt.css("max-width")))),ww=window.innerWidth;window.innerHeight}switch(this.align){case"top":if(this.base_t<0)return"bottom";break;case"right":if(this.base_l+w>ww||this.base_t<0)return"bottom";break;case"left":if(this.base_l<0||this.base_t<0)return"bottom"}return null},p._locateTT=function(){var os=this.$element.offset(),os2=this.slide.slider.$element.offset(),dist=50,space=15;this.pos_x=os.left-os2.left-this.slide.slider.$element.scrollLeft(),this.pos_y=os.top-os2.top-this.slide.slider.$element.scrollTop(),this.from={opacity:0},this.to={opacity:1},this._updateClassName("ms-tooltip-"+this.align),this.tt_arrow.css("margin-left","");var arrow_w=15,arrow_h=15;switch(this.align){case"top":var w=Math.min(this.tt.outerWidth(!1),parseInt(this.tt.css("max-width")));this.base_t=this.pos_y-this.tt.outerHeight(!1)-arrow_h-space,this.base_l=this.pos_x-w/2,this.base_l+w>window.innerWidth&&(this.tt_arrow.css("margin-left",-arrow_w/2+this.base_l+w-window.innerWidth+"px"),this.base_l=window.innerWidth-w),this.base_l<0&&(this.base_l=0,this.tt_arrow.css("margin-left",-arrow_w/2+this.pos_x-this.tt.outerWidth(!1)/2+"px")),window._css3d?(this.from[window._jcsspfx+"Transform"]="translateY(-"+dist+"px)",this.to[window._jcsspfx+"Transform"]=""):(this.from.top=this.base_t-dist+"px",this.to.top=this.base_t+"px");break;case"bottom":var w=Math.min(this.tt.outerWidth(!1),parseInt(this.tt.css("max-width")));this.base_t=this.pos_y+arrow_h+space,this.base_l=this.pos_x-w/2,this.base_l+w>window.innerWidth&&(this.tt_arrow.css("margin-left",-arrow_w/2+this.base_l+w-window.innerWidth+"px"),this.base_l=window.innerWidth-w),this.base_l<0&&(this.base_l=0,this.tt_arrow.css("margin-left",-arrow_w/2+this.pos_x-this.tt.outerWidth(!1)/2+"px")),window._css3d?(this.from[window._jcsspfx+"Transform"]="translateY("+dist+"px)",this.to[window._jcsspfx+"Transform"]=""):(this.from.top=this.base_t+dist+"px",this.to.top=this.base_t+"px");break;case"right":this.base_l=this.pos_x+arrow_w+space,this.base_t=this.pos_y-this.tt.outerHeight(!1)/2,window._css3d?(this.from[window._jcsspfx+"Transform"]="translateX("+dist+"px)",this.to[window._jcsspfx+"Transform"]=""):(this.from.left=this.base_l+dist+"px",this.to.left=this.base_l+"px");break;case"left":this.base_l=this.pos_x-arrow_w-this.tt.outerWidth(!1)-space,this.base_t=this.pos_y-this.tt.outerHeight(!1)/2,window._css3d?(this.from[window._jcsspfx+"Transform"]="translateX(-"+dist+"px)",this.to[window._jcsspfx+"Transform"]=""):(this.from.left=this.base_l-dist+"px",this.to.left=this.base_l+"px")}var policyAlign=this._alignPolicy();return null!==policyAlign?(this.align=policyAlign,void this._locateTT()):(this.tt.css("top",parseInt(this.base_t)+"px").css("left",parseInt(this.base_l)+"px"),void this.tt.css(this.from))},p.start=function(){_super.start.call(this),this.tt.appendTo(this.slide.slider.$element),this.tt.css("display","none")},p.reset=function(){_super.reset.call(this),this.tt.detach()},p.create=function(){var that=this;this._orgAlign=this.align=void 0!==this.$element.data("align")?this.$element.data("align"):"top",this.data=this.$element.html(),this.$element.html("").on("mouseenter",function(){that._showTT()}).on("mouseleave",function(){that._hideTT()}),this.point=$('').addClass("ms-tooltip-point").appendTo(this.$element);var link=this.$element.data("link"),target=this.$element.data("target");link&&this.point.on("click",function(){window.open(link,target||"_self")}),this.tt=$("
").addClass("ms-tooltip").css("display","hidden").css("opacity",0),void 0!==this.$element.data("width")&&this.tt.css("width",this.$element.data("width")).css("max-width",this.$element.data("width")),this.tt_arrow=$("
").addClass("ms-tooltip-arrow").appendTo(this.tt),this._updateClassName("ms-tooltip-"+this.align),this.ttcont=$("
").addClass("ms-tooltip-cont").html(this.data).appendTo(this.tt),this.$element.data("stay-hover")===!0&&this.tt.on("mouseenter",function(){that.hide_start||(clearTimeout(that.hto),that._tween.stop(!0),that._showTT())}).on("mouseleave",function(){that._hideTT()}),_super.create.call(this)}}(jQuery),function(){window.MSButtonLayer=function(){MSLayerElement.call(this),this.type="button"},MSButtonLayer.extend(MSLayerElement);var p=MSButtonLayer.prototype,_super=MSLayerElement.prototype,positionKies=["top","left","bottom","right"];p.create=function(){_super.create.call(this),this.$element.wrap('
').css("position","relative"),this.$container=this.$element.parent()},p.locate=function(){_super.locate.call(this);for(var key,tempValue,i=0;4>i;i++)key=positionKies[i],key in this.baseStyle&&(tempValue=this.$element.css(key),this.$element.css(key,""),this.$container.css(key,tempValue));this.$container.width(this.$element.outerWidth(!0)).height(this.$element.outerHeight(!0))}}(jQuery),window.MSSliderEvent=function(type){this.type=type},MSSliderEvent.CHANGE_START="ms_changestart",MSSliderEvent.CHANGE_END="ms_changeend",MSSliderEvent.WAITING="ms_waiting",MSSliderEvent.AUTOPLAY_CHANGE="ms_autoplaychange",MSSliderEvent.VIDEO_PLAY="ms_videoPlay",MSSliderEvent.VIDEO_CLOSE="ms_videoclose",MSSliderEvent.INIT="ms_init",MSSliderEvent.HARD_UPDATE="ms_hard_update",MSSliderEvent.RESIZE="ms_resize",MSSliderEvent.RESERVED_SPACE_CHANGE="ms_rsc",MSSliderEvent.DESTROY="ms_destroy",function(window,document,$){"use strict";window.MSSlide=function(){this.$element=null,this.$loading=$("
").addClass("ms-slide-loading"),this.view=null,this.index=-1,this.__width=0,this.__height=0,this.fillMode="fill",this.selected=!1,this.pselected=!1,this.autoAppend=!0,this.isSleeping=!0,this.moz=$.browser.mozilla};var p=MSSlide.prototype;p.onSwipeStart=function(){this.link&&(this.linkdis=!0),this.video&&(this.videodis=!0)},p.onSwipeMove=function(e){var move=Math.max(Math.abs(e.data.distanceX),Math.abs(e.data.distanceY));this.swipeMoved=move>4},p.onSwipeCancel=function(){return this.swipeMoved?void(this.swipeMoved=!1):(this.link&&(this.linkdis=!1),void(this.video&&(this.videodis=!1)))},p.setupLayerController=function(){this.hasLayers=!0,this.layerController=new MSLayerController(this)},p.assetsLoaded=function(){this.ready=!0,this.slider.api._startTimer(),(this.selected||this.pselected&&this.slider.options.instantStartLayers)&&(this.hasLayers&&this.layerController.showLayers(),this.vinit&&(this.bgvideo.play(),this.autoPauseBgVid||(this.bgvideo.currentTime=0))),this.isSleeping||this.setupBG(),CTween.fadeOut(this.$loading,300,!0),(0===this.slider.options.preload||"all"===this.slider.options.preload)&&this.index").addClass("ms-slide-bgcont"),this.$element.append(this.$loading).append(this.$imgcont),this.$bg_img=$(img).css("visibility","hidden"),this.$imgcont.append(this.$bg_img),this.bgAligner=new MSAligner(that.fillMode,that.$imgcont,that.$bg_img),this.bgAligner.widthOnly=this.slider.options.autoHeight,that.slider.options.autoHeight&&(that.pselected||that.selected)&&that.slider.setHeight(that.slider.options.height),void 0!==this.$bg_img.data("src")?(this.bg_src=this.$bg_img.data("src"),this.$bg_img.removeAttr("data-src")):this.$bg_img.one("load",function(event){that._onBGLoad(event)}).each($.jqLoadFix)},p.setupBG=function(){!this.initBG&&this.bgLoaded&&(this.initBG=!0,this.$bg_img.css("visibility",""),this.bgWidth=this.bgNatrualWidth||this.$bg_img.width(),this.bgHeight=this.bgNatrualHeight||this.$bg_img.height(),CTween.fadeIn(this.$imgcont,300),this.slider.options.autoHeight&&this.$imgcont.height(this.bgHeight*this.ratio),this.bgAligner.init(this.bgWidth,this.bgHeight),this.setSize(this.__width,this.__height),this.slider.options.autoHeight&&(this.pselected||this.selected)&&this.slider.setHeight(this.getHeight()))},p.loadImages=function(){if(!this.ls){if(this.ls=!0,this.bgvideo&&this.bgvideo.load(),this.hasBG&&this.bg_src){var that=this;this.$bg_img.preloadImg(this.bg_src,function(event){that._onBGLoad(event)})}this.hasLayers&&this.layerController.loadLayers(this._onLayersLoad),this.hasBG||this.hasLayers||this.assetsLoaded()}},p._onLayersLoad=function(){this.layersLoaded=!0,(!this.hasBG||this.bgLoaded)&&this.assetsLoaded()},p._onBGLoad=function(event){this.bgNatrualWidth=event.width,this.bgNatrualHeight=event.height,this.bgLoaded=!0,$.browser.msie&&this.$bg_img.on("dragstart",function(event){event.preventDefault()}),(!this.hasLayers||this.layerController.ready)&&this.assetsLoaded()},p.setBGVideo=function($video){if($video[0].play){if(window._mobile&&!this.slider.options.mobileBGVideo)return void $video.remove();this.bgvideo=$video[0];var that=this;$video.addClass("ms-slide-bgvideo"),$video.data("loop")!==!1&&(this.bgvideo.loop=!0),$video.data("mute")!==!1&&(this.bgvideo.muted=!0),$video.data("autopause")===!0&&(this.autoPauseBgVid=!0),this.bgvideo.setAttribute("playsinline",""),this.bgvideo_fillmode=$video.data("fill-mode")||"fill","none"!==this.bgvideo_fillmode&&(this.bgVideoAligner=new MSAligner(this.bgvideo_fillmode,this.$element,$video),this.bgvideo.addEventListener("loadedmetadata",function(){that.vinit||(that.vinit=!0,that.video_aspect=that.bgVideoAligner.baseHeight/that.bgVideoAligner.baseWidth,that.bgVideoAligner.init(that.bgvideo.videoWidth,that.bgvideo.videoHeight),that._alignBGVideo(),CTween.fadeIn($(that.bgvideo),200),that.selected&&that.bgvideo.play())})),$video.css("opacity",0),this.$bgvideocont=$("
").addClass("ms-slide-bgvideocont").append($video),this.hasBG?this.$imgcont.before(this.$bgvideocont):this.$bgvideocont.appendTo(this.$element)}},p._alignBGVideo=function(){this.bgvideo_fillmode&&"none"!==this.bgvideo_fillmode&&this.bgVideoAligner.align()},p.setSize=function(width,height,hard){this.__width=width,this.slider.options.autoHeight&&(this.bgLoaded?(this.ratio=this.__width/this.bgWidth,height=Math.floor(this.ratio*this.bgHeight),this.$imgcont.height(height)):(this.ratio=width/this.slider.options.width,height=this.slider.options.height*this.ratio)),this.__height=height,this.$element.width(width).height(height),this.hasBG&&this.bgLoaded&&this.bgAligner.align(),this._alignBGVideo(),this.hasLayers&&this.layerController.setSize(width,height,hard)},p.getHeight=function(){return this.hasBG&&this.bgLoaded?this.bgHeight*this.ratio:Math.max(this.$element[0].clientHeight,this.slider.options.height*this.ratio)},p.__playVideo=function(){this.vplayed||this.videodis||(this.vplayed=!0,this.slider.api.paused||(this.slider.api.pause(),this.roc=!0),this.vcbtn.css("display",""),CTween.fadeOut(this.vpbtn,500,!1),CTween.fadeIn(this.vcbtn,500),CTween.fadeIn(this.vframe,500),this.vframe.css("display","block").attr("src",this.video+"&autoplay=1"),this.view.$element.addClass("ms-def-cursor"),this.moz&&this.view.$element.css("perspective","none"),this.view.swipeControl&&this.view.swipeControl.disable(),this.slider.slideController.dispatchEvent(new MSSliderEvent(MSSliderEvent.VIDEO_PLAY)))},p.__closeVideo=function(){if(this.vplayed){this.vplayed=!1,this.roc&&this.slider.api.resume();var that=this;CTween.fadeIn(this.vpbtn,500),CTween.animate(this.vcbtn,500,{opacity:0},{complete:function(){that.vcbtn.css("display","none")}}),CTween.animate(this.vframe,500,{opacity:0},{complete:function(){that.vframe.attr("src","about:blank").css("display","none")}}),this.moz&&this.view.$element.css("perspective",""),this.view.swipeControl&&this.view.swipeControl.enable(),this.view.$element.removeClass("ms-def-cursor"),this.slider.slideController.dispatchEvent(new MSSliderEvent(MSSliderEvent.VIDEO_CLOSE))}},p.create=function(){var that=this;this.hasLayers&&this.layerController.create(),this.link&&this.link.addClass("ms-slide-link").html("").click(function(e){that.linkdis&&e.preventDefault()}),this.video&&(-1===this.video.indexOf("?")&&(this.video+="?"),this.vframe=$("").addClass("ms-slide-video").css({width:"100%",height:"100%",display:"none"}).attr("src","about:blank").attr("allowfullscreen","true").appendTo(this.$element),this.vpbtn=$("
").addClass("ms-slide-vpbtn").click(function(){that.__playVideo()}).appendTo(this.$element),this.vcbtn=$("
").addClass("ms-slide-vcbtn").click(function(){that.__closeVideo()}).appendTo(this.$element).css("display","none"),window._touch&&this.vcbtn.removeClass("ms-slide-vcbtn").addClass("ms-slide-vcbtn-mobile").append('Close video
').appendTo(this.view.$element.parent())),!this.slider.options.autoHeight&&this.hasBG&&(this.$imgcont.css("height","100%"),("center"===this.fillMode||"stretch"===this.fillMode)&&(this.fillMode="fill")),this.slider.options.autoHeight&&this.$element.addClass("ms-slide-auto-height"),this.sleep(!0)},p.destroy=function(){this.hasLayers&&(this.layerController.destroy(),this.layerController=null),this.$element.remove(),this.$element=null},p.prepareToSelect=function(){this.pselected||this.selected||(this.pselected=!0,(this.link||this.video)&&(this.view.addEventListener(MSViewEvents.SWIPE_START,this.onSwipeStart,this),this.view.addEventListener(MSViewEvents.SWIPE_MOVE,this.onSwipeMove,this),this.view.addEventListener(MSViewEvents.SWIPE_CANCEL,this.onSwipeCancel,this),this.linkdis=!1,this.swipeMoved=!1),this.loadImages(),this.hasLayers&&this.layerController.prepareToShow(),this.ready&&(this.bgvideo&&this.bgvideo.play(),this.hasLayers&&this.slider.options.instantStartLayers&&this.layerController.showLayers()),this.moz&&this.$element.css("margin-top",""))},p.select=function(){this.selected||(this.selected=!0,this.pselected=!1,this.$element.addClass("ms-sl-selected"),this.hasLayers&&(this.slider.options.autoHeight&&this.layerController.updateHeight(),this.slider.options.instantStartLayers||this.layerController.showLayers()),this.ready&&this.bgvideo&&this.bgvideo.play(),this.videoAutoPlay&&(this.videodis=!1,this.vpbtn.trigger("click")))},p.unselect=function(){this.pselected=!1,this.moz&&this.$element.css("margin-top","0.1px"),(this.link||this.video)&&(this.view.removeEventListener(MSViewEvents.SWIPE_START,this.onSwipeStart,this),this.view.removeEventListener(MSViewEvents.SWIPE_MOVE,this.onSwipeMove,this),this.view.removeEventListener(MSViewEvents.SWIPE_CANCEL,this.onSwipeCancel,this)),this.bgvideo&&(this.bgvideo.pause(),!this.autoPauseBgVid&&this.vinit&&(this.bgvideo.currentTime=0)),this.hasLayers&&this.layerController.hideLayers(),this.selected&&(this.selected=!1,this.$element.removeClass("ms-sl-selected"),this.video&&this.vplayed&&(this.__closeVideo(),this.roc=!1))},p.sleep=function(force){(!this.isSleeping||force)&&(this.isSleeping=!0,this.autoAppend&&this.$element.detach(),this.hasLayers&&this.layerController.onSlideSleep())},p.wakeup=function(){this.isSleeping&&(this.isSleeping=!1,this.autoAppend&&this.view.$slideCont.append(this.$element),this.moz&&this.$element.css("margin-top","0.1px"),this.setupBG(),this.hasBG&&this.bgAligner.align(),this.hasLayers&&this.layerController.onSlideWakeup())}}(window,document,jQuery),function($){"use strict";var SliderViewList={};window.MSSlideController=function(slider){this._delayProgress=0,this._timer=new averta.Timer(100),this._timer.onTimer=this.onTimer,this._timer.refrence=this,this.currentSlide=null,this.slider=slider,this.so=slider.options,averta.EventDispatcher.call(this)},MSSlideController.registerView=function(name,_class){if(name in SliderViewList)throw new Error(name+", is already registered.");SliderViewList[name]=_class},MSSlideController.SliderControlList={},MSSlideController.registerControl=function(name,_class){if(name in MSSlideController.SliderControlList)throw new Error(name+", is already registered.");MSSlideController.SliderControlList[name]=_class};var p=MSSlideController.prototype;p.setupView=function(){var that=this;this.resize_listener=function(){that.__resize()};var viewOptions={spacing:this.so.space,mouseSwipe:this.so.mouse,loop:this.so.loop,autoHeight:this.so.autoHeight,swipe:this.so.swipe,speed:this.so.speed,dir:this.so.dir,viewNum:this.so.inView,critMargin:this.so.critMargin};this.so.viewOptions&&$.extend(viewOptions,this.so.viewOptions),this.so.autoHeight&&(this.so.heightLimit=!1);var viewClass=SliderViewList[this.slider.options.view]||MSBasicView;if(!viewClass._3dreq||window._css3d&&!$.browser.msie||(viewClass=viewClass._fallback||MSBasicView),this.view=new viewClass(viewOptions),this.so.overPause){var that=this;this.slider.$element.mouseenter(function(){that.is_over=!0,that._stopTimer()}).mouseleave(function(){that.is_over=!1,that._startTimer()})}},p.onChangeStart=function(){this.change_started=!0,this.currentSlide&&this.currentSlide.unselect(),this.currentSlide=this.view.currentSlide,this.currentSlide.prepareToSelect(),this.so.endPause&&this.currentSlide.index===this.slider.slides.length-1&&(this.pause(),this.skipTimer()),this.so.autoHeight&&this.slider.setHeight(this.currentSlide.getHeight()),this.so.deepLink&&this.__updateWindowHash(),this.dispatchEvent(new MSSliderEvent(MSSliderEvent.CHANGE_START))},p.onChangeEnd=function(){if(this.change_started=!1,this._startTimer(),this.currentSlide.select(),this.so.preload>1){var loc,i,slide,l=this.so.preload-1;for(i=1;l>=i;++i){if(loc=this.view.index+i,loc>=this.view.slideList.length){if(!this.so.loop){i=l;continue}loc-=this.view.slideList.length}slide=this.view.slideList[loc],slide&&slide.loadImages()}for(l>this.view.slideList.length/2&&(l=Math.floor(this.view.slideList.length/2)),i=1;l>=i;++i){if(loc=this.view.index-i,0>loc){if(!this.so.loop){i=l;continue}loc=this.view.slideList.length+loc}slide=this.view.slideList[loc],slide&&slide.loadImages()}}this.dispatchEvent(new MSSliderEvent(MSSliderEvent.CHANGE_END))},p.onSwipeStart=function(){this.skipTimer()},p.skipTimer=function(){this._timer.reset(),this._delayProgress=0,this.dispatchEvent(new MSSliderEvent(MSSliderEvent.WAITING))},p.onTimer=function(){if(this._timer.getTime()>=1e3*this.view.currentSlide.delay&&(this.skipTimer(),this.view.next(),this.hideCalled=!1),this._delayProgress=this._timer.getTime()/(10*this.view.currentSlide.delay),this.so.hideLayers&&!this.hideCalled&&1e3*this.view.currentSlide.delay-this._timer.getTime()<=300){var currentSlide=this.view.currentSlide;currentSlide.hasLayers&¤tSlide.layerController.animHideLayers(),this.hideCalled=!0}this.dispatchEvent(new MSSliderEvent(MSSliderEvent.WAITING))},p._stopTimer=function(){this._timer&&this._timer.stop()},p._startTimer=function(){this.paused||this.is_over||!this.currentSlide||!this.currentSlide.ready||this.change_started||this._timer.start()},p.__appendSlides=function(){var slide,loc,i=0,l=this.view.slideList.length-1;for(i;l>i;++i)slide=this.view.slideList[i],slide.detached||(slide.$element.detach(),slide.detached=!0);for(this.view.appendSlide(this.view.slideList[this.view.index]),l=3,i=1;l>=i;++i){if(loc=this.view.index+i,loc>=this.view.slideList.length){if(!this.so.loop){i=l;continue}loc-=this.view.slideList.length}slide=this.view.slideList[loc],slide.detached=!1,this.view.appendSlide(slide)}for(l>this.view.slideList.length/2&&(l=Math.floor(this.view.slideList.length/2)),i=1;l>=i;++i){if(loc=this.view.index-i,0>loc){if(!this.so.loop){i=l;continue}loc=this.view.slideList.length+loc}slide=this.view.slideList[loc],slide.detached=!1,this.view.appendSlide(slide)}},p.__resize=function(hard){this.created&&(this.width=this.slider.$element[0].clientWidth||this.so.width,this.so.fullwidth||(this.width=Math.min(this.width,this.so.width)),this.so.fullheight?(this.so.heightLimit=!1,this.so.autoHeight=!1,this.height=this.slider.$element[0].clientHeight):this.height=this.width/this.slider.aspect,this.so.autoHeight?(this.currentSlide.setSize(this.width,null,hard),this.view.setSize(this.width,this.currentSlide.getHeight(),hard)):this.view.setSize(this.width,Math.max(this.so.minHeight,this.so.heightLimit?Math.min(this.height,this.so.height):this.height),hard),this.slider.$controlsCont&&this.so.centerControls&&this.so.fullwidth&&this.view.$element.css("left",Math.min(0,-(this.slider.$element[0].clientWidth-this.so.width)/2)+"px"),this.dispatchEvent(new MSSliderEvent(MSSliderEvent.RESIZE)))},p.__dispatchInit=function(){this.dispatchEvent(new MSSliderEvent(MSSliderEvent.INIT))},p.__updateWindowHash=function(){var hash=window.location.hash,dl=this.so.deepLink,dlt=this.so.deepLinkType,eq="path"===dlt?"/":"=",sep="path"===dlt?"/":"&",sliderHash=dl+eq+(this.view.index+1),regTest=new RegExp(dl+eq+"[0-9]+","g");window.location.hash=""===hash?sep+sliderHash:regTest.test(hash)?hash.replace(regTest,sliderHash):hash+sep+sliderHash},p.__curentSlideInHash=function(){var hash=window.location.hash,dl=this.so.deepLink,dlt=this.so.deepLinkType,eq="path"===dlt?"/":"=",regTest=new RegExp(dl+eq+"[0-9]+","g");if(regTest.test(hash)){var index=Number(hash.match(regTest)[0].match(/[0-9]+/g).pop());if(!isNaN(index))return index-1}return-1},p.__onHashChanged=function(){var index=this.__curentSlideInHash();-1!==index&&this.gotoSlide(index)},p.__findLayerById=function(layerId){if(!this.currentSlide)return null;var layer;return this.currentSlide.layerController&&(layer=this.currentSlide.layerController.getLayerById(layerId)),!layer&&this.slider.overlayLayers?this.slider.overlayLayers.layerController.getLayerById(layerId):layer},p.setup=function(){this.created=!0,this.paused=!this.so.autoplay,this.view.addEventListener(MSViewEvents.CHANGE_START,this.onChangeStart,this),this.view.addEventListener(MSViewEvents.CHANGE_END,this.onChangeEnd,this),this.view.addEventListener(MSViewEvents.SWIPE_START,this.onSwipeStart,this),this.currentSlide=this.view.slideList[this.so.start-1],this.__resize();var slideInHash=this.__curentSlideInHash(),startSlide=-1!==slideInHash?slideInHash:this.so.start-1;if(this.view.create(startSlide),0===this.so.preload&&this.view.slideList[0].loadImages(),this.scroller=this.view.controller,this.so.wheel){var that=this,last_time=(new Date).getTime();this.wheellistener=function(event){var e=window.event||event.orginalEvent||event;e.preventDefault();var current_time=(new Date).getTime();if(!(400>current_time-last_time)){last_time=current_time;var delta=Math.abs(e.detail||e.wheelDelta);$.browser.mozilla&&(delta*=100);var scrollThreshold=15;return e.detail<0||e.wheelDelta>0?delta>=scrollThreshold&&that.previous(!0):delta>=scrollThreshold&&that.next(!0),!1
}},$.browser.mozilla?this.slider.$element[0].addEventListener("DOMMouseScroll",this.wheellistener):this.slider.$element.bind("mousewheel",this.wheellistener)}0===this.slider.$element[0].clientWidth&&(this.slider.init_safemode=!0),this.__resize();var that=this;this.so.deepLink&&$(window).on("hashchange",function(){that.__onHashChanged()})},p.index=function(){return this.view.index},p.count=function(){return this.view.slidesCount},p.next=function(checkLoop){this.skipTimer(),this.view.next(checkLoop)},p.previous=function(checkLoop){this.skipTimer(),this.view.previous(checkLoop)},p.gotoSlide=function(index){index=Math.min(index,this.count()-1),this.skipTimer(),this.view.gotoSlide(index)},p.destroy=function(reset){this.dispatchEvent(new MSSliderEvent(MSSliderEvent.DESTROY)),this.slider.destroy(reset)},p._destroy=function(){this._timer.reset(),this._timer=null,$(window).unbind("resize",this.resize_listener),this.view.destroy(),this.view=null,this.so.wheel&&($.browser.mozilla?this.slider.$element[0].removeEventListener("DOMMouseScroll",this.wheellistener):this.slider.$element.unbind("mousewheel",this.wheellistener),this.wheellistener=null),this.so=null},p.runAction=function(action){var actionParams=[];if(-1!==action.indexOf("(")){var temp=action.slice(0,action.indexOf("("));actionParams=action.slice(action.indexOf("(")+1,-1).replace(/\"|\'|\s/g,"").split(","),action=temp}action in this?this[action].apply(this,actionParams):console},p.update=function(hard){this.slider.init_safemode&&hard&&(this.slider.init_safemode=!1),this.__resize(hard),hard&&this.dispatchEvent(new MSSliderEvent(MSSliderEvent.HARD_UPDATE))},p.locate=function(){this.__resize()},p.resume=function(){this.paused&&(this.paused=!1,this._startTimer())},p.pause=function(){this.paused||(this.paused=!0,this._stopTimer())},p.currentTime=function(){return this._delayProgress},p.showLayer=function(layerId,delay){var layer=this.__findLayerById(layerId);layer&&(delay?(clearTimeout(layer.actionTimeout),layer.actionTimeout=setTimeout(this.showLayer,delay,layerId,0)):layer.start())},p.hideLayer=function(layerId,delay){var layer=this.__findLayerById(layerId);layer&&(delay?(clearTimeout(layer.actionTimeout),layer.actionTimeout=setTimeout(this.hideLayer,delay,layerId,0)):layer.hide())},p.toggleLayer=function(layerId,delay){var layer=this.__findLayerById(layerId);layer&&(delay?(clearTimeout(layer.actionTimeout),layer.actionTimeout=setTimeout(this.toggleLayer,delay,layerId,0)):layer.isShowing?layer.hide():layer.start())},p.showLayers=function(layerIds,delay){var self=this;$.each(layerIds.replace(/\s+/g,"").split("|"),function(index,layerId){self.showLayer(layerId,delay)})},p.hideLayers=function(layerIds,delay){var self=this;$.each(layerIds.replace(/\s+/g,"").split("|"),function(index,layerId){self.hideLayer(layerId,delay)})},p.toggleLayers=function(layerIds,delay){var self=this;$.each(layerIds.replace(/\s+/g,"").split("|"),function(index,layerId){self.toggleLayer(layerId,delay)})},averta.EventDispatcher.extend(p)}(jQuery),function($){"use strict";var LayerTypes={image:MSImageLayerElement,text:MSLayerElement,video:MSVideoLayerElement,hotspot:MSHotspotLayer,button:MSButtonLayer};window.MasterSlider=function(){this.options={forceInit:!0,autoplay:!1,loop:!1,mouse:!0,swipe:!0,grabCursor:!0,space:0,fillMode:"fill",start:1,view:"basic",width:300,height:150,inView:15,critMargin:1,mobileBGVideo:!1,heightLimit:!0,smoothHeight:!0,autoHeight:!1,minHeight:-1,fullwidth:!1,fullheight:!1,autofill:!1,layersMode:"center",hideLayers:!1,endPause:!1,centerControls:!0,overPause:!0,shuffle:!1,speed:17,dir:"h",preload:0,wheel:!1,layout:"boxed",autofillTarget:null,fullscreenMargin:0,instantStartLayers:!1,parallaxMode:"mouse",rtl:!1,deepLink:null,deepLinkType:"path",disablePlugins:[]},this.slides=[],this.activePlugins=[],this.$element=null,this.lastMargin=0,this.leftSpace=0,this.topSpace=0,this.rightSpace=0,this.bottomSpace=0,this._holdOn=0;var that=this;this.resize_listener=function(){that._resize()},$(window).bind("resize",this.resize_listener)},MasterSlider.author="Averta Ltd. (www.averta.net)",MasterSlider.version="2.61.2",MasterSlider.releaseDate="Jul 2018",MasterSlider._plugins=[];var MS=MasterSlider;MS.registerPlugin=function(plugin){-1===MS._plugins.indexOf(plugin)&&MS._plugins.push(plugin)};var p=MasterSlider.prototype;p.__setupSlides=function(){var new_slide,that=this,ind=0;this.$element.children(".ms-slide").each(function(){var $slide_ele=$(this);new_slide=new MSSlide,new_slide.$element=$slide_ele,new_slide.slider=that,new_slide.delay=void 0!==$slide_ele.data("delay")?$slide_ele.data("delay"):3,new_slide.fillMode=void 0!==$slide_ele.data("fill-mode")?$slide_ele.data("fill-mode"):that.options.fillMode,new_slide.index=ind++,new_slide.id=$slide_ele.data("id");var slide_img=$slide_ele.children("img:not(.ms-layer)");slide_img.length>0&&new_slide.setBG(slide_img[0]);var slide_video=$slide_ele.children("video");if(slide_video.length>0&&new_slide.setBGVideo(slide_video),that.controls)for(var i=0,l=that.controls.length;l>i;++i)that.controls[i].slideAction(new_slide);$slide_ele.children("a").each(function(){var $this=$(this);"video"===this.getAttribute("data-type")?(new_slide.video=this.getAttribute("href"),new_slide.videoAutoPlay=$this.data("autoplay"),$this.remove()):$this.hasClass("ms-layer")||(new_slide.link=$(this))});that.__createSlideLayers(new_slide,$slide_ele.find(".ms-layer")),that.slides.push(new_slide),that.slideController.view.addSlide(new_slide)})},p._setupOverlayLayers=function(){var self=this,$ollayers=this.$element.children(".ms-overlay-layers").eq(0);if($ollayers.length){var overlayLayers=new MSOverlayLayers(this);overlayLayers.$element=$ollayers,self.__createSlideLayers(overlayLayers,$ollayers.find(".ms-layer")),this.view.$element.prepend($ollayers),this.overlayLayers=overlayLayers,overlayLayers.create()}},p.__createSlideLayers=function(slide,layers){0!=layers.length&&(slide.setupLayerController(),layers.each(function(index,domEle){var $parent_ele,$layer_element=$(this);"A"===domEle.nodeName&&"image"===$layer_element.find(">img").data("type")&&($parent_ele=$(this),$layer_element=$parent_ele.find("img"));var layer=new(LayerTypes[$layer_element.data("type")||"text"]);layer.$element=$layer_element,layer.link=$parent_ele,layer.id=layer.$element.data("id"),layer.waitForAction=layer.$element.data("wait"),layer.masked=layer.$element.data("masked"),layer.maskWidth=layer.$element.data("mask-width"),layer.maskHeight=layer.$element.data("mask-height");var eff_parameters={},end_eff_parameters={};void 0!==$layer_element.data("effect")&&(eff_parameters.name=$layer_element.data("effect")),void 0!==$layer_element.data("ease")&&(eff_parameters.ease=$layer_element.data("ease")),void 0!==$layer_element.data("duration")&&(eff_parameters.duration=$layer_element.data("duration")),void 0!==$layer_element.data("delay")&&(eff_parameters.delay=$layer_element.data("delay")),$layer_element.data("hide-effect")&&(end_eff_parameters.name=$layer_element.data("hide-effect")),$layer_element.data("hide-ease")&&(end_eff_parameters.ease=$layer_element.data("hide-ease")),void 0!==$layer_element.data("hide-duration")&&(end_eff_parameters.duration=$layer_element.data("hide-duration")),void 0!==$layer_element.data("hide-time")&&(end_eff_parameters.time=$layer_element.data("hide-time")),layer.setStartAnim(eff_parameters),layer.setEndAnim(end_eff_parameters),slide.layerController.addLayer(layer)}))},p._removeLoading=function(){$(window).unbind("resize",this.resize_listener),this.$element.removeClass("before-init").css("visibility","visible").css("height","").css("opacity",0),CTween.fadeIn(this.$element),this.$loading.remove(),this.slideController&&this.slideController.__resize()},p._resize=function(){if(this.$loading){var h=this.$loading[0].clientWidth/this.aspect;h=this.options.heightLimit?Math.min(h,this.options.height):h,this.$loading.height(h),this.$element.height(h)}},p._shuffleSlides=function(){for(var r,slides=this.$element.children(".ms-slide"),i=0,l=slides.length;l>i;++i)r=Math.floor(Math.random()*(l-1)),i!=r&&(this.$element[0].insertBefore(slides[i],slides[r]),slides=this.$element.children(".ms-slide"))},p._setupSliderLayout=function(){this._updateSideMargins(),this.lastMargin=this.leftSpace;var lo=this.options.layout;"boxed"!==lo&&"partialview"!==lo&&(this.options.fullwidth=!0),("fullscreen"===lo||"autofill"===lo)&&(this.options.fullheight=!0,"autofill"===lo&&(this.$autofillTarget=$(this.options.autofillTarget),0===this.$autofillTarget.length&&(this.$autofillTarget=this.$element.parent()))),"partialview"===lo&&this.$element.addClass("ms-layout-partialview"),("fullscreen"===lo||"fullwidth"===lo||"autofill"===lo)&&($(window).bind("resize",{that:this},this._updateLayout),this._updateLayout()),$(window).bind("resize",this.slideController.resize_listener)},p._updateLayout=function(event){var that=event?event.data.that:this,lo=that.options.layout,$element=that.$element,$win=$(window);if("fullscreen"===lo)document.body.style.overflow="hidden",$element.height($win.height()-that.options.fullscreenMargin-that.topSpace-that.bottomSpace),document.body.style.overflow="";else if("autofill"===lo)return void $element.height(that.$autofillTarget.height()-that.options.fullscreenMargin-that.topSpace-that.bottomSpace).width(that.$autofillTarget.width()-that.leftSpace-that.rightSpace);$element.width($win.width()-that.leftSpace-that.rightSpace);var margin=-$element.offset().left+that.leftSpace+that.lastMargin;$element.css("margin-left",margin),that.lastMargin=margin},p._init=function(){if(!(this._holdOn>0)&&this._docReady){if(this.initialized=!0,"all"!==this.options.preload&&this._removeLoading(),this.options.shuffle&&this._shuffleSlides(),MSLayerEffects.setup(),this.slideController.setupView(),this.view=this.slideController.view,this.$controlsCont=$("
").addClass("ms-inner-controls-cont"),this.options.centerControls&&this.$controlsCont.css("max-width",this.options.width+"px"),this.$controlsCont.prepend(this.view.$element),this.$msContainer=$("
").addClass("ms-container").prependTo(this.$element).append(this.$controlsCont),this.controls)for(var i=0,l=this.controls.length;l>i;++i)this.controls[i].setup();if(this._setupSliderLayout(),this.__setupSlides(),this.slideController.setup(),this._setupOverlayLayers(),this.controls)for(i=0,l=this.controls.length;l>i;++i)this.controls[i].create();if(this.options.autoHeight&&this.slideController.view.$element.height(this.slideController.currentSlide.getHeight()),this.options.swipe&&!window._touch&&this.options.grabCursor&&this.options.mouse){var $view=this.view.$element;$view.mousedown(function(){$view.removeClass("ms-grab-cursor"),$view.addClass("ms-grabbing-cursor"),$.browser.msie&&window.ms_grabbing_curosr&&($view[0].style.cursor="url("+window.ms_grabbing_curosr+"), move")}).addClass("ms-grab-cursor"),$(document).mouseup(function(){$view.removeClass("ms-grabbing-cursor"),$view.addClass("ms-grab-cursor"),$.browser.msie&&window.ms_grab_curosr&&($view[0].style.cursor="url("+window.ms_grab_curosr+"), move")})}this.slideController.__dispatchInit()}},p.setHeight=function(value){this.options.smoothHeight?(this.htween&&(this.htween.reset?this.htween.reset():this.htween.stop(!0)),this.htween=CTween.animate(this.slideController.view.$element,500,{height:value},{ease:"easeOutQuart"})):this.slideController.view.$element.height(value)},p.reserveSpace=function(side,space){var sideSpace=side+"Space",pos=this[sideSpace];return this[sideSpace]+=space,this._updateSideMargins(),pos},p._updateSideMargins=function(){this.$element.css("margin",this.topSpace+"px "+this.rightSpace+"px "+this.bottomSpace+"px "+this.leftSpace+"px")},p._realignControls=function(){this.rightSpace=this.leftSpace=this.topSpace=this.bottomSpace=0,this._updateSideMargins(),this.api.dispatchEvent(new MSSliderEvent(MSSliderEvent.RESERVED_SPACE_CHANGE))},p.control=function(control,options){if(control in MSSlideController.SliderControlList){this.controls||(this.controls=[]);var ins=new MSSlideController.SliderControlList[control](options);return ins.slider=this,this.controls.push(ins),this}},p.holdOn=function(){this._holdOn++},p.release=function(){this._holdOn--,this._init()},p.setup=function(target,options){if(this.$element="string"==typeof target?$("#"+target):target.eq(0),this.setupMarkup=this.$element.html(),0!==this.$element.length){this.$element.addClass("master-slider").addClass("before-init"),$.browser.msie?this.$element.addClass("ms-ie").addClass("ms-ie"+$.browser.version.slice(0,$.browser.version.indexOf("."))):$.browser.webkit?this.$element.addClass("ms-wk"):$.browser.mozilla&&this.$element.addClass("ms-moz");var ua=navigator.userAgent.toLowerCase(),isAndroid=ua.indexOf("android")>-1;isAndroid&&this.$element.addClass("ms-android");var that=this;$.extend(this.options,options),this.aspect=this.options.width/this.options.height,this.$loading=$("
").addClass("ms-loading-container").insertBefore(this.$element).append($("
").addClass("ms-loading")),this.$loading.parent().css("position","relative"),this.options.autofill&&(this.options.fullwidth=!0,this.options.fullheight=!0),this.options.fullheight&&this.$element.addClass("ms-fullheight"),this._resize(),this.slideController=new MSSlideController(this),this.api=this.slideController;for(var i=0,l=MS._plugins.length;i!==l;i++){var plugin=MS._plugins[i];-1===this.options.disablePlugins.indexOf(plugin.name)&&this.activePlugins.push(new plugin(this))}return this.options.forceInit&&MasterSlider.addJQReadyErrorCheck(this),$(document).ready(function(){that.initialized||(that._docReady=!0,that._init())}),this}},p.destroy=function(insertMarkup){for(var i=0,l=this.activePlugins.length;i!==l;i++)this.activePlugins[i].destroy();if(this.controls)for(i=0,l=this.controls.length;i!==l;i++)this.controls[i].destroy();this.slideController&&this.slideController._destroy(),this.$loading&&this.$loading.remove(),insertMarkup?this.$element.html(this.setupMarkup).css("visibility","hidden"):this.$element.remove();var lo=this.options.layout;("fullscreen"===lo||"fullwidth"===lo)&&$(window).unbind("resize",this._updateLayout),this.view=null,this.slides=null,this.options=null,this.slideController=null,this.api=null,this.resize_listener=null,this.activePlugins=null}}(jQuery),function($,window,document,undefined){function MasterSliderPlugin(element,options){this.element=element,this.$element=$(element),this.settings=$.extend({},defaults,options),this._defaults=defaults,this._name=pluginName,this.init()}var pluginName="masterslider",defaults={controls:{}};$.extend(MasterSliderPlugin.prototype,{init:function(){var self=this;this._slider=new MasterSlider;for(var control in this.settings.controls)this._slider.control(control,this.settings.controls[control]);this._slider.setup(this.$element,this.settings);var _superDispatch=this._slider.api.dispatchEvent;this._slider.api.dispatchEvent=function(event){self.$element.trigger(event.type),_superDispatch.call(this,event)}},api:function(){return this._slider.api},slider:function(){return this._slider}}),$.fn[pluginName]=function(options){var args=arguments,plugin="plugin_"+pluginName;if(options===undefined||"object"==typeof options)return this.each(function(){$.data(this,plugin)||$.data(this,plugin,new MasterSliderPlugin(this,options))});if("string"==typeof options&&"_"!==options[0]&&"init"!==options){var returns;return this.each(function(){var instance=$.data(this,plugin);instance instanceof MasterSliderPlugin&&"function"==typeof instance[options]&&(returns=instance[options].apply(instance,Array.prototype.slice.call(args,1))),instance instanceof MasterSliderPlugin&&"function"==typeof instance._slider.api[options]&&(returns=instance._slider.api[options].apply(instance._slider.api,Array.prototype.slice.call(args,1))),"destroy"===options&&$.data(this,plugin,null)}),returns!==undefined?returns:this}}}(jQuery,window,document),function($,window){"use strict";var sliderInstances=[];MasterSlider.addJQReadyErrorCheck=function(slider){sliderInstances.push(slider)};var _ready=$.fn.ready,_onerror=window.onerror;$.fn.ready=function(){return window.onerror=function(){if(0!==sliderInstances.length)for(var i=0,l=sliderInstances.length;i!==l;i++){var slider=sliderInstances[i];slider.initialized||(slider._docReady=!0,slider._init())}return _onerror?_onerror.apply(this,arguments):!1},_ready.apply(this,arguments)}}(jQuery,window,document),window.MSViewEvents=function(type,data){this.type=type,this.data=data},MSViewEvents.SWIPE_START="swipeStart",MSViewEvents.SWIPE_END="swipeEnd",MSViewEvents.SWIPE_MOVE="swipeMove",MSViewEvents.SWIPE_CANCEL="swipeCancel",MSViewEvents.SCROLL="scroll",MSViewEvents.CHANGE_START="slideChangeStart",MSViewEvents.CHANGE_END="slideChangeEnd",function($){"use strict";window.MSBasicView=function(options){this.options={loop:!1,dir:"h",autoHeight:!1,spacing:5,mouseSwipe:!0,swipe:!0,speed:17,minSlideSpeed:2,viewNum:20,critMargin:1},$.extend(this.options,options),this.dir=this.options.dir,this.loop=this.options.loop,this.spacing=this.options.spacing,this.__width=0,this.__height=0,this.__cssProb="h"===this.dir?"left":"top",this.__offset="h"===this.dir?"offsetLeft":"offsetTop",this.__dimension="h"===this.dir?"__width":"__height",this.__translate_end=window._css3d?" translateZ(0px)":"",this.$slideCont=$("
").addClass("ms-slide-container"),this.$element=$("
").addClass("ms-view").addClass("ms-basic-view").append(this.$slideCont),this.currentSlide=null,this.index=-1,this.slidesCount=0,this.slides=[],this.slideList=[],this.viewSlidesList=[],this.css3=window._cssanim,this.start_buffer=0,this.firstslide_snap=0,this.slideChanged=!1,this.controller=new Controller(0,0,{snapping:!0,snapsize:100,paging:!0,snappingMinSpeed:this.options.minSlideSpeed,friction:(100-.5*this.options.speed)/100,endless:this.loop}),this.controller.renderCallback("h"===this.dir?this._horizUpdate:this._vertiUpdate,this),this.controller.snappingCallback(this.__snapUpdate,this),this.controller.snapCompleteCallback(this.__snapCompelet,this),averta.EventDispatcher.call(this)};var p=MSBasicView.prototype;p.__snapCompelet=function(){this.slideChanged&&(this.slideChanged=!1,this.__locateSlides(),this.start_buffer=0,this.dispatchEvent(new MSViewEvents(MSViewEvents.CHANGE_END)))},p.__snapUpdate=function(controller,snap,change){if(this.loop){var target_index=this.index+change;this.updateLoop(target_index),target_index>=this.slidesCount&&(target_index-=this.slidesCount),0>target_index&&(target_index=this.slidesCount+target_index),this.index=target_index}else{if(0>snap||snap>=this.slidesCount)return;this.index=snap}this._checkCritMargins(),$.browser.mozilla&&(this.slideList[this.index].$element[0].style.marginTop="0.1px",this.currentSlide&&(this.currentSlide.$element[0].style.marginTop=""));var new_slide=this.slideList[this.index];new_slide!==this.currentSlide&&(this.currentSlide=new_slide,this.autoUpdateZIndex&&this.__updateSlidesZindex(),this.slideChanged=!0,this.dispatchEvent(new MSViewEvents(MSViewEvents.CHANGE_START)))},p._checkCritMargins=function(){if(!this.normalMode){var hlf=Math.floor(this.options.viewNum/2),inView=this.viewSlidesList.indexOf(this.slideList[this.index]),size=this[this.__dimension]+this.spacing,cm=this.options.critMargin;return this.loop?void((cm>=inView||inView>=this.viewSlidesList.length-cm)&&(size*=inView-hlf,this.__locateSlides(!1,size+this.start_buffer),this.start_buffer+=size)):void((cm>inView&&this.index>=cm||inView>=this.viewSlidesList.length-cm&&this.index=i;++i)return_arr.unshift(this.slideList[this.index-i<0?this.slidesCount-i+this.index:this.index-i]);for(return_arr.push(this.slideList[this.index]),i=1;after_count>=i;++i)return_arr.push(this.slideList[this.index+i>=this.slidesCount?this.index+i-this.slidesCount:this.index+i]);return return_arr},p.__getSteps=function(index,target){var right=index>target?this.slidesCount-index+target:target-index,left=Math.abs(this.slidesCount-right);return left>right?right:-left},p.__pushEnd=function(){var first_slide=this.slides.shift(),last_slide=this.slides[this.slidesCount-2];if(this.slides.push(first_slide),this.normalMode){var pos=last_slide.$element[0][this.__offset]+this.spacing+this[this.__dimension];first_slide.$element[0].style[this.__cssProb]=pos+"px",first_slide.position=pos}},p.__pushStart=function(){var last_slide=this.slides.pop(),first_slide=this.slides[0];if(this.slides.unshift(last_slide),this.normalMode){var pos=first_slide.$element[0][this.__offset]-this.spacing-this[this.__dimension];last_slide.$element[0].style[this.__cssProb]=pos+"px",last_slide.position=pos}},p.__updateSlidesZindex=function(){{var slide,l=this.viewSlidesList.length;Math.floor(l/2)}if(this.loop)for(var loc=this.viewSlidesList.indexOf(this.currentSlide),i=0;i!==l;i++)slide=this.viewSlidesList[i],this.viewSlidesList[i].$element.css("z-index",loc>=i?i+1:l-i);else{for(var beforeNum=this.currentSlide.index-this.viewSlidesList[0].index,i=0;i!==l;i++)this.viewSlidesList[i].$element.css("z-index",beforeNum>=i?i+1:l-i);this.currentSlide.$element.css("z-index",l)}},p.addSlide=function(slide){slide.view=this,this.slides.push(slide),this.slideList.push(slide),this.slidesCount++},p.appendSlide=function(slide){this.$slideCont.append(slide.$element)},p.updateLoop=function(index){if(this.loop)for(var steps=this.__getSteps(this.index,index),i=0,l=Math.abs(steps);l>i;++i)0>steps?this.__pushStart():this.__pushEnd()},p.gotoSlide=function(index,fast){this.updateLoop(index),this.index=index;var target_slide=this.slideList[index];this._checkCritMargins(),this.controller.changeTo(target_slide.position,!fast,null,null,!1),target_slide!==this.currentSlide&&(this.slideChanged=!0,this.currentSlide=target_slide,this.autoUpdateZIndex&&this.__updateSlidesZindex(),this.dispatchEvent(new MSViewEvents(MSViewEvents.CHANGE_START)),fast&&this.dispatchEvent(new MSViewEvents(MSViewEvents.CHANGE_END)))},p.next=function(checkLoop){return checkLoop&&!this.loop&&this.index+1>=this.slidesCount?void this.controller.bounce(10):void this.gotoSlide(this.index+1>=this.slidesCount?0:this.index+1)},p.previous=function(checkLoop){return checkLoop&&!this.loop&&this.index-1<0?void this.controller.bounce(-10):void this.gotoSlide(this.index-1<0?this.slidesCount-1:this.index-1)},p.setupSwipe=function(){this.swipeControl=new averta.TouchSwipe(this.$element),this.swipeControl.swipeType="h"===this.dir?"horizontal":"vertical";var that=this;this.swipeControl.onSwipe="h"===this.dir?function(status){that.horizSwipeMove(status)}:function(status){that.vertSwipeMove(status)}},p.vertSwipeMove=function(status){var phase=status.phase;if("start"===phase)this.controller.stop(),this.dispatchEvent(new MSViewEvents(MSViewEvents.SWIPE_START,status));else if("move"===phase&&(!this.loop||Math.abs(this.currentSlide.position-this.controller.value+status.moveY).1&&Math.abs(speed)>=speedh?(this.controller.push(-speed),speed>this.controller.options.snappingMinSpeed&&this.dispatchEvent(new MSViewEvents(MSViewEvents.SWIPE_END,status))):(this.controller.cancel(),this.dispatchEvent(new MSViewEvents(MSViewEvents.SWIPE_CANCEL,status)))}},p.horizSwipeMove=function(status){var phase=status.phase;if("start"===phase)this.controller.stop(),this.dispatchEvent(new MSViewEvents(MSViewEvents.SWIPE_START,status));else if("move"===phase&&(!this.loop||Math.abs(this.currentSlide.position-this.controller.value+status.moveX).1&&Math.abs(speed)>=speedv?(this.controller.push(-speed),speed>this.controller.options.snappingMinSpeed&&this.dispatchEvent(new MSViewEvents(MSViewEvents.SWIPE_END,status))):(this.controller.cancel(),this.dispatchEvent(new MSViewEvents(MSViewEvents.SWIPE_CANCEL,status)))}},p.setSize=function(width,height,hard){if(this.lastWidth!==width||height!==this.lastHeight||hard){this.$element.width(width).height(height);for(var i=0;idistance?-1:1),zvalue=1.2*value;slide.$element[0].style[window._jcsspfx+"Transform"]="translateZ("+5*-zvalue+"px) rotateY("+rvalue+"deg) "},p.__updateSlidesVertic=function(slide,distance){var value=Math.abs(100*distance/this.__width),rvalue=Math.min(.3*value,30)*(0>distance?-1:1),zvalue=1.2*value;slide.$element[0].style[window._jcsspfx+"Transform"]="translateZ("+5*-zvalue+"px) rotateX("+-rvalue+"deg) "},MSSlideController.registerView("flow",MSFlowView)}(jQuery),function(){window.MSFadeFlowView=function(options){MSWaveView.call(this,options),this.$element.removeClass("ms-wave-view").addClass("ms-fade-flow-view")},MSFadeFlowView.extend(MSWaveView),MSFadeFlowView._3dreq=!0;{var p=MSFadeFlowView.prototype;MSWaveView.prototype}p.__calculate=function(distance){var value=Math.min(Math.abs(100*distance/this.__width),100),rvalue=Math.min(.5*value,50)*(0>distance?-1:1);return{value:value,rvalue:rvalue}},p.__updateSlidesHoriz=function(slide,distance){var clc=this.__calculate(distance);slide.$element.css("opacity",1-clc.value/300),slide.$element[0].style[window._jcsspfx+"Transform"]="translateZ("+-clc.value+"px) rotateY("+clc.rvalue+"deg) "},p.__updateSlidesVertic=function(slide,distance){var clc=this.__calculate(distance);
slide.$element.css("opacity",1-clc.value/300),slide.$element[0].style[window._jcsspfx+"Transform"]="translateZ("+-clc.value+"px) rotateX("+-clc.rvalue+"deg) "},MSSlideController.registerView("fadeFlow",MSFadeFlowView)}(),function($){"use strict";window.MSMaskView=function(options){MSBasicView.call(this,options),this.$element.removeClass("ms-basic-view").addClass("ms-mask-view")},MSMaskView.extend(MSBasicView);var p=MSMaskView.prototype,_super=MSBasicView.prototype;p.addSlide=function(slide){slide.view=this,slide.$frame=$("
").addClass("ms-mask-frame").append(slide.$element),slide.$element[0].style.position="relative",slide.autoAppend=!1,this.slides.push(slide),this.slideList.push(slide),this.slidesCount++},p.setSize=function(width,height){for(var slider=this.slides[0].slider,i=0;i=1-value?slide.$element.fadeTo(0,0).css("visibility","hidden"):slide.$element.fadeTo(0,1-value).css("visibility","")},p.__locateSlides=function(move,start){this.__updateViewList(),start=this.loop?start||0:this.slides.indexOf(this.viewSlidesList[0])*(this[this.__dimension]+this.spacing);for(var slide,l=this.viewSlidesList.length,i=0;i!==l;i++){var pos=start+i*this[this.__dimension];slide=this.viewSlidesList[i],slide.wakeup(),slide.position=pos}move!==!1&&this.controller.changeTo(this.slideList[this.index].position,!1,null,null,!1)},p.__pushEnd=function(){var first_slide=this.slides.shift(),last_slide=this.slides[this.slidesCount-2];this.slides.push(first_slide),first_slide.position=last_slide.position+this[this.__dimension]},p.__pushStart=function(){var last_slide=this.slides.pop(),first_slide=this.slides[0];this.slides.unshift(last_slide),last_slide.position=first_slide.position-this[this.__dimension]},p.create=function(index){_super.create.call(this,index),this.spacing=0,this.controller.options.minValidDist=10},MSSlideController.registerView("fade",MSFadeView)}(jQuery),function(){"use strict";window.MSScaleView=function(options){MSBasicView.call(this,options),this.$element.removeClass("ms-basic-view").addClass("ms-scale-view"),this.controller.renderCallback(this.__update,this)},MSScaleView.extend(MSFadeView);var p=MSScaleView.prototype,_super=MSFadeView.prototype;p.__updateSlides=function(slide,distance){var value=Math.abs(distance/this[this.__dimension]),element=slide.$element[0];0>=1-value?(element.style.opacity=0,element.style.visibility="hidden",element.style[window._jcsspfx+"Transform"]=""):(element.style.opacity=1-value,element.style.visibility="",element.style[window._jcsspfx+"Transform"]="perspective(2000px) translateZ("+value*(0>distance?-.5:.5)*300+"px)")},p.create=function(index){_super.create.call(this,index),this.controller.options.minValidDist=.03},MSSlideController.registerView("scale",MSScaleView)}(jQuery),function(){"use strict";window.MSStackView=function(options){MSBasicView.call(this,options),this.$element.removeClass("ms-basic-view").addClass("ms-stack-view"),this.controller.renderCallback(this.__update,this),this.autoUpdateZIndex=!0},MSStackView.extend(MSFadeView),MSStackView._3dreq=!0,MSStackView._fallback=MSFadeView;var p=MSStackView.prototype,_super=MSFadeView.prototype;p.__updateSlidesZindex=function(){for(var slide,l=this.viewSlidesList.length,i=0;i!==l;i++)slide=this.viewSlidesList[i],this.viewSlidesList[i].$element.css("z-index",l-i)},p.__updateSlides=function(slide,distance){var value=Math.abs(distance/this[this.__dimension]),element=slide.$element[0];0>=1-value?(element.style.opacity=1,element.style.visibility="hidden",element.style[window._jcsspfx+"Transform"]=""):(element.style.visibility="",element.style[window._jcsspfx+"Transform"]=0>distance?"perspective(2000px) translateZ("+-300*value+"px)":this.__translate+"("+-value*this[this.__dimension]+"px)")},p.create=function(index){_super.create.call(this,index),this.controller.options.minValidDist=.03,this.__translate="h"===this.dir?"translateX":"translateY"},MSSlideController.registerView("stack",MSStackView)}(jQuery),function(){"use strict";var perspective=2e3;window.MSFocusView=function(options){MSWaveView.call(this,options),this.$element.removeClass("ms-wave-view").addClass("ms-focus-view"),this.options.centerSpace=this.options.centerSpace||1},MSFocusView.extend(MSWaveView),MSFocusView._3dreq=!0,MSFocusView._fallback=MSFadeBasicView;{var p=MSFocusView.prototype;MSWaveView.prototype}p.__calcview=function(z,w){var a=w/2*z/(z+perspective);return a*(z+perspective)/perspective},p.__updateSlidesHoriz=function(slide,distance){var value=Math.abs(100*distance/this.__width);value=15*-Math.min(value,100),slide.$element.css(window._csspfx+"transform","translateZ("+(value+1)+"px) rotateY(0.01deg) translateX("+(0>distance?1:-1)*-this.__calcview(value,this.__width)*this.options.centerSpace+"px)")},p.__updateSlidesVertic=function(slide,distance){var value=Math.abs(100*distance/this.__width);value=15*-Math.min(value,100),slide.$element.css(window._csspfx+"transform","translateZ("+(value+1)+"px) rotateY(0.01deg) translateY("+(0>distance?1:-1)*-this.__calcview(value,this.__width)*this.options.centerSpace+"px)")},MSSlideController.registerView("focus",MSFocusView)}(),function(){window.MSPartialWaveView=function(options){MSWaveView.call(this,options),this.$element.removeClass("ms-wave-view").addClass("ms-partial-wave-view")},MSPartialWaveView.extend(MSWaveView),MSPartialWaveView._3dreq=!0,MSPartialWaveView._fallback=MSFadeBasicView;{var p=MSPartialWaveView.prototype;MSWaveView.prototype}p.__updateSlidesHoriz=function(slide,distance){var value=Math.abs(100*distance/this.__width);slide.hasBG&&slide.$bg_img.css("opacity",(100-Math.abs(120*distance/this.__width/3))/100),slide.$element.css(window._csspfx+"transform","translateZ("+3*-value+"px) rotateY(0.01deg) translateX("+.75*distance+"px)")},p.__updateSlidesVertic=function(slide,distance){var value=Math.abs(100*distance/this.__width);slide.hasBG&&slide.$bg_img.css("opacity",(100-Math.abs(120*distance/this.__width/3))/100),slide.$element.css(window._csspfx+"transform","translateZ("+3*-value+"px) rotateY(0.01deg) translateY("+.75*distance+"px)")},MSSlideController.registerView("partialWave",MSPartialWaveView)}(),function(){"use strict";window.MSBoxView=function(options){MSBasicView.call(this,options),this.$element.removeClass("ms-basic-view").addClass("ms-box-view"),this.controller.renderCallback(this.__update,this)},MSBoxView.extend(MSFadeView),MSBoxView._3dreq=!0;var p=MSBoxView.prototype,_super=MSFadeView.prototype;p.__updateSlides=function(slide,distance){var value=Math.abs(distance/this[this.__dimension]),element=slide.$element[0];0>=1-value?(element.style.visibility="hidden",element.style[window._jcsspfx+"Transform"]=""):(element.style.visibility="",element.style[window._jcsspfx+"Transform"]="rotate"+this._rotateDir+"("+value*(0>distance?1:-1)*90*this._calcFactor+"deg)",element.style[window._jcsspfx+"TransformOrigin"]="50% 50% -"+slide[this.__dimension]/2+"px",element.style.zIndex=Math.ceil(2*(1-value)))},p.create=function(index){_super.create.call(this,index),this.controller.options.minValidDist=.03,this._rotateDir="h"===this.options.dir?"Y":"X",this._calcFactor="h"===this.options.dir?1:-1},MSSlideController.registerView("box",MSBoxView)}(jQuery),function($){"use strict";var BaseControl=function(){this.options={prefix:"ms-",autohide:!0,overVideo:!0,customClass:null}},p=BaseControl.prototype;p.slideAction=function(){},p.setup=function(){this.cont=this.options.insertTo?$(this.options.insertTo):this.slider.$controlsCont,this.options.overVideo||this._hideOnvideoStarts()},p.checkHideUnder=function(){this.options.hideUnder&&(this.needsRealign=!this.options.insetTo&&("left"===this.options.align||"right"===this.options.align)&&this.options.inset===!1,$(window).bind("resize",{that:this},this.onResize),this.onResize())},p.onResize=function(event){var that=event&&event.data.that||this,w=window.innerWidth;w<=that.options.hideUnder&&!that.detached?(that.hide(!0),that.detached=!0,that.onDetach()):w>=that.options.hideUnder&&that.detached&&(that.detached=!1,that.visible(),that.onAppend())},p.create=function(){this.options.autohide&&(this.hide(!0),this.slider.$controlsCont.mouseenter($.proxy(this._onMouseEnter,this)).mouseleave($.proxy(this._onMouseLeave,this)).mousedown($.proxy(this._onMouseDown,this)),this.$element&&this.$element.mouseenter($.proxy(this._onMouseEnter,this)).mouseleave($.proxy(this._onMouseLeave,this)).mousedown($.proxy(this._onMouseDown,this)),$(document).mouseup($.proxy(this._onMouseUp,this))),this.options.align&&this.$element.addClass("ms-align-"+this.options.align),this.options.customClass&&this.$element&&this.$element.addClass(this.options.customClass)},p._onMouseEnter=function(){this._disableAH||this.mdown||this.visible(),this.mleave=!1},p._onMouseLeave=function(){this.mdown||this.hide(),this.mleave=!0},p._onMouseDown=function(){this.mdown=!0},p._onMouseUp=function(){this.mdown&&this.mleave&&this.hide(),this.mdown=!1},p.onAppend=function(){this.needsRealign&&this.slider._realignControls()},p.onDetach=function(){this.needsRealign&&this.slider._realignControls()},p._hideOnvideoStarts=function(){var that=this;this.slider.api.addEventListener(MSSliderEvent.VIDEO_PLAY,function(){that._disableAH=!0,that.hide()}),this.slider.api.addEventListener(MSSliderEvent.VIDEO_CLOSE,function(){that._disableAH=!1,that.visible()})},p.hide=function(fast){if(fast)this.$element.css("opacity",0),this.$element.css("display","none");else{clearTimeout(this.hideTo);var $element=this.$element;this.hideTo=setTimeout(function(){CTween.fadeOut($element,400,!1)},20)}this.$element.addClass("ms-ctrl-hide")},p.visible=function(){this.detached||(clearTimeout(this.hideTo),this.$element.css("display",""),CTween.fadeIn(this.$element,400,!1),this.$element.removeClass("ms-ctrl-hide"))},p.destroy=function(){this.options&&this.options.hideUnder&&$(window).unbind("resize",this.onResize)},window.BaseControl=BaseControl}(jQuery),function($){"use strict";var MSArrows=function(options){BaseControl.call(this),$.extend(this.options,options)};MSArrows.extend(BaseControl);var p=MSArrows.prototype,_super=BaseControl.prototype;p.setup=function(){var that=this;this.$next=$("
").addClass(this.options.prefix+"nav-next").bind("click",function(){that.slider.api.next(!0)}),this.$prev=$("
").addClass(this.options.prefix+"nav-prev").bind("click",function(){that.slider.api.previous(!0)}),_super.setup.call(this),this.cont.append(this.$next),this.cont.append(this.$prev),this.checkHideUnder()},p.hide=function(fast){return fast?(this.$prev.css("opacity",0).css("display","none"),void this.$next.css("opacity",0).css("display","none")):(CTween.fadeOut(this.$prev,400,!1),CTween.fadeOut(this.$next,400,!1),this.$prev.addClass("ms-ctrl-hide"),void this.$next.addClass("ms-ctrl-hide"))},p.visible=function(){this.detached||(CTween.fadeIn(this.$prev,400),CTween.fadeIn(this.$next,400),this.$prev.removeClass("ms-ctrl-hide").css("display",""),this.$next.removeClass("ms-ctrl-hide").css("display",""))},p.destroy=function(){_super.destroy(),this.$next.remove(),this.$prev.remove()},window.MSArrows=MSArrows,MSSlideController.registerControl("arrows",MSArrows)}(jQuery),function($){"use strict";var MSThumblist=function(options){BaseControl.call(this),this.options.dir="h",this.options.wheel="v"===options.dir,this.options.arrows=!1,this.options.speed=17,this.options.align=null,this.options.inset=!1,this.options.margin=10,this.options.space=10,this.options.width=100,this.options.height=100,this.options.type="thumbs",this.options.hover=!1,$.extend(this.options,options),this.thumbs=[],this.index_count=0,this.__dimen="h"===this.options.dir?"width":"height",this.__alignsize="h"===this.options.dir?"height":"width",this.__jdimen="h"===this.options.dir?"outerWidth":"outerHeight",this.__pos="h"===this.options.dir?"left":"top",this.click_enable=!0};MSThumblist.extend(BaseControl);var p=MSThumblist.prototype,_super=BaseControl.prototype;p.setup=function(){if(this.$element=$("
").addClass(this.options.prefix+"thumb-list"),"tabs"===this.options.type&&this.$element.addClass(this.options.prefix+"tabs"),this.$element.addClass("ms-dir-"+this.options.dir),_super.setup.call(this),this.$element.appendTo(this.slider.$controlsCont===this.cont?this.slider.$element:this.cont),this.$thumbscont=$("
").addClass("ms-thumbs-cont").appendTo(this.$element),this.options.arrows){var that=this;this.$fwd=$("
").addClass("ms-thumblist-fwd").appendTo(this.$element).click(function(){that.controller.push(-15)}),this.$bwd=$("
").addClass("ms-thumblist-bwd").appendTo(this.$element).click(function(){that.controller.push(15)})}if(!this.options.insetTo&&this.options.align){var align=this.options.align;this.options.inset?this.$element.css(align,this.options.margin):"top"===align?this.$element.detach().prependTo(this.slider.$element).css({"margin-bottom":this.options.margin,position:"relative"}):"bottom"===align?this.$element.css({"margin-top":this.options.margin,position:"relative"}):(this.slider.api.addEventListener(MSSliderEvent.RESERVED_SPACE_CHANGE,this.align,this),this.align()),"v"===this.options.dir?this.$element.width(this.options.width):this.$element.height(this.options.height)}this.checkHideUnder()},p.align=function(){if(!this.detached){var align=this.options.align,pos=this.slider.reserveSpace(align,this.options[this.__alignsize]+2*this.options.margin);this.$element.css(align,-pos-this.options[this.__alignsize]-this.options.margin)}},p.slideAction=function(slide){var thumb_ele=slide.$element.find(".ms-thumb"),that=this,thumb_frame=$("
").addClass("ms-thumb-frame").append(thumb_ele).append($('
')).bind(this.options.hover?"hover":"click",function(){that.changeSlide(thumb_frame)});if(this.options.align&&thumb_frame.width(this.options.width-("v"===this.options.dir&&"tabs"===this.options.type?12:0)).height(this.options.height).css("margin-"+("v"===this.options.dir?"bottom":"right"),this.options.space),thumb_frame[0].index=this.index_count++,this.$thumbscont.append(thumb_frame),this.options.fillMode&&thumb_ele.is("img")){var aligner=new window.MSAligner(this.options.fillMode,thumb_frame,thumb_ele);thumb_ele[0].aligner=aligner,thumb_ele.one("load",function(){var $this=$(this);$this[0].aligner.init($this.width(),$this.height()),$this[0].aligner.align()}).each($.jqLoadFix)}$.browser.msie&&thumb_ele.on("dragstart",function(event){event.preventDefault()}),this.thumbs.push(thumb_frame)},p.create=function(){_super.create.call(this),this.__translate_end=window._css3d?" translateZ(0px)":"",this.controller=new Controller(0,0,{snappingMinSpeed:2,friction:(100-.5*this.options.speed)/100}),this.controller.renderCallback("h"===this.options.dir?this._hMove:this._vMove,this);var that=this;this.resize_listener=function(){that.__resize()},$(window).bind("resize",this.resize_listener),this.thumbSize=this.thumbs[0][this.__jdimen](!0),this.setupSwipe(),this.__resize();var that=this;this.options.wheel&&(this.wheellistener=function(event){var e=window.event||event.orginalEvent||event,delta=Math.max(-1,Math.min(1,e.wheelDelta||-e.detail));return that.controller.push(10*-delta),!1},$.browser.mozilla?this.$element[0].addEventListener("DOMMouseScroll",this.wheellistener):this.$element.bind("mousewheel",this.wheellistener)),this.slider.api.addEventListener(MSSliderEvent.CHANGE_START,this.update,this),this.slider.api.addEventListener(MSSliderEvent.HARD_UPDATE,this.realignThumbs,this),this.cindex=this.slider.api.index(),this.select(this.thumbs[this.cindex])},p._hMove=function(controller,value){return this.__contPos=value,window._cssanim?void(this.$thumbscont[0].style[window._jcsspfx+"Transform"]="translateX("+-value+"px)"+this.__translate_end):void(this.$thumbscont[0].style.left=-value+"px")},p._vMove=function(controller,value){return this.__contPos=value,window._cssanim?void(this.$thumbscont[0].style[window._jcsspfx+"Transform"]="translateY("+-value+"px)"+this.__translate_end):void(this.$thumbscont[0].style.top=-value+"px")},p.setupSwipe=function(){this.swipeControl=new averta.TouchSwipe(this.$element),this.swipeControl.swipeType="h"===this.options.dir?"horizontal":"vertical";var that=this;this.swipeControl.onSwipe="h"===this.options.dir?function(status){that.horizSwipeMove(status)}:function(status){that.vertSwipeMove(status)}},p.vertSwipeMove=function(status){if(!this.dTouch){var phase=status.phase;if("start"===phase)this.controller.stop();else if("move"===phase)this.controller.drag(status.moveY);else if("end"===phase||"cancel"===phase){var speed=Math.abs(status.distanceY/status.duration*50/3);speed>.1?this.controller.push(-status.distanceY/status.duration*50/3):(this.click_enable=!0,this.controller.cancel())}}},p.horizSwipeMove=function(status){if(!this.dTouch){var phase=status.phase;if("start"===phase)this.controller.stop(),this.click_enable=!1;else if("move"===phase)this.controller.drag(status.moveX);else if("end"===phase||"cancel"===phase){var speed=Math.abs(status.distanceX/status.duration*50/3);speed>.1?this.controller.push(-status.distanceX/status.duration*50/3):(this.click_enable=!0,this.controller.cancel())}}},p.update=function(){var nindex=this.slider.api.index();this.cindex!==nindex&&(null!=this.cindex&&this.unselect(this.thumbs[this.cindex]),this.cindex=nindex,this.select(this.thumbs[this.cindex]),this.dTouch||this.updateThumbscroll())},p.realignThumbs=function(){this.$element.find(".ms-thumb").each(function(index,thumb){thumb.aligner&&thumb.aligner.align()})},p.updateThumbscroll=function(){var pos=this.thumbSize*this.cindex;if(0/0==this.controller.value&&(this.controller.value=0),pos-this.controller.value<0)return void this.controller.gotoSnap(this.cindex,!0);if(pos+this.thumbSize-this.controller.value>this.$element[this.__dimen]()){var first_snap=this.cindex-Math.floor(this.$element[this.__dimen]()/this.thumbSize)+1;return void this.controller.gotoSnap(first_snap,!0)}},p.changeSlide=function(thumb){this.click_enable&&this.cindex!==thumb[0].index&&this.slider.api.gotoSlide(thumb[0].index)},p.unselect=function(ele){ele.removeClass("ms-thumb-frame-selected")},p.select=function(ele){ele.addClass("ms-thumb-frame-selected")},p.__resize=function(){var size=this.$element[this.__dimen]();if(this.ls!==size){this.ls=size,this.thumbSize=this.thumbs[0][this.__jdimen](!0);var len=this.slider.api.count()*this.thumbSize;this.$thumbscont[0].style[this.__dimen]=len+"px",size>=len?(this.dTouch=!0,this.controller.stop(),this.$thumbscont[0].style[this.__pos]=.5*(size-len)+"px",this.$thumbscont[0].style[window._jcsspfx+"Transform"]=""):(this.dTouch=!1,this.click_enable=!0,this.$thumbscont[0].style[this.__pos]="",this.controller._max_value=len-size,this.controller.options.snapsize=this.thumbSize,this.updateThumbscroll())}},p.destroy=function(){_super.destroy(),this.options.wheel&&($.browser.mozilla?this.$element[0].removeEventListener("DOMMouseScroll",this.wheellistener):this.$element.unbind("mousewheel",this.wheellistener),this.wheellistener=null),$(window).unbind("resize",this.resize_listener),this.$element.remove(),this.slider.api.removeEventListener(MSSliderEvent.RESERVED_SPACE_CHANGE,this.align,this),this.slider.api.removeEventListener(MSSliderEvent.CHANGE_START,this.update,this)},window.MSThumblist=MSThumblist,MSSlideController.registerControl("thumblist",MSThumblist)}(jQuery),function($){"use strict";var MSBulltes=function(options){BaseControl.call(this),this.options.dir="h",this.options.inset=!0,this.options.margin=10,this.options.space=10,$.extend(this.options,options),this.bullets=[]};MSBulltes.extend(BaseControl);var p=MSBulltes.prototype,_super=BaseControl.prototype;p.setup=function(){if(_super.setup.call(this),this.$element=$("
").addClass(this.options.prefix+"bullets").addClass("ms-dir-"+this.options.dir).appendTo(this.cont),this.$bullet_cont=$("
").addClass("ms-bullets-count").appendTo(this.$element),!this.options.insetTo&&this.options.align){var align=this.options.align;this.options.inset&&this.$element.css(align,this.options.margin)}this.checkHideUnder()},p.create=function(){_super.create.call(this);var that=this;this.slider.api.addEventListener(MSSliderEvent.CHANGE_START,this.update,this),this.cindex=this.slider.api.index();for(var i=0;i").addClass("ms-bullet");bullet[0].index=i,bullet.on("click",function(){that.changeSlide(this.index)}),this.$bullet_cont.append(bullet),this.bullets.push(bullet),"h"===this.options.dir?bullet.css("margin",this.options.space/2):bullet.css("margin",this.options.space)}"h"===this.options.dir?this.$element.width(bullet.outerWidth(!0)*this.slider.api.count()):this.$element.css("margin-top",-this.$element.outerHeight(!0)/2),this.select(this.bullets[this.cindex])},p.update=function(){var nindex=this.slider.api.index();this.cindex!==nindex&&(null!=this.cindex&&this.unselect(this.bullets[this.cindex]),this.cindex=nindex,this.select(this.bullets[this.cindex]))},p.changeSlide=function(index){this.cindex!==index&&this.slider.api.gotoSlide(index)},p.unselect=function(ele){ele.removeClass("ms-bullet-selected")},p.select=function(ele){ele.addClass("ms-bullet-selected")},p.destroy=function(){_super.destroy(),this.slider.api.removeEventListener(MSSliderEvent.CHANGE_START,this.update,this),this.$element.remove()},window.MSBulltes=MSBulltes,MSSlideController.registerControl("bullets",MSBulltes)}(jQuery),function($){"use strict";var MSScrollbar=function(options){BaseControl.call(this),this.options.dir="h",this.options.autohide=!0,this.options.width=4,this.options.color="#3D3D3D",this.options.margin=10,$.extend(this.options,options),this.__dimen="h"===this.options.dir?"width":"height",this.__jdimen="h"===this.options.dir?"outerWidth":"outerHeight",this.__pos="h"===this.options.dir?"left":"top",this.__translate_end=window._css3d?" translateZ(0px)":"",this.__translate_start="h"===this.options.dir?" translateX(":"translateY("};MSScrollbar.extend(BaseControl);var p=MSScrollbar.prototype,_super=BaseControl.prototype;p.setup=function(){if(this.$element=$("
").addClass(this.options.prefix+"sbar").addClass("ms-dir-"+this.options.dir),_super.setup.call(this),this.$element.appendTo(this.slider.$controlsCont===this.cont?this.slider.$element:this.cont),this.$bar=$("
").addClass(this.options.prefix+"bar").appendTo(this.$element),this.slider.options.loop&&(this.disable=!0,this.$element.remove()),"v"===this.options.dir?this.$bar.width(this.options.width):this.$bar.height(this.options.width),this.$bar.css("background-color",this.options.color),!this.options.insetTo&&this.options.align){this.$element.css("v"===this.options.dir?{right:"auto",left:"auto"}:{top:"auto",bottom:"auto"});var align=this.options.align;this.options.inset?this.$element.css(align,this.options.margin):"top"===align?this.$element.prependTo(this.slider.$element).css({"margin-bottom":this.options.margin,position:"relative"}):"bottom"===align?this.$element.css({"margin-top":this.options.margin,position:"relative"}):(this.slider.api.addEventListener(MSSliderEvent.RESERVED_SPACE_CHANGE,this.align,this),this.align())}this.checkHideUnder()},p.align=function(){if(!this.detached){var align=this.options.align,pos=this.slider.reserveSpace(align,2*this.options.margin+this.options.width);this.$element.css(align,-pos-this.options.margin-this.options.width)}},p.create=function(){if(!this.disable){this.scroller=this.slider.api.scroller,this.slider.api.view.addEventListener(MSViewEvents.SCROLL,this._update,this),this.slider.api.addEventListener(MSSliderEvent.RESIZE,this._resize,this),this._resize(),this.options.autohide&&this.$bar.css("opacity","0")}},p._resize=function(){this.vdimen=this.$element[this.__dimen](),this.bar_dimen=this.slider.api.view["__"+this.__dimen]*this.vdimen/this.scroller._max_value,this.$bar[this.__dimen](this.bar_dimen)},p._update=function(){var value=this.scroller.value*(this.vdimen-this.bar_dimen)/this.scroller._max_value;if(this.lvalue!==value){if(this.lvalue=value,this.options.autohide){clearTimeout(this.hto),this.$bar.css("opacity","1");var that=this;this.hto=setTimeout(function(){that.$bar.css("opacity","0")},150)}return 0>value?void(this.$bar[0].style[this.__dimen]=this.bar_dimen+value+"px"):(value>this.vdimen-this.bar_dimen&&(this.$bar[0].style[this.__dimen]=this.vdimen-value+"px"),window._cssanim?void(this.$bar[0].style[window._jcsspfx+"Transform"]=this.__translate_start+value+"px)"+this.__translate_end):void(this.$bar[0].style[this.__pos]=value+"px"))}},p.destroy=function(){_super.destroy(),this.slider.api.view.removeEventListener(MSViewEvents.SCROLL,this._update,this),this.slider.api.removeEventListener(MSSliderEvent.RESIZE,this._resize,this),this.slider.api.removeEventListener(MSSliderEvent.RESERVED_SPACE_CHANGE,this.align,this),this.$element.remove()},window.MSScrollbar=MSScrollbar,MSSlideController.registerControl("scrollbar",MSScrollbar)}(jQuery),function($){"use strict";var MSTimerbar=function(options){BaseControl.call(this),this.options.autohide=!1,this.options.width=4,this.options.color="#FFFFFF",this.options.inset=!0,this.options.margin=0,$.extend(this.options,options)};MSTimerbar.extend(BaseControl);var p=MSTimerbar.prototype,_super=BaseControl.prototype;p.setup=function(){if(_super.setup.call(this),this.$element=$("
").addClass(this.options.prefix+"timerbar"),_super.setup.call(this),this.$element.appendTo(this.slider.$controlsCont===this.cont?this.slider.$element:this.cont),this.$bar=$("
").addClass("ms-time-bar").appendTo(this.$element),"v"===this.options.dir?(this.$bar.width(this.options.width),this.$element.width(this.options.width)):(this.$bar.height(this.options.width),this.$element.height(this.options.width)),this.$bar.css("background-color",this.options.color),!this.options.insetTo&&this.options.align){this.$element.css({top:"auto",bottom:"auto"});var align=this.options.align;this.options.inset?this.$element.css(align,this.options.margin):"top"===align?this.$element.prependTo(this.slider.$element).css({"margin-bottom":this.options.margin,position:"relative"}):"bottom"===align?this.$element.css({"margin-top":this.options.margin,position:"relative"}):(this.slider.api.addEventListener(MSSliderEvent.RESERVED_SPACE_CHANGE,this.align,this),this.align())}this.checkHideUnder()},p.align=function(){if(!this.detached){var align=this.options.align,pos=this.slider.reserveSpace(align,2*this.options.margin+this.options.width);this.$element.css(align,-pos-this.options.margin-this.options.width)}},p.create=function(){_super.create.call(this),this.slider.api.addEventListener(MSSliderEvent.WAITING,this._update,this),this._update()},p._update=function(){this.$bar[0].style.width=this.slider.api._delayProgress+"%"},p.destroy=function(){_super.destroy(),this.slider.api.removeEventListener(MSSliderEvent.RESERVED_SPACE_CHANGE,this.align,this),this.slider.api.removeEventListener(MSSliderEvent.WAITING,this._update,this),this.$element.remove()},window.MSTimerbar=MSTimerbar,MSSlideController.registerControl("timebar",MSTimerbar)}(jQuery),function($){"use strict";var MSCircleTimer=function(options){BaseControl.call(this),this.options.color="#A2A2A2",this.options.stroke=10,this.options.radius=4,this.options.autohide=!1,$.extend(this.options,options)
};MSCircleTimer.extend(BaseControl);var p=MSCircleTimer.prototype,_super=BaseControl.prototype;p.setup=function(){return _super.setup.call(this),this.$element=$("
").addClass(this.options.prefix+"ctimer").appendTo(this.cont),this.$canvas=$(" ").addClass("ms-ctimer-canvas").appendTo(this.$element),this.$bar=$("
").addClass("ms-ctimer-bullet").appendTo(this.$element),this.$canvas[0].getContext?(this.ctx=this.$canvas[0].getContext("2d"),this.prog=0,this.__w=2*(this.options.radius+this.options.stroke/2),this.$canvas[0].width=this.__w,this.$canvas[0].height=this.__w,void this.checkHideUnder()):(this.destroy(),void(this.disable=!0))},p.create=function(){if(!this.disable){_super.create.call(this),this.slider.api.addEventListener(MSSliderEvent.WAITING,this._update,this);var that=this;this.$element.click(function(){that.slider.api.paused?that.slider.api.resume():that.slider.api.pause()}),this._update()}},p._update=function(){var that=this;$(this).stop(!0).animate({prog:.01*this.slider.api._delayProgress},{duration:200,step:function(){that._draw()}})},p._draw=function(){this.ctx.clearRect(0,0,this.__w,this.__w),this.ctx.beginPath(),this.ctx.arc(.5*this.__w,.5*this.__w,this.options.radius,1.5*Math.PI,1.5*Math.PI+2*Math.PI*this.prog,!1),this.ctx.strokeStyle=this.options.color,this.ctx.lineWidth=this.options.stroke,this.ctx.stroke()},p.destroy=function(){_super.destroy(),this.disable||($(this).stop(!0),this.slider.api.removeEventListener(MSSliderEvent.WAITING,this._update,this),this.$element.remove())},window.MSCircleTimer=MSCircleTimer,MSSlideController.registerControl("circletimer",MSCircleTimer)}(jQuery),function($){"use strict";window.MSLightbox=function(options){BaseControl.call(this,options),this.options.autohide=!1,$.extend(this.options,options),this.data_list=[]},MSLightbox.fadeDuratation=400,MSLightbox.extend(BaseControl);var p=MSLightbox.prototype,_super=BaseControl.prototype;p.setup=function(){_super.setup.call(this),this.$element=$("
").addClass(this.options.prefix+"lightbox-btn").appendTo(this.cont),this.checkHideUnder()},p.slideAction=function(slide){$("
").addClass(this.options.prefix+"lightbox-btn").appendTo(slide.$element).append($(slide.$element.find(".ms-lightbox")))},p.create=function(){_super.create.call(this)},MSSlideController.registerControl("lightbox",MSLightbox)}(jQuery),function($){"use strict";window.MSSlideInfo=function(options){BaseControl.call(this,options),this.options.autohide=!1,this.options.align=null,this.options.inset=!1,this.options.margin=10,this.options.size=100,this.options.dir="h",$.extend(this.options,options),this.data_list=[]},MSSlideInfo.fadeDuratation=400,MSSlideInfo.extend(BaseControl);var p=MSSlideInfo.prototype,_super=BaseControl.prototype;p.setup=function(){if(this.$element=$("
").addClass(this.options.prefix+"slide-info").addClass("ms-dir-"+this.options.dir),_super.setup.call(this),this.$element.appendTo(this.slider.$controlsCont===this.cont?this.slider.$element:this.cont),!this.options.insetTo&&this.options.align){var align=this.options.align;this.options.inset?this.$element.css(align,this.options.margin):"top"===align?this.$element.prependTo(this.slider.$element).css({"margin-bottom":this.options.margin,position:"relative"}):"bottom"===align?this.$element.css({"margin-top":this.options.margin,position:"relative"}):(this.slider.api.addEventListener(MSSliderEvent.RESERVED_SPACE_CHANGE,this.align,this),this.align()),"v"===this.options.dir?this.$element.width(this.options.size):this.$element.css("min-height",this.options.size)}this.checkHideUnder()},p.align=function(){if(!this.detached){var align=this.options.align,pos=this.slider.reserveSpace(align,this.options.size+2*this.options.margin);this.$element.css(align,-pos-this.options.size-this.options.margin)}},p.slideAction=function(slide){var info_ele=$(slide.$element.find(".ms-info"));info_ele.detach(),this.data_list[slide.index]=info_ele},p.create=function(){_super.create.call(this),this.slider.api.addEventListener(MSSliderEvent.CHANGE_START,this.update,this),this.cindex=this.slider.api.index(),this.switchEle(this.data_list[this.cindex])},p.update=function(){var nindex=this.slider.api.index();this.switchEle(this.data_list[nindex]),this.cindex=nindex},p.switchEle=function(ele){if(this.current_ele){this.current_ele[0].tween&&this.current_ele[0].tween.stop(!0),this.current_ele[0].tween=CTween.animate(this.current_ele,MSSlideInfo.fadeDuratation,{opacity:0},{complete:function(){this.detach(),this[0].tween=null,ele.css("position","relative")},target:this.current_ele}),ele.css("position","absolute")}this.__show(ele)},p.__show=function(ele){ele.appendTo(this.$element).css("opacity","0"),this.current_ele&&ele.height(Math.max(ele.height(),this.current_ele.height())),clearTimeout(this.tou),this.tou=setTimeout(function(){CTween.fadeIn(ele,MSSlideInfo.fadeDuratation),ele.css("height","")},MSSlideInfo.fadeDuratation),ele[0].tween&&ele[0].tween.stop(!0),this.current_ele=ele},p.destroy=function(){_super.destroy(),clearTimeout(this.tou),this.current_ele&&this.current_ele[0].tween&&this.current_ele[0].tween.stop("true"),this.$element.remove(),this.slider.api.removeEventListener(MSSliderEvent.RESERVED_SPACE_CHANGE,this.align,this),this.slider.api.removeEventListener(MSSliderEvent.CHANGE_START,this.update,this)},MSSlideController.registerControl("slideinfo",MSSlideInfo)}(jQuery),function($){window.MSGallery=function(id,slider){this.id=id,this.slider=slider,this.telement=$("#"+id),this.botcont=$("
").addClass("ms-gallery-botcont").appendTo(this.telement),this.thumbcont=$("
").addClass("ms-gal-thumbcont hide-thumbs").appendTo(this.botcont),this.playbtn=$("
").addClass("ms-gal-playbtn").appendTo(this.botcont),this.thumbtoggle=$("
").addClass("ms-gal-thumbtoggle").appendTo(this.botcont),slider.control("thumblist",{insertTo:this.thumbcont,autohide:!1,dir:"h"}),slider.control("slidenum",{insertTo:this.botcont,autohide:!1}),slider.control("slideinfo",{insertTo:this.botcont,autohide:!1}),slider.control("timebar",{insertTo:this.botcont,autohide:!1}),slider.control("bullets",{insertTo:this.botcont,autohide:!1})};var p=MSGallery.prototype;p._init=function(){var that=this;this.slider.api.paused||this.playbtn.addClass("btn-pause"),this.playbtn.click(function(){that.slider.api.paused?(that.slider.api.resume(),that.playbtn.addClass("btn-pause")):(that.slider.api.pause(),that.playbtn.removeClass("btn-pause"))}),this.thumbtoggle.click(function(){that.vthumbs?(that.thumbtoggle.removeClass("btn-hide"),that.vthumbs=!1,that.thumbcont.addClass("hide-thumbs")):(that.thumbtoggle.addClass("btn-hide"),that.thumbcont.removeClass("hide-thumbs"),that.vthumbs=!0)})},p.setup=function(){var that=this;$(document).ready(function(){that._init()})}}(jQuery),function($){var getPhotosetURL=function(key,id,count){return"https://api.flickr.com/services/rest/?method=flickr.photosets.getPhotos&api_key="+key+"&photoset_id="+id+"&per_page="+count+"&extras=url_o,description,date_taken,owner_name,views&format=json&jsoncallback=?"},getUserPublicURL=function(key,id,count){return"https://api.flickr.com/services/rest/?&method=flickr.people.getPublicPhotos&api_key="+key+"&user_id="+id+"&per_page="+count+"&extras=url_o,description,date_taken,owner_name,views&format=json&jsoncallback=?"},getImageSource=function(fid,server,id,secret,size,data){return"_o"===size&&data?data.url_o:"https://farm"+fid+".staticflickr.com/"+server+"/"+id+"_"+secret+size+".jpg"};window.MSFlickrV2=function(slider,options){var _options={count:10,type:"photoset",thumbSize:"q",imgSize:"c"};if(this.slider=slider,this.slider.holdOn(),!options.key)return void this.errMsg("Flickr API Key required. Please add it in settings.");$.extend(_options,options),this.options=_options;var that=this;"photoset"===this.options.type?$.getJSON(getPhotosetURL(this.options.key,this.options.id,this.options.count),function(data){that._photosData(data)}):$.getJSON(getUserPublicURL(this.options.key,this.options.id,this.options.count),function(data){that.options.type="photos",that._photosData(data)}),""!==this.options.imgSize&&"-"!==this.options.imgSize&&(this.options.imgSize="_"+this.options.imgSize),this.options.thumbSize="_"+this.options.thumbSize,this.slideTemplate=this.slider.$element.find(".ms-slide")[0].outerHTML,this.slider.$element.find(".ms-slide").remove()};var p=MSFlickrV2.prototype;p._photosData=function(data){if("fail"===data.stat)return void this.errMsg("Flickr API ERROR#"+data.code+": "+data.message);{var that=this;this.options.author||this.options.desc}$.each(data[this.options.type].photo,function(i,item){var slide_cont=that.slideTemplate.replace(/{{[\w-]+}}/g,function(match){return match=match.replace(/{{|}}/g,""),shortCodes[match]?shortCodes[match](item,that):"{{"+match+"}}"});$(slide_cont).appendTo(that.slider.$element)}),that._initSlider()},p.errMsg=function(msg){this.slider.$element.css("display","block"),this.errEle||(this.errEle=$('
').appendTo(this.slider.$loading)),this.errEle.html(msg)},p._initSlider=function(){this.slider.release()};var shortCodes={image:function(data,that){return getImageSource(data.farm,data.server,data.id,data.secret,that.options.imgSize,data)},thumb:function(data,that){return getImageSource(data.farm,data.server,data.id,data.secret,that.options.thumbSize)},title:function(data){return data.title},"owner-name":function(data){return data.ownername},"date-taken":function(data){return data.datetaken},views:function(data){return data.views},description:function(data){return data.description._content}}}(jQuery),function($){window.MSFacebookGallery=function(slider,options){var _options={count:10,type:"photostream",thumbSize:"320",imgSize:"orginal",https:!1,token:""};this.slider=slider,this.slider.holdOn(),$.extend(_options,options),this.options=_options,this.graph="https://graph.facebook.com";var that=this;"photostream"===this.options.type?$.getJSON(this.graph+"/"+this.options.username+"/photos/uploaded/?fields=source,name,link,images,from&limit="+this.options.count+"&access_token="+this.options.token,function(data){that._photosData(data)}):$.getJSON(this.graph+"/"+this.options.albumId+"/photos?fields=source,name,link,images,from&limit="+this.options.count+"&access_token="+this.options.token,function(data){that._photosData(data)}),this.slideTemplate=this.slider.$element.find(".ms-slide")[0].outerHTML,this.slider.$element.find(".ms-slide").remove()};var p=MSFacebookGallery.prototype;p._photosData=function(content){if(content.error)return void this.errMsg("Facebook API ERROR#"+content.error.code+"("+content.error.type+"): "+content.error.message);for(var that=this,i=(this.options.author||this.options.desc,0),l=content.data.length;i!==l;i++){var slide_cont=that.slideTemplate.replace(/{{[\w-]+}}/g,function(match){return match=match.replace(/{{|}}/g,""),shortCodes[match]?shortCodes[match](content.data[i],that):"{{"+match+"}}"});$(slide_cont).appendTo(that.slider.$element)}that._initSlider()},p.errMsg=function(msg){this.slider.$element.css("display","block"),this.errEle||(this.errEle=$('
').appendTo(this.slider.$loading)),this.errEle.html(msg)},p._initSlider=function(){this.slider.release()};var getImageSource=function(images,size){if("orginal"===size)return images[0].source;for(var i=0,l=images.length;i!==l;i++)if(-1!==images[i].source.indexOf(size+"x"+size))return images[i].source;return images[0].source},shortCodes={image:function(data,that){return getImageSource(data.images,that.options.imgSize)},thumb:function(data,that){return getImageSource(data.images,that.options.thumbSize)},name:function(data){return data.name},"owner-name":function(data){return data.from.name},link:function(data){return data.link}}}(jQuery),function($){"use strict";window.MSScrollParallax=function(slider,parallax,bgparallax,fade){this.fade=fade,this.slider=slider,this.parallax=parallax/100,this.bgparallax=bgparallax/100,slider.api.addEventListener(MSSliderEvent.INIT,this.init,this),slider.api.addEventListener(MSSliderEvent.DESTROY,this.destory,this),slider.api.addEventListener(MSSliderEvent.CHANGE_END,this.resetLayers,this),slider.api.addEventListener(MSSliderEvent.CHANGE_START,this.updateCurrentSlide,this)},window.MSScrollParallax.setup=function(slider,parallax,bgparallax,fade){return window._mobile?void 0:(null==parallax&&(parallax=50),null==bgparallax&&(bgparallax=40),new MSScrollParallax(slider,parallax,bgparallax,fade))};var p=window.MSScrollParallax.prototype;p.init=function(){this.slider.$element.addClass("ms-scroll-parallax"),this.sliderOffset=this.slider.$element.offset().top,this.updateCurrentSlide();for(var slide,slides=this.slider.api.view.slideList,i=0,l=slides.length;i!==l;i++)slide=slides[i],slide.hasLayers&&(slide.layerController.$layers.wrap('
'),slide.$scrollParallaxCont=slide.layerController.$layers.parent());$(window).on("scroll",{that:this},this.moveParallax).trigger("scroll")},p.resetLayers=function(){if(this.lastSlide){var layers=this.lastSlide.$scrollParallaxCont;window._css2d?(layers&&(layers[0].style[window._jcsspfx+"Transform"]=""),this.lastSlide.hasBG&&(this.lastSlide.$imgcont[0].style[window._jcsspfx+"Transform"]="")):(layers&&(layers[0].style.top=""),this.lastSlide.hasBG&&(this.lastSlide.$imgcont[0].style.top="0px"))}},p.updateCurrentSlide=function(){this.lastSlide=this.currentSlide,this.currentSlide=this.slider.api.currentSlide,this.moveParallax({data:{that:this}})},p.moveParallax=function(e){var that=e.data.that,slider=that.slider,offset=that.sliderOffset,scrollTop=$(window).scrollTop(),layers=that.currentSlide.$scrollParallaxCont,out=offset-scrollTop;0>=out?(layers&&(window._css3d?layers[0].style[window._jcsspfx+"Transform"]="translateY("+-out*that.parallax+"px) translateZ(0.4px)":window._css2d?layers[0].style[window._jcsspfx+"Transform"]="translateY("+-out*that.parallax+"px)":layers[0].style.top=-out*that.parallax+"px"),that.updateSlidesBG(-out*that.bgparallax+"px",!0),layers&&that.fade&&layers.css("opacity",1-Math.min(1,-out/slider.api.height))):(layers&&(window._css2d?layers[0].style[window._jcsspfx+"Transform"]="":layers[0].style.top=""),that.updateSlidesBG("0px",!1),layers&&that.fade&&layers.css("opacity",1))},p.updateSlidesBG=function(pos,fixed){for(var slides=this.slider.api.view.slideList,position=!fixed||$.browser.msie||$.browser.opera?"":"fixed",i=0,l=slides.length;i!==l;i++)slides[i].hasBG&&(slides[i].$imgcont[0].style.position=position,slides[i].$imgcont[0].style.top=pos),slides[i].$bgvideocont&&(slides[i].$bgvideocont[0].style.position=position,slides[i].$bgvideocont[0].style.top=pos)},p.destory=function(){slider.api.removeEventListener(MSSliderEvent.INIT,this.init,this),slider.api.removeEventListener(MSSliderEvent.DESTROY,this.destory,this),slider.api.removeEventListener(MSSliderEvent.CHANGE_END,this.resetLayers,this),slider.api.removeEventListener(MSSliderEvent.CHANGE_START,this.updateCurrentSlide,this),$(window).off("scroll",this.moveParallax)}}(jQuery),function($,document,window){var PId=0;if(window.MasterSlider){var KeyboardNav=function(slider){this.slider=slider,this.PId=PId++,this.slider.options.keyboard&&slider.api.addEventListener(MSSliderEvent.INIT,this.init,this)};KeyboardNav.name="MSKeyboardNav";var p=KeyboardNav.prototype;p.init=function(){var api=this.slider.api;$(document).on("keydown.kbnav"+this.PId,function(event){var which=event.which;37===which||40===which?api.previous(!0):(38===which||39===which)&&api.next(!0)})},p.destroy=function(){$(document).off("keydown.kbnav"+this.PId),this.slider.api.removeEventListener(MSSliderEvent.INIT,this.init,this)},MasterSlider.registerPlugin(KeyboardNav)}}(jQuery,document,window),function($,document,window){var PId=0,$window=$(window),$doc=$(document);if(window.MasterSlider){var StartOnAppear=function(slider){this.PId=PId++,this.slider=slider,this.$slider=slider.$element,this.slider.options.startOnAppear&&(slider.holdOn(),$doc.ready($.proxy(this.init,this)))};StartOnAppear.name="MSStartOnAppear";var p=StartOnAppear.prototype;p.init=function(){this.slider.api;$window.on("scroll.soa"+this.PId,$.proxy(this._onScroll,this)).trigger("scroll")},p._onScroll=function(){var vpBottom=$window.scrollTop()+$window.height(),top=this.$slider.offset().top;vpBottom>top&&($window.off("scroll.soa"+this.PId),this.slider.release())},p.destroy=function(){},MasterSlider.registerPlugin(StartOnAppear)}}(jQuery,document,window),function(document,window){var filterUnits={"hue-rotate":"deg",blur:"px"},initialValues={opacity:1,contrast:1,brightness:1,saturate:1,"hue-rotate":0,invert:0,sepia:0,blur:0,grayscale:0};if(window.MasterSlider){var Filters=function(slider){this.slider=slider,this.slider.options.filters&&slider.api.addEventListener(MSSliderEvent.INIT,this.init,this)};Filters.name="MSFilters";var p=Filters.prototype;p.init=function(){var api=this.slider.api,view=api.view;this.filters=this.slider.options.filters,this.slideList=view.slideList,this.slidesCount=view.slidesCount,this.dimension=view[view.__dimension],this.target="slide"===this.slider.options.filterTarget?"$element":"$bg_img",this.filterName=$.browser.webkit?"WebkitFilter":"filter";var superFun=view.controller.__renderHook.fun,superRef=view.controller.__renderHook.ref;view.controller.renderCallback(function(controller,value){superFun.call(superRef,controller,value),this.applyEffect(value)},this),this.applyEffect(view.controller.value)},p.applyEffect=function(value){for(var factor,slide,i=0;i https://totaalonlinemarketing.nl/wp-includes/js/mediaelement/mediaelement-and-player.min.js?ver=4.2.13-9993131
/*!
* MediaElement.js
* http://www.mediaelementjs.com/
*
* Wrapper that mimics native HTML5 MediaElement (audio and video)
* using a variety of technologies (pure JavaScript, Flash, iframe)
*
* Copyright 2010-2017, John Dyer (http://j.hn/)
* License: MIT
*
*/
!function r(a,s,l){function d(t,e){if(!s[t]){if(!a[t]){var n="function"==typeof require&&require;if(!e&&n)return n(t,!0);if(u)return u(t,!0);var o=new Error("Cannot find module '"+t+"'");throw o.code="MODULE_NOT_FOUND",o}var i=s[t]={exports:{}};a[t][0].call(i.exports,function(e){return d(a[t][1][e]||e)},i,i.exports,r,a,s,l)}return s[t].exports}for(var u="function"==typeof require&&require,e=0;e',o.addControlElement(t,"fullscreen"),t.addEventListener("click",function(){m.HAS_TRUE_NATIVE_FULLSCREEN&&m.IS_FULLSCREEN||n.isFullScreen?n.exitFullScreen():n.enterFullScreen()}),n.fullscreenBtn=t,o.options.keyActions.push({keys:[70],action:function(e,t,n,o){o.ctrlKey||void 0!==e.enterFullScreen&&(e.isFullScreen?e.exitFullScreen():e.enterFullScreen())}}),o.exitFullscreenCallback=function(e){var t=e.which||e.keyCode||0;o.options.enableKeyboard&&27===t&&(m.HAS_TRUE_NATIVE_FULLSCREEN&&m.IS_FULLSCREEN||o.isFullScreen)&&n.exitFullScreen()},o.globalBind("keydown",o.exitFullscreenCallback),o.normalHeight=0,o.normalWidth=0,m.HAS_TRUE_NATIVE_FULLSCREEN){n.globalBind(m.FULLSCREEN_EVENT_NAME,function(){n.isFullScreen&&(m.isFullScreen()?(n.isNativeFullScreen=!0,n.setControlsSize()):(n.isNativeFullScreen=!1,n.exitFullScreen()))})}}},cleanfullscreen:function(e){e.exitFullScreen(),e.globalUnbind("keydown",e.exitFullscreenCallback)},detectFullscreenMode:function(){var e=null!==this.media.rendererName&&/(native|html5)/i.test(this.media.rendererName),t="";return m.HAS_TRUE_NATIVE_FULLSCREEN&&e?t="native-native":m.HAS_TRUE_NATIVE_FULLSCREEN&&!e?t="plugin-native":this.usePluginFullScreen&&m.SUPPORT_POINTER_EVENTS&&(t="plugin-click"),this.fullscreenMode=t},enterFullScreen:function(){var o=this,e=null!==o.media.rendererName&&/(html5|native)/i.test(o.media.rendererName),t=getComputedStyle(o.getElement(o.container));if(o.isVideo)if(!1===o.options.useFakeFullscreen&&m.IS_IOS&&m.HAS_IOS_FULLSCREEN&&"function"==typeof o.media.originalNode.webkitEnterFullscreen&&o.media.originalNode.canPlayType((0,y.getTypeFromFile)(o.media.getSrc())))o.media.originalNode.webkitEnterFullscreen();else{if((0,v.addClass)(p.default.documentElement,o.options.classPrefix+"fullscreen"),(0,v.addClass)(o.getElement(o.container),o.options.classPrefix+"container-fullscreen"),o.normalHeight=parseFloat(t.height),o.normalWidth=parseFloat(t.width),"native-native"!==o.fullscreenMode&&"plugin-native"!==o.fullscreenMode||(m.requestFullScreen(o.getElement(o.container)),o.isInIframe&&setTimeout(function e(){if(o.isNativeFullScreen){var t=f.default.innerWidth||p.default.documentElement.clientWidth||p.default.body.clientWidth,n=screen.width;.002*n',l.addEventListener("click",function(){i.paused?i.play():i.pause()});var d=l.querySelector("button");function u(e){"play"===e?((0,m.removeClass)(l,i.options.classPrefix+"play"),(0,m.removeClass)(l,i.options.classPrefix+"replay"),(0,m.addClass)(l,i.options.classPrefix+"pause"),d.setAttribute("title",s),d.setAttribute("aria-label",s)):((0,m.removeClass)(l,i.options.classPrefix+"pause"),(0,m.removeClass)(l,i.options.classPrefix+"replay"),(0,m.addClass)(l,i.options.classPrefix+"play"),d.setAttribute("title",a),d.setAttribute("aria-label",a))}i.addControlElement(l,"playpause"),u("pse"),o.addEventListener("loadedmetadata",function(){-1===o.rendererName.indexOf("flash")&&u("pse")}),o.addEventListener("play",function(){u("play")}),o.addEventListener("playing",function(){u("play")}),o.addEventListener("pause",function(){u("pse")}),o.addEventListener("ended",function(){e.options.loop||((0,m.removeClass)(l,i.options.classPrefix+"pause"),(0,m.removeClass)(l,i.options.classPrefix+"play"),(0,m.addClass)(l,i.options.classPrefix+"replay"),d.setAttribute("title",a),d.setAttribute("aria-label",a))})}})},{18:18,2:2,28:28,29:29,7:7}],13:[function(e,t,n){"use strict";var p=r(e(2)),o=e(18),i=r(o),m=r(e(7)),g=e(27),E=e(32),b=e(28);function r(e){return e&&e.__esModule?e:{default:e}}Object.assign(o.config,{enableProgressTooltip:!0,useSmoothHover:!0,forceLive:!1}),Object.assign(i.default.prototype,{buildprogress:function(h,s,e,d){var u=0,v=!1,c=!1,y=this,t=h.options.autoRewind,n=h.options.enableProgressTooltip?'00:00 ':"",o=p.default.createElement("div");o.className=y.options.classPrefix+"time-rail",o.innerHTML=' '+n+" ",y.addControlElement(o,"progress"),y.options.keyActions.push({keys:[37,227],action:function(e){if(!isNaN(e.duration)&&0o+n.left&&(d=o+n.left),a=(l=d-n.left)/o,y.newTime=a*y.getDuration(),v&&null!==y.getCurrentTime()&&y.newTime.toFixed(4)!==y.getCurrentTime().toFixed(4)&&(y.setCurrentRailHandle(y.newTime),y.updateCurrent(y.newTime)),!g.IS_IOS&&!g.IS_ANDROID){if(l<0&&(l=0),y.options.useSmoothHover&&null!==r&&void 0!==window[r]){var u=new window[r](getComputedStyle(y.handle)[i]).m41,c=l/parseFloat(getComputedStyle(y.total).width)-u/parseFloat(getComputedStyle(y.total).width);y.hovered.style.left=u+"px",y.setTransformStyle(y.hovered,"scaleX("+c+")"),y.hovered.setAttribute("pos",l),0<=c?(0,b.removeClass)(y.hovered,"negative"):(0,b.addClass)(y.hovered,"negative")}if(y.timefloat){var f=y.timefloat.offsetWidth/2,p=mejs.Utils.offset(y.getElement(y.container)),m=getComputedStyle(y.timefloat);s=d-p.left=y.getElement(y.container).offsetWidth-f?y.total.offsetWidth-f:l,(0,b.hasClass)(y.getElement(y.container),y.options.classPrefix+"long-video")&&(s+=parseFloat(m.marginLeft)/2+y.timefloat.offsetWidth/2),y.timefloat.style.left=s+"px",y.timefloatcurrent.innerHTML=(0,E.secondsToTimeCode)(y.newTime,h.options.alwaysShowHours,h.options.showTimecodeFrameCount,h.options.framesPerSecond,h.options.secondsDecimalLength,h.options.timeFormat),y.timefloat.style.display="block"}}}else g.IS_IOS||g.IS_ANDROID||!y.timefloat||(s=y.timefloat.offsetWidth+o>=y.getElement(y.container).offsetWidth?y.timefloat.offsetWidth/2:0,y.timefloat.style.left=s+"px",y.timefloat.style.left=s+"px",y.timefloat.style.display="block")},f=function(){1e3<=new Date-u&&y.play()};y.slider.addEventListener("focus",function(){h.options.autoRewind=!1}),y.slider.addEventListener("blur",function(){h.options.autoRewind=t}),y.slider.addEventListener("keydown",function(e){if(1e3<=new Date-u&&(c=y.paused),y.options.enableKeyboard&&y.options.keyActions.length){var t=e.which||e.keyCode||0,n=y.getDuration(),o=h.options.defaultSeekForwardInterval(d),i=h.options.defaultSeekBackwardInterval(d),r=y.getCurrentTime(),a=y.getElement(y.container).querySelector("."+y.options.classPrefix+"volume-slider");if(38===t||40===t){a&&(a.style.display="block"),y.isVideo&&(y.showControls(),y.startControlsTimer());var s=38===t?Math.min(y.volume+.1,1):Math.max(y.volume-.1,0),l=s<=0;return y.setVolume(s),void y.setMuted(l)}switch(a&&(a.style.display="none"),t){case 37:y.getDuration()!==1/0&&(r-=i);break;case 39:y.getDuration()!==1/0&&(r+=o);break;case 36:r=0;break;case 35:r=n;break;case 13:case 32:return void(g.IS_FIREFOX&&(y.paused?y.play():y.pause()));default:return}r=r<0||isNaN(r)?0:n<=r?n:Math.floor(r),u=new Date,c||h.pause(),r | "}),Object.assign(i.default.prototype,{buildcurrent:function(e,t,n,o){var i=this,r=a.default.createElement("div");r.className=i.options.classPrefix+"time",r.setAttribute("role","timer"),r.setAttribute("aria-live","off"),r.innerHTML=''+(0,s.secondsToTimeCode)(0,e.options.alwaysShowHours,e.options.showTimecodeFrameCount,e.options.framesPerSecond,e.options.secondsDecimalLength,e.options.timeFormat)+" ",i.addControlElement(r,"current"),e.updateCurrent(),i.updateTimeCallback=function(){i.controlsAreVisible&&e.updateCurrent()},o.addEventListener("timeupdate",i.updateTimeCallback)},cleancurrent:function(e,t,n,o){o.removeEventListener("timeupdate",e.updateTimeCallback)},buildduration:function(e,t,n,o){var i=this;if(t.lastChild.querySelector("."+i.options.classPrefix+"currenttime"))t.querySelector("."+i.options.classPrefix+"time").innerHTML+=i.options.timeAndDurationSeparator+''+(0,s.secondsToTimeCode)(i.options.duration,i.options.alwaysShowHours,i.options.showTimecodeFrameCount,i.options.framesPerSecond,i.options.secondsDecimalLength,i.options.timeFormat)+" ";else{t.querySelector("."+i.options.classPrefix+"currenttime")&&(0,l.addClass)(t.querySelector("."+i.options.classPrefix+"currenttime").parentNode,i.options.classPrefix+"currenttime-container");var r=a.default.createElement("div");r.className=i.options.classPrefix+"time "+i.options.classPrefix+"duration-container",r.innerHTML=''+(0,s.secondsToTimeCode)(i.options.duration,i.options.alwaysShowHours,i.options.showTimecodeFrameCount,i.options.framesPerSecond,i.options.secondsDecimalLength,i.options.timeFormat)+" ",i.addControlElement(r,"duration")}i.updateDurationCallback=function(){i.controlsAreVisible&&e.updateDuration()},o.addEventListener("timeupdate",i.updateDurationCallback)},cleanduration:function(e,t,n,o){o.removeEventListener("timeupdate",e.updateDurationCallback)},updateCurrent:function(){var e=this,t=e.getCurrentTime();isNaN(t)&&(t=0);var n=(0,s.secondsToTimeCode)(t,e.options.alwaysShowHours,e.options.showTimecodeFrameCount,e.options.framesPerSecond,e.options.secondsDecimalLength,e.options.timeFormat);5 ',o.captions.style.display="none",t.insertBefore(o.captions,t.firstChild),o.captionsText=o.captions.querySelector("."+i.options.classPrefix+"captions-text"),o.captionsButton=L.default.createElement("div"),o.captionsButton.className=i.options.classPrefix+"button "+i.options.classPrefix+"captions-button",o.captionsButton.innerHTML=' ",i.addControlElement(o.captionsButton,"tracks"),o.captionsButton.querySelector("."+i.options.classPrefix+"captions-selector-input").disabled=!1,o.chaptersButton=L.default.createElement("div"),o.chaptersButton.className=i.options.classPrefix+"button "+i.options.classPrefix+"chapters-button",o.chaptersButton.innerHTML=' ';for(var u=0,c=0;c'+n+" (loading) "},checkForTracks:function(){var e=this,t=!1;if(e.options.hideCaptionsButtonWhenEmpty){for(var n=0,o=e.tracks.length;n'+e.entries[n].text+" ";for(var o=r.chaptersButton.querySelectorAll('input[type="radio"]'),i=r.chaptersButton.querySelectorAll("."+r.options.classPrefix+"chapters-selector-label"),a=0,s=o.length;a>1].start,a=e[i].stop,r<=t&&t ((?:[0-9]{1,2}:)?[0-9]{2}:[0-9]{2}([,.][0-9]{3})?)(.*)$/,parse:function(e){for(var t=e.split(/\r?\n/),n=[],o=void 0,i=void 0,r=void 0,a=0,s=t.length;a$1 "),n.push({identifier:r,start:0===(0,m.convertSMPTEtoSeconds)(o[1])?.2:(0,m.convertSMPTEtoSeconds)(o[1]),stop:(0,m.convertSMPTEtoSeconds)(o[3]),text:i,settings:o[5]})}r=""}return n}},dfxp:{parse:function(e){var t=(e=$(e).filter("tt")).firstChild,n=t.querySelectorAll("p"),o=e.getElementById(""+t.attr("style")),i=[],r=void 0;if(o.length){o.removeAttribute("id");var a=o.attributes;if(a.length){r={};for(var s=0,l=a.length;s$1"),i.push(f)}return i}}}},{18:18,2:2,28:28,29:29,32:32,7:7,9:9}],16:[function(e,t,n){"use strict";var w=i(e(2)),x=e(18),o=i(x),T=i(e(7)),P=e(27),C=e(29),k=e(28);function i(e){return e&&e.__esModule?e:{default:e}}Object.assign(x.config,{muteText:null,unmuteText:null,allyVolumeControlText:null,hideVolumeOnTouchDevices:!0,audioVolume:"horizontal",videoVolume:"vertical",startVolume:.8}),Object.assign(o.default.prototype,{buildvolume:function(e,t,n,o){if(!P.IS_ANDROID&&!P.IS_IOS||!this.options.hideVolumeOnTouchDevices){var a=this,s=a.isVideo?a.options.videoVolume:a.options.audioVolume,r=(0,C.isString)(a.options.muteText)?a.options.muteText:T.default.t("mejs.mute"),l=(0,C.isString)(a.options.unmuteText)?a.options.unmuteText:T.default.t("mejs.unmute"),i=(0,C.isString)(a.options.allyVolumeControlText)?a.options.allyVolumeControlText:T.default.t("mejs.volume-help-text"),d=w.default.createElement("div");if(d.className=a.options.classPrefix+"button "+a.options.classPrefix+"volume-button "+a.options.classPrefix+"mute",d.innerHTML="horizontal"===s?' ':''+i+' ',a.addControlElement(d,"volume"),a.options.keyActions.push({keys:[38],action:function(e){var t=e.getElement(e.container).querySelector("."+x.config.classPrefix+"volume-slider");t&&t.matches(":focus")&&(t.style.display="block"),e.isVideo&&(e.showControls(),e.startControlsTimer());var n=Math.min(e.volume+.1,1);e.setVolume(n),0'+i+'',d.parentNode.insertBefore(u,d.nextSibling)}var c=!1,f=!1,p=!1,m="vertical"===s?a.getElement(a.container).querySelector("."+a.options.classPrefix+"volume-slider"):a.getElement(a.container).querySelector("."+a.options.classPrefix+"horizontal-volume-slider"),h="vertical"===s?a.getElement(a.container).querySelector("."+a.options.classPrefix+"volume-total"):a.getElement(a.container).querySelector("."+a.options.classPrefix+"horizontal-volume-total"),v="vertical"===s?a.getElement(a.container).querySelector("."+a.options.classPrefix+"volume-current"):a.getElement(a.container).querySelector("."+a.options.classPrefix+"horizontal-volume-current"),y="vertical"===s?a.getElement(a.container).querySelector("."+a.options.classPrefix+"volume-handle"):a.getElement(a.container).querySelector("."+a.options.classPrefix+"horizontal-volume-handle"),g=function(e){if(null!==e&&!isNaN(e)&&void 0!==e){if(e=Math.max(0,e),0===(e=Math.min(e,1))){(0,k.removeClass)(d,a.options.classPrefix+"mute"),(0,k.addClass)(d,a.options.classPrefix+"unmute");var t=d.firstElementChild;t.setAttribute("title",l),t.setAttribute("aria-label",l)}else{(0,k.removeClass)(d,a.options.classPrefix+"unmute"),(0,k.addClass)(d,a.options.classPrefix+"mute");var n=d.firstElementChild;n.setAttribute("title",r),n.setAttribute("aria-label",r)}var o=100*e+"%",i=getComputedStyle(y);"vertical"===s?(v.style.bottom=0,v.style.height=o,y.style.bottom=o,y.style.marginBottom=-parseFloat(i.height)/2+"px"):(v.style.left=0,v.style.width=o,y.style.left=o,y.style.marginLeft=-parseFloat(i.width)/2+"px")}},E=function(e){var t=(0,k.offset)(h),n=getComputedStyle(h);p=!0;var o=null;if("vertical"===s){var i=parseFloat(n.height);if(o=(i-(e.pageY-t.top))/i,0===t.top||0===t.left)return}else{var r=parseFloat(n.width);o=(e.pageX-t.left)/r}o=Math.max(0,o),o=Math.min(o,1),g(o),a.setMuted(0===o),a.setVolume(o),e.preventDefault(),e.stopPropagation()},b=function(){a.muted?(g(0),(0,k.removeClass)(d,a.options.classPrefix+"mute"),(0,k.addClass)(d,a.options.classPrefix+"unmute")):(g(o.volume),(0,k.removeClass)(d,a.options.classPrefix+"unmute"),(0,k.addClass)(d,a.options.classPrefix+"mute"))};e.getElement(e.container).addEventListener("keydown",function(e){!!e.target.closest("."+a.options.classPrefix+"container")||"vertical"!==s||(m.style.display="none")}),d.addEventListener("mouseenter",function(e){e.target===d&&(m.style.display="block",f=!0,e.preventDefault(),e.stopPropagation())}),d.addEventListener("focusin",function(){m.style.display="block",f=!0}),d.addEventListener("focusout",function(e){e.relatedTarget&&(!e.relatedTarget||e.relatedTarget.matches("."+a.options.classPrefix+"volume-slider"))||"vertical"!==s||(m.style.display="none")}),d.addEventListener("mouseleave",function(){f=!1,c||"vertical"!==s||(m.style.display="none")}),d.addEventListener("focusout",function(){f=!1}),d.addEventListener("keydown",function(e){if(a.options.enableKeyboard&&a.options.keyActions.length){var t=e.which||e.keyCode||0,n=o.volume;switch(t){case 38:n=Math.min(n+.1,1);break;case 40:n=Math.max(0,n-.1);break;default:return!0}c=!1,g(n),o.setVolume(n),e.preventDefault(),e.stopPropagation()}}),d.querySelector("button").addEventListener("click",function(){o.setMuted(!o.muted);var e=(0,C.createEvent)("volumechange",o);o.dispatchEvent(e)}),m.addEventListener("dragstart",function(){return!1}),m.addEventListener("mouseover",function(){f=!0}),m.addEventListener("focusin",function(){m.style.display="block",f=!0}),m.addEventListener("focusout",function(){f=!1,c||"vertical"!==s||(m.style.display="none")}),m.addEventListener("mousedown",function(e){E(e),a.globalBind("mousemove.vol",function(e){var t=e.target;c&&(t===m||t.closest("vertical"===s?"."+a.options.classPrefix+"volume-slider":"."+a.options.classPrefix+"horizontal-volume-slider"))&&E(e)}),a.globalBind("mouseup.vol",function(){c=!1,f||"vertical"!==s||(m.style.display="none")}),c=!0,e.preventDefault(),e.stopPropagation()}),o.addEventListener("volumechange",function(e){var t;c||b(),t=Math.floor(100*o.volume),m.setAttribute("aria-valuenow",t),m.setAttribute("aria-valuetext",t+"%")});var S=!1;o.addEventListener("rendererready",function(){p||setTimeout(function(){S=!0,(0===e.options.startVolume||o.originalNode.muted)&&(o.setMuted(!0),e.options.startVolume=0),o.setVolume(e.options.startVolume),a.setControlsSize()},250)}),o.addEventListener("loadedmetadata",function(){setTimeout(function(){p||S||((0===e.options.startVolume||o.originalNode.muted)&&o.setMuted(!0),o.setVolume(e.options.startVolume),a.setControlsSize()),S=!1},250)}),(0===e.options.startVolume||o.originalNode.muted)&&(o.setMuted(!0),e.options.startVolume=0,b()),a.getElement(a.container).addEventListener("controlsresize",function(){b()})}}})},{18:18,2:2,27:27,28:28,29:29,7:7}],17:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});n.EN={"mejs.plural-form":1,"mejs.download-file":"Download File","mejs.install-flash":"You are using a browser that does not have Flash player enabled or installed. Please turn on your Flash player plugin or download the latest version from https://get.adobe.com/flashplayer/","mejs.fullscreen":"Fullscreen","mejs.play":"Play","mejs.pause":"Pause","mejs.time-slider":"Time Slider","mejs.time-help-text":"Use Left/Right Arrow keys to advance one second, Up/Down arrows to advance ten seconds.","mejs.live-broadcast":"Live Broadcast","mejs.volume-help-text":"Use Up/Down Arrow keys to increase or decrease volume.","mejs.unmute":"Unmute","mejs.mute":"Mute","mejs.volume-slider":"Volume Slider","mejs.video-player":"Video Player","mejs.audio-player":"Audio Player","mejs.captions-subtitles":"Captions/Subtitles","mejs.captions-chapters":"Chapters","mejs.none":"None","mejs.afrikaans":"Afrikaans","mejs.albanian":"Albanian","mejs.arabic":"Arabic","mejs.belarusian":"Belarusian","mejs.bulgarian":"Bulgarian","mejs.catalan":"Catalan","mejs.chinese":"Chinese","mejs.chinese-simplified":"Chinese (Simplified)","mejs.chinese-traditional":"Chinese (Traditional)","mejs.croatian":"Croatian","mejs.czech":"Czech","mejs.danish":"Danish","mejs.dutch":"Dutch","mejs.english":"English","mejs.estonian":"Estonian","mejs.filipino":"Filipino","mejs.finnish":"Finnish","mejs.french":"French","mejs.galician":"Galician","mejs.german":"German","mejs.greek":"Greek","mejs.haitian-creole":"Haitian Creole","mejs.hebrew":"Hebrew","mejs.hindi":"Hindi","mejs.hungarian":"Hungarian","mejs.icelandic":"Icelandic","mejs.indonesian":"Indonesian","mejs.irish":"Irish","mejs.italian":"Italian","mejs.japanese":"Japanese","mejs.korean":"Korean","mejs.latvian":"Latvian","mejs.lithuanian":"Lithuanian","mejs.macedonian":"Macedonian","mejs.malay":"Malay","mejs.maltese":"Maltese","mejs.norwegian":"Norwegian","mejs.persian":"Persian","mejs.polish":"Polish","mejs.portuguese":"Portuguese","mejs.romanian":"Romanian","mejs.russian":"Russian","mejs.serbian":"Serbian","mejs.slovak":"Slovak","mejs.slovenian":"Slovenian","mejs.spanish":"Spanish","mejs.swahili":"Swahili","mejs.swedish":"Swedish","mejs.tagalog":"Tagalog","mejs.thai":"Thai","mejs.turkish":"Turkish","mejs.ukrainian":"Ukrainian","mejs.vietnamese":"Vietnamese","mejs.welsh":"Welsh","mejs.yiddish":"Yiddish"}},{}],18:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.config=void 0;var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=function(){function o(e,t){for(var n=0;n
',n.getElement(n.container).addEventListener("focus",function(e){if(!n.controlsAreVisible&&!n.hasFocus&&n.controlsEnabled){n.showControls(!0);var t=(0,E.isNodeAfter)(e.relatedTarget,n.getElement(n.container))?"."+n.options.classPrefix+"controls ."+n.options.classPrefix+"button:last-child > button":"."+n.options.classPrefix+"playpause-button > button";n.getElement(n.container).querySelector(t).focus()}}),n.node.parentNode.insertBefore(n.getElement(n.container),n.node),n.options.features.length||n.options.useDefaultControls||(n.getElement(n.container).style.background="transparent",n.getElement(n.container).querySelector("."+n.options.classPrefix+"controls").style.display="none"),n.isVideo&&"fill"===n.options.stretching&&!T.hasClass(n.getElement(n.container).parentNode,n.options.classPrefix+"fill-container")){n.outerContainer=n.media.parentNode;var r=w.default.createElement("div");r.className=n.options.classPrefix+"fill-container",n.getElement(n.container).parentNode.insertBefore(r,n.getElement(n.container)),r.appendChild(n.getElement(n.container))}if(x.IS_ANDROID&&T.addClass(n.getElement(n.container),n.options.classPrefix+"android"),x.IS_IOS&&T.addClass(n.getElement(n.container),n.options.classPrefix+"ios"),x.IS_IPAD&&T.addClass(n.getElement(n.container),n.options.classPrefix+"ipad"),x.IS_IPHONE&&T.addClass(n.getElement(n.container),n.options.classPrefix+"iphone"),T.addClass(n.getElement(n.container),n.isVideo?n.options.classPrefix+"video":n.options.classPrefix+"audio"),x.IS_SAFARI&&!x.IS_IOS){T.addClass(n.getElement(n.container),n.options.classPrefix+"hide-cues");for(var a=n.node.cloneNode(),s=n.node.children,l=[],d=[],u=0,c=s.length;u=n.width?n.width/n.height:n.height/n.width,n.setPlayerSize(n.width,n.height),e.pluginWidth=n.width,e.pluginHeight=n.height}if(v.default.MepDefaults=e,new y.default(n.media,e,n.mediaFiles),void 0!==n.getElement(n.container)&&n.options.features.length&&n.controlsAreVisible&&!n.options.hideVideoControlsOnLoad){var h=(0,E.createEvent)("controlsshown",n.getElement(n.container));n.getElement(n.container).dispatchEvent(h)}}},{key:"showControls",value:function(e){var i=this;if(e=void 0===e||e,!i.controlsAreVisible&&i.isVideo){if(e)!function(){T.fadeIn(i.getElement(i.controls),200,function(){T.removeClass(i.getElement(i.controls),i.options.classPrefix+"offscreen");var e=(0,E.createEvent)("controlsshown",i.getElement(i.container));i.getElement(i.container).dispatchEvent(e)});for(var n=i.getElement(i.container).querySelectorAll("."+i.options.classPrefix+"control"),e=function(e,t){T.fadeIn(n[e],200,function(){T.removeClass(n[e],i.options.classPrefix+"offscreen")})},t=0,o=n.length;t'),e.message&&(a=""+e.message+"
"),e.urls)for(var d=0,u=e.urls.length;d'+v.default.i18n.t("mejs.download-file")+": "+c.src+" "}}a&&o.getElement(o.layers).querySelector("."+o.options.classPrefix+"overlay-error")&&(r.innerHTML=a,o.getElement(o.layers).querySelector("."+o.options.classPrefix+"overlay-error").innerHTML=""+s+r.outerHTML,o.getElement(o.layers).querySelector("."+o.options.classPrefix+"overlay-error").parentNode.style.display="block"),o.controlsEnabled&&o.disableControls()}},{key:"setPlayerSize",value:function(e,t){var n=this;if(!n.options.setDimensions)return!1;switch(void 0!==e&&(n.width=e),void 0!==t&&(n.height=t),n.options.stretching){case"fill":n.isVideo?n.setFillMode():n.setDimensions(n.width,n.height);break;case"responsive":n.setResponsiveMode();break;case"none":n.setDimensions(n.width,n.height);break;default:!0===n.hasFluidMode()?n.setResponsiveMode():n.setDimensions(n.width,n.height)}}},{key:"hasFluidMode",value:function(){var e=this;return-1!==e.height.toString().indexOf("%")||e.node&&e.node.style.maxWidth&&"none"!==e.node.style.maxWidth&&e.node.style.maxWidth!==e.width||e.node&&e.node.currentStyle&&"100%"===e.node.currentStyle.maxWidth}},{key:"setResponsiveMode",value:function(){var e,o=this,t=function(){for(var t=void 0,n=o.getElement(o.container);n;){try{if(x.IS_FIREFOX&&"html"===n.tagName.toLowerCase()&&S.default.self!==S.default.top&&null!==S.default.frameElement)return S.default.frameElement;t=n.parentElement}catch(e){t=n.parentElement}if(t&&T.visible(t))return t;n=t}return null}(),n=t?getComputedStyle(t,null):getComputedStyle(w.default.body,null),i=o.isVideo?o.node.videoWidth&&0=o.width?o.node.videoWidth/o.node.videoHeight:o.node.videoHeight/o.node.videoWidth:o.initialAspectRatio,(isNaN(e)||e<.01||100=o.width?parseFloat(d/a,10):parseFloat(d*a,10):r,isNaN(l)&&(l=s),0img");a&&(a.style.display="");for(var s=e.getElement(e.container).querySelectorAll("object, embed, iframe, video"),l=e.height,d=e.width,u=i,c=l*i/d,f=d*r/l,p=r,m=i ',n.appendChild(r),a.style.display="none",a.className=i.options.classPrefix+"overlay "+i.options.classPrefix+"layer",a.innerHTML='
',n.appendChild(a),s.className=i.options.classPrefix+"overlay "+i.options.classPrefix+"layer "+i.options.classPrefix+"overlay-play",s.innerHTML='
',s.addEventListener("click",function(){if(i.options.clickToPlayPause){var e=i.getElement(i.container).querySelector("."+i.options.classPrefix+"overlay-button"),t=e.getAttribute("aria-pressed");i.paused?i.play():i.pause(),e.setAttribute("aria-pressed",!!t),i.getElement(i.container).focus()}}),s.addEventListener("keydown",function(e){var t=e.keyCode||e.which||0;if(13===t||x.IS_FIREFOX&&32===t){var n=(0,E.createEvent)("click",s);return s.dispatchEvent(n),!1}}),n.appendChild(s),null!==i.media.rendererName&&(/(youtube|facebook)/i.test(i.media.rendererName)&&!(i.media.originalNode.getAttribute("poster")||t.options.poster||"function"==typeof i.media.renderer.getPosterUrl&&i.media.renderer.getPosterUrl())||x.IS_STOCK_ANDROID||i.media.originalNode.getAttribute("autoplay"))&&(s.style.display="none");var l=!1;o.addEventListener("play",function(){s.style.display="none",r.style.display="none",a.style.display="none",l=!1}),o.addEventListener("playing",function(){s.style.display="none",r.style.display="none",a.style.display="none",l=!1}),o.addEventListener("seeking",function(){s.style.display="none",r.style.display="",l=!1}),o.addEventListener("seeked",function(){s.style.display=i.paused&&!x.IS_STOCK_ANDROID?"":"none",r.style.display="none",l=!1}),o.addEventListener("pause",function(){r.style.display="none",x.IS_STOCK_ANDROID||l||(s.style.display=""),l=!1}),o.addEventListener("waiting",function(){r.style.display="",l=!1}),o.addEventListener("loadeddata",function(){r.style.display="",x.IS_ANDROID&&(o.canplayTimeout=setTimeout(function(){if(w.default.createEvent){var e=w.default.createEvent("HTMLEvents");return e.initEvent("canplay",!0,!0),o.dispatchEvent(e)}},300)),l=!1}),o.addEventListener("canplay",function(){r.style.display="none",clearTimeout(o.canplayTimeout),l=!1}),o.addEventListener("error",function(e){i._handleError(e,i.media,i.node),r.style.display="none",s.style.display="none",l=!0}),o.addEventListener("loadedmetadata",function(){i.controlsEnabled||i.enableControls()}),o.addEventListener("keydown",function(e){i.onkeydown(t,o,e),l=!1})}}},{key:"buildkeyboard",value:function(o,e,t,i){var r=this;r.getElement(r.container).addEventListener("keydown",function(){r.keyboardAction=!0}),r.globalKeydownCallback=function(e){var t=w.default.activeElement.closest("."+r.options.classPrefix+"container"),n=r.media.closest("."+r.options.classPrefix+"container");return r.hasFocus=!(!t||!n||t.id!==n.id),r.onkeydown(o,i,e)},r.globalClickCallback=function(e){r.hasFocus=!!e.target.closest("."+r.options.classPrefix+"container")},r.globalBind("keydown",r.globalKeydownCallback),r.globalBind("click",r.globalClickCallback)}},{key:"onkeydown",value:function(e,t,n){if(e.hasFocus&&e.options.enableKeyboard)for(var o=0,i=e.options.keyActions.length;oimg");(e&&l.node.setAttribute("poster",e.src),delete l.node.autoplay,l.node.setAttribute("src",""),""!==l.media.canPlayType((0,b.getTypeFromFile)(u))&&l.node.setAttribute("src",u),d&&-1t[0]||n[0]===t[0]&&n[1]>t[1]||n[0]===t[0]&&n[1]===t[1]&&n[2]>=t[2]},addPlugin:function(e,t,n,o,i){r.plugins[e]=r.detectPlugin(t,n,o,i)},detectPlugin:function(e,t,n,o){var i=[0,0,0],r=void 0,a=void 0;if(null!==F.NAV.plugins&&void 0!==F.NAV.plugins&&"object"===d(F.NAV.plugins[e])){if((r=F.NAV.plugins[e].description)&&(void 0===F.NAV.mimeTypes||!F.NAV.mimeTypes[t]||F.NAV.mimeTypes[t].enabledPlugin))for(var s=0,l=(i=r.replace(e,"").replace(/^\s+/,"").replace(/\sr/gi,".").split(".")).length;s'+N.default.t("mejs.install-flash")+"
"}else w=['id="__'+r.id+'"','name="__'+r.id+'"','play="true"','loop="false"','quality="high"','bgcolor="#000000"','wmode="transparent"','allowScriptAccess="'+r.options.shimScriptAccess+'"','allowFullScreen="true"','type="application/x-shockwave-flash"','pluginspage="//www.macromedia.com/go/getflashplayer"','src="'+r.options.pluginPath+r.options.filename+'"','flashvars="'+g.join("&")+'"'],E?(w.push('width="'+S+'"'),w.push('height="'+b+'"')):w.push('style="position: fixed; left: -9999em; top: -9999em;"'),r.flashWrapper.innerHTML="";if(r.flashNode=r.flashWrapper.lastChild,r.hide=function(){o=!1,E&&(r.flashNode.style.display="none")},r.show=function(){o=!0,E&&(r.flashNode.style.display="")},r.setSize=function(e,t){r.flashNode.style.width=e+"px",r.flashNode.style.height=t+"px",null!==r.flashApi&&"function"==typeof r.flashApi.fire_setSize&&r.flashApi.fire_setSize(e,t)},r.destroy=function(){r.flashNode.remove()},n&&0":">",'"':"""};return e.replace(/[&<>"]/g,function(e){return t[e]})}function s(o,i){var r=this,a=arguments,s=2x',t.firstChild.href}function d(e){var t=1 https://totaalonlinemarketing.nl/wp-includes/js/mediaelement/mediaelement-migrate.min.js?ver=5.5.15
!function(a){void 0===mejs.plugins&&(mejs.plugins={},mejs.plugins.silverlight=[],mejs.plugins.silverlight.push({types:[]})),mejs.HtmlMediaElementShim=mejs.HtmlMediaElementShim||{getTypeFromFile:mejs.Utils.getTypeFromFile},void 0===mejs.MediaFeatures&&(mejs.MediaFeatures=mejs.Features),void 0===mejs.Utility&&(mejs.Utility=mejs.Utils);var e=MediaElementPlayer.prototype.init;MediaElementPlayer.prototype.init=function(){this.options.classPrefix="mejs-",this.$media=this.$node=a(this.node),e.call(this)};var t=MediaElementPlayer.prototype._meReady;MediaElementPlayer.prototype._meReady=function(){this.container=a(this.container),this.controls=a(this.controls),this.layers=a(this.layers),t.apply(this,arguments)},MediaElementPlayer.prototype.getElement=function(e){return void 0!==a&&e instanceof a?e[0]:e},MediaElementPlayer.prototype.buildfeatures=function(e,t,i,s){for(var r=["playpause","current","progress","duration","tracks","volume","fullscreen"],l=0,n=this.options.features.length;l https://totaalonlinemarketing.nl/wp-includes/js/mediaelement/wp-mediaelement.min.js?ver=5.5.15
!function(e,n){e.wp=e.wp||{},e.wp.mediaelement=new function(){var e={};return{initialize:function(){(e="undefined"!=typeof _wpmejsSettings?n.extend(!0,{},_wpmejsSettings):e).classPrefix="mejs-",e.success=e.success||function(e){var n,t;e.rendererName&&-1!==e.rendererName.indexOf("flash")&&(n=e.attributes.autoplay&&"false"!==e.attributes.autoplay,t=e.attributes.loop&&"false"!==e.attributes.loop,n&&e.addEventListener("canplay",function(){e.play()},!1),t&&e.addEventListener("ended",function(){e.play()},!1))},e.customError=function(e,n){if(-1!==e.rendererName.indexOf("flash")||-1!==e.rendererName.indexOf("flv"))return''+mejsL10n.strings["mejs.download-file"]+" "},n(".wp-audio-shortcode, .wp-video-shortcode").not(".mejs-container").filter(function(){return!n(this).parent().hasClass("mejs-mediaelement")}).mediaelementplayer(e)}}},n(e.wp.mediaelement.initialize)}(window,jQuery);
// source --> https://totaalonlinemarketing.nl/wp-includes/js/imagesloaded.min.js?ver=4.1.4
/*! This file is auto-generated */
/*!
* imagesLoaded PACKAGED v4.1.4
* JavaScript is all like "You images are done yet or what?"
* MIT License
*/
!function(e,t){"function"==typeof define&&define.amd?define("ev-emitter/ev-emitter",t):"object"==typeof module&&module.exports?module.exports=t():e.EvEmitter=t()}("undefined"!=typeof window?window:this,function(){function e(){}var t=e.prototype;return t.on=function(e,t){if(e&&t){var i=this._events=this._events||{},n=i[e]=i[e]||[];return n.indexOf(t)==-1&&n.push(t),this}},t.once=function(e,t){if(e&&t){this.on(e,t);var i=this._onceEvents=this._onceEvents||{},n=i[e]=i[e]||{};return n[t]=!0,this}},t.off=function(e,t){var i=this._events&&this._events[e];if(i&&i.length){var n=i.indexOf(t);return n!=-1&&i.splice(n,1),this}},t.emitEvent=function(e,t){var i=this._events&&this._events[e];if(i&&i.length){i=i.slice(0),t=t||[];for(var n=this._onceEvents&&this._onceEvents[e],o=0;o https://totaalonlinemarketing.nl/wp-includes/js/masonry.min.js?ver=4.2.2
/*! This file is auto-generated */
/*!
* Masonry PACKAGED v4.2.2
* Cascading grid layout library
* https://masonry.desandro.com
* MIT License
* by David DeSandro
*/
!function(t,e){"function"==typeof define&&define.amd?define("jquery-bridget/jquery-bridget",["jquery"],function(i){return e(t,i)}):"object"==typeof module&&module.exports?module.exports=e(t,require("jquery")):t.jQueryBridget=e(t,t.jQuery)}(window,function(t,e){"use strict";function i(i,r,a){function h(t,e,n){var o,r="$()."+i+'("'+e+'")';return t.each(function(t,h){var u=a.data(h,i);if(!u)return void s(i+" not initialized. Cannot call methods, i.e. "+r);var d=u[e];if(!d||"_"==e.charAt(0))return void s(r+" is not a valid method");var l=d.apply(u,n);o=void 0===o?l:o}),void 0!==o?o:t}function u(t,e){t.each(function(t,n){var o=a.data(n,i);o?(o.option(e),o._init()):(o=new r(n,e),a.data(n,i,o))})}a=a||e||t.jQuery,a&&(r.prototype.option||(r.prototype.option=function(t){a.isPlainObject(t)&&(this.options=a.extend(!0,this.options,t))}),a.fn[i]=function(t){if("string"==typeof t){var e=o.call(arguments,1);return h(this,t,e)}return u(this,t),this},n(a))}function n(t){!t||t&&t.bridget||(t.bridget=i)}var o=Array.prototype.slice,r=t.console,s="undefined"==typeof r?function(){}:function(t){r.error(t)};return n(e||t.jQuery),i}),function(t,e){"function"==typeof define&&define.amd?define("ev-emitter/ev-emitter",e):"object"==typeof module&&module.exports?module.exports=e():t.EvEmitter=e()}("undefined"!=typeof window?window:this,function(){function t(){}var e=t.prototype;return e.on=function(t,e){if(t&&e){var i=this._events=this._events||{},n=i[t]=i[t]||[];return-1==n.indexOf(e)&&n.push(e),this}},e.once=function(t,e){if(t&&e){this.on(t,e);var i=this._onceEvents=this._onceEvents||{},n=i[t]=i[t]||{};return n[e]=!0,this}},e.off=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){var n=i.indexOf(e);return-1!=n&&i.splice(n,1),this}},e.emitEvent=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){i=i.slice(0),e=e||[];for(var n=this._onceEvents&&this._onceEvents[t],o=0;oe;e++){var i=h[e];t[i]=0}return t}function n(t){var e=getComputedStyle(t);return e||a("Style returned "+e+". Are you running this code in a hidden iframe on Firefox? See https://bit.ly/getsizebug1"),e}function o(){if(!d){d=!0;var e=document.createElement("div");e.style.width="200px",e.style.padding="1px 2px 3px 4px",e.style.borderStyle="solid",e.style.borderWidth="1px 2px 3px 4px",e.style.boxSizing="border-box";var i=document.body||document.documentElement;i.appendChild(e);var o=n(e);s=200==Math.round(t(o.width)),r.isBoxSizeOuter=s,i.removeChild(e)}}function r(e){if(o(),"string"==typeof e&&(e=document.querySelector(e)),e&&"object"==typeof e&&e.nodeType){var r=n(e);if("none"==r.display)return i();var a={};a.width=e.offsetWidth,a.height=e.offsetHeight;for(var d=a.isBorderBox="border-box"==r.boxSizing,l=0;u>l;l++){var c=h[l],f=r[c],m=parseFloat(f);a[c]=isNaN(m)?0:m}var p=a.paddingLeft+a.paddingRight,g=a.paddingTop+a.paddingBottom,y=a.marginLeft+a.marginRight,v=a.marginTop+a.marginBottom,_=a.borderLeftWidth+a.borderRightWidth,z=a.borderTopWidth+a.borderBottomWidth,E=d&&s,b=t(r.width);b!==!1&&(a.width=b+(E?0:p+_));var x=t(r.height);return x!==!1&&(a.height=x+(E?0:g+z)),a.innerWidth=a.width-(p+_),a.innerHeight=a.height-(g+z),a.outerWidth=a.width+y,a.outerHeight=a.height+v,a}}var s,a="undefined"==typeof console?e:function(t){console.error(t)},h=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"],u=h.length,d=!1;return r}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("desandro-matches-selector/matches-selector",e):"object"==typeof module&&module.exports?module.exports=e():t.matchesSelector=e()}(window,function(){"use strict";var t=function(){var t=window.Element.prototype;if(t.matches)return"matches";if(t.matchesSelector)return"matchesSelector";for(var e=["webkit","moz","ms","o"],i=0;is?"round":"floor";r=Math[a](r),this.cols=Math.max(r,1)},n.getContainerWidth=function(){var t=this._getOption("fitWidth"),i=t?this.element.parentNode:this.element,n=e(i);this.containerWidth=n&&n.innerWidth},n._getItemLayoutPosition=function(t){t.getSize();var e=t.size.outerWidth%this.columnWidth,i=e&&1>e?"round":"ceil",n=Math[i](t.size.outerWidth/this.columnWidth);n=Math.min(n,this.cols);for(var o=this.options.horizontalOrder?"_getHorizontalColPosition":"_getTopColPosition",r=this[o](n,t),s={x:this.columnWidth*r.col,y:r.y},a=r.y+t.size.outerHeight,h=n+r.col,u=r.col;h>u;u++)this.colYs[u]=a;return s},n._getTopColPosition=function(t){var e=this._getTopColGroup(t),i=Math.min.apply(Math,e);return{col:e.indexOf(i),y:i}},n._getTopColGroup=function(t){if(2>t)return this.colYs;for(var e=[],i=this.cols+1-t,n=0;i>n;n++)e[n]=this._getColGroupY(n,t);return e},n._getColGroupY=function(t,e){if(2>e)return this.colYs[t];var i=this.colYs.slice(t,t+e);return Math.max.apply(Math,i)},n._getHorizontalColPosition=function(t,e){var i=this.horizontalColIndex%this.cols,n=t>1&&i+t>this.cols;i=n?0:i;var o=e.size.outerWidth&&e.size.outerHeight;return this.horizontalColIndex=o?i+t:this.horizontalColIndex,{col:i,y:this._getColGroupY(i,t)}},n._manageStamp=function(t){var i=e(t),n=this._getElementOffset(t),o=this._getOption("originLeft"),r=o?n.left:n.right,s=r+i.outerWidth,a=Math.floor(r/this.columnWidth);a=Math.max(0,a);var h=Math.floor(s/this.columnWidth);h-=s%this.columnWidth?0:1,h=Math.min(this.cols-1,h);for(var u=this._getOption("originTop"),d=(u?n.top:n.bottom)+i.outerHeight,l=a;h>=l;l++)this.colYs[l]=Math.max(d,this.colYs[l])},n._getContainerSize=function(){this.maxY=Math.max.apply(Math,this.colYs);var t={height:this.maxY};return this._getOption("fitWidth")&&(t.width=this._getContainerFitWidth()),t},n._getContainerFitWidth=function(){for(var t=0,e=this.cols;--e&&0===this.colYs[e];)t++;return(this.cols-t)*this.columnWidth-this.gutter},n.needsResizeLayout=function(){var t=this.containerWidth;return this.getContainerWidth(),t!=this.containerWidth},i});
// source --> https://totaalonlinemarketing.nl/wp-includes/js/jquery/jquery.masonry.min.js?ver=3.1.2b
/*!
* Masonry v2 shim
* to maintain backwards compatibility
* as of Masonry v3.1.2
*
* Cascading grid layout library
* http://masonry.desandro.com
* MIT License
* by David DeSandro
*/
!function(a){"use strict";var b=a.Masonry;b.prototype._remapV2Options=function(){this._remapOption("gutterWidth","gutter"),this._remapOption("isResizable","isResizeBound"),this._remapOption("isRTL","isOriginLeft",function(a){return!a});var a=this.options.isAnimated;if(void 0!==a&&(this.options.transitionDuration=a?this.options.transitionDuration:0),void 0===a||a){var b=this.options.animationOptions,c=b&&b.duration;c&&(this.options.transitionDuration="string"==typeof c?c:c+"ms")}},b.prototype._remapOption=function(a,b,c){var d=this.options[a];void 0!==d&&(this.options[b]=c?c(d):d)};var c=b.prototype._create;b.prototype._create=function(){var a=this;this._remapV2Options(),c.apply(this,arguments),setTimeout(function(){jQuery(a.element).addClass("masonry")},0)};var d=b.prototype.layout;b.prototype.layout=function(){this._remapV2Options(),d.apply(this,arguments)};var e=b.prototype.option;b.prototype.option=function(){e.apply(this,arguments),this._remapV2Options()};var f=b.prototype._itemize;b.prototype._itemize=function(a){var b=f.apply(this,arguments);return jQuery(a).addClass("masonry-brick"),b};var g=b.prototype.measureColumns;b.prototype.measureColumns=function(){var a=this.options.columnWidth;a&&"function"==typeof a&&(this.getContainerWidth(),this.columnWidth=a(this.containerWidth)),g.apply(this,arguments)},b.prototype.reload=function(){this.reloadItems.apply(this,arguments),this.layout.apply(this)};var h=b.prototype.destroy;b.prototype.destroy=function(){var a=this.getItemElements();jQuery(this.element).removeClass("masonry"),jQuery(a).removeClass("masonry-brick"),h.apply(this,arguments)}}(window);
// source --> https://totaalonlinemarketing.nl/wp-content/plugins/live-composer-page-builder/js/dist/client_frontend.min.js?ver=1.5.8
!function(e){var s={};function t(o){if(s[o])return s[o].exports;var a=s[o]={i:o,l:!1,exports:{}};return e[o].call(a.exports,a,a.exports,t),a.l=!0,a.exports}t.m=e,t.c=s,t.d=function(e,s,o){t.o(e,s)||Object.defineProperty(e,s,{enumerable:!0,get:o})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,s){if(1&s&&(e=t(e)),8&s)return e;if(4&s&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(t.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&s&&"string"!=typeof e)for(var a in e)t.d(o,a,function(s){return e[s]}.bind(null,a));return o},t.n=function(e){var s=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(s,"a",s),s},t.o=function(e,s){return Object.prototype.hasOwnProperty.call(e,s)},t.p="",t(t.s=2)}({2:function(e,s,t){window.dslc_responsive_classes=e=>{void 0===e&&(e=!1);var s=jQuery(window).width(),t=jQuery("body");1!=e&&(t.hasClass("dslc-res-disabled")||jQuery('.dslca-module-edit-options-tab-hook.dslca-active[data-section="responsive"]').length)||(t.removeClass("dslc-res-phone dslc-res-tablet dslc-res-smaller-monitor dslc-res-big"),s>=1024&&s<1280?t.addClass("dslc-res-smaller-monitor"):s>=768&&s<1024?t.addClass("dslc-res-tablet"):s<768?t.addClass("dslc-res-phone"):t.addClass("dslc-res-big"))},window.dslc_init_accordion=()=>{jQuery(".dslc-accordion").each((function(){var e=jQuery(this),s=e.data("open")-1,t=jQuery(".dslc-accordion-item:eq("+s+")",e),o=t.siblings(".dslc-accordion-item"),a=jQuery(".dslc-accordion-item",e);s>=0?(t.addClass("dslc-active"),o.addClass("dslc-inactive"),jQuery(".dslc-accordion-content",o).hide(),jQuery("body").hasClass("dslca-enabled")||o.find(".dslca-icon").removeClass("dslc-icon-minus").addClass("dslc-icon-plus")):(a.addClass("dslc-inactive"),jQuery(".dslc-accordion-content",a).hide(),jQuery("body").hasClass("dslca-enabled")||a.find(".dslca-icon").removeClass("dslc-icon-minus").addClass("dslc-icon-plus"))}))},window.dslc_init_lightbox=()=>{var e;jQuery(".dslc-lightbox-image").each((function(){e="image",(jQuery(this).attr("href").indexOf("youtube.com")>=0||jQuery(this).attr("href").indexOf("vimeo.com")>=0)&&(e="iframe"),jQuery(this).magnificPopup({type:e})})),jQuery(".dslc-lightbox-gallery").each((function(){jQuery(this).magnificPopup({delegate:"a",type:"image",gallery:{enabled:!0},image:{titleSrc:function(e){var s="";return void 0!==e.el.attr("data-caption")&&(s=""+e.el.attr("data-caption")+" "),e.el.attr("title")+s}}})}))},window.dslc_carousel=()=>{jQuery(".dslc-carousel, .dslc-slider").each((function(e){var s,t,o,a,c;s=jQuery(this),(t=s.closest(".dslc-module-front")).imagesLoaded((function(){if(t.closest(".dslc-modules-section").hasClass("dslc-no-columns-spacing"))var e=0;else e=t.width()/100*2.12766/2;s.hasClass("dslc-carousel")&&(s.find(".dslc-col").css({"margin-left":e,"margin-right":e}),s.css({"margin-left":-1*e,width:s.width()+2*e})),o={items:4,pagination:!0,singleItem:!1,itemsScaleUp:!1,slideSpeed:200,paginationSpeed:800,rewindSpeed:1e3,autoPlay:!1,stopOnHover:!1,lazyLoad:!1,lazyFollow:!0,autoHeight:!1,mouseDrag:!0,touchDrag:!0,addClassActive:!0,transitionStyle:"fade",scrollPerPage:!0},a={items:s.data("columns"),pagination:s.data("pagination"),itemsScaleUp:s.data("scale-up"),slideSpeed:s.data("slide-speed"),paginationSpeed:s.data("pagination-speed"),rewindSpeed:s.data("rewind-speed"),autoPlay:s.data("autoplay"),stopOnHover:s.data("stop-on-hover"),lazyLoad:s.data("lazy-load"),lazyFollow:s.data("lazy-follow"),autoHeight:s.data("flexible-height"),mouseDrag:s.data("mouse-drag"),touchDrag:s.data("touch-drag"),addClassActive:s.data("active-class"),transitionStyle:s.data("animation"),scrollPerPage:s.data("scroll-per-page")},c=jQuery.extend({},o,a),(s.hasClass("dslc-slider")||1==c.items)&&(c.singleItem=!0),0==c.autoPlay&&(c.autoPlay=!1),s.owlCarousel({items:c.items,pagination:c.pagination,singleItem:c.singleItem,itemsScaleUp:c.itemsScaleUp,slideSpeed:c.slideSpeed,paginationSpeed:c.paginationSpeed,rewindSpeed:c.rewindSpeed,autoPlay:c.autoPlay,stopOnHover:c.stopOnHover,lazyLoad:c.lazyLoad,lazyFollow:c.lazyFollow,mouseDrag:c.mouseDrag,touchDrag:c.touchDrag,scrollPerPage:c.scrollPerPage,transitionStyle:c.transitionStyle,autoHeight:c.autoHeight,itemsDesktop:!1,itemsDesktopSmall:!1,itemsTablet:!1,itemsMobile:[766,1],afterInit:function(){s.prev(".dslc-loader").remove(),s.css({opacity:1,maxHeight:"none"})},afterAction:function(){var e=this.owl.visibleItems;s.find(".dslc-carousel-item-visible").removeClass("dslc-carousel-item-visible"),s.find(".owl-item").filter((function(s){return e.indexOf(s)>-1})).addClass("dslc-carousel-item-visible")}}),jQuery(".dslc-carousel-nav-next",t).click((function(e){e.preventDefault(),s.data("owlCarousel").next()})),jQuery(".dslc-carousel-nav-prev",t).click((function(e){e.preventDefault(),s.data("owlCarousel").prev()}))}))}))},window.dslc_carousel_responsive=()=>{jQuery(".dslc-carousel").each((function(){var e,s;if(s=(e=jQuery(this)).closest(".dslc-module-front"),e.css({"margin-left":0,width:"auto"}),s.closest(".dslc-modules-section").hasClass("dslc-no-columns-spacing"))var t=0;else t=s.width()/100*2.12766/2;e.hasClass("dslc-carousel")&&(e.find(".dslc-col").css({"margin-left":t,"margin-right":t}),e.css({"margin-left":-1*t,width:e.width()+2*t}))}))},window.dslc_bg_video=()=>{jQuery(".dslc-bg-video").each((function(){jQuery(this).find("video").length||jQuery(this).css({opacity:1})})),jQuery(".dslc-bg-video video").mediaelementplayer({loop:!0,pauseOtherPlayers:!1,success:function(e,s){e.addEventListener("loadeddata",(function(e){jQuery(s).closest(".dslc-bg-video").animate({opacity:1},400)})),e.play()}})},window.dslc_parallax=()=>{jQuery(".dslc-init-parallax").each((function(){var e=jQuery(this);e.imagesLoaded({background:!0},(function(){var s=e.css("background-position").split(" ")[0]+" "+-1*(window.pageYOffset-e.offset().top)/4+"px";e.css({backgroundPosition:s})}))})),window.onscroll=function(){jQuery(".dslc-init-parallax").each((function(){var e=jQuery(this).css("background-position").split(" ")[0]+" "+-1*(window.pageYOffset-jQuery(this).offset().top)/4+"px";jQuery(this).css({backgroundPosition:e})}))}},window.dslc_masonry=(e,s)=>{e=void 0!==e?e:jQuery("body"),s=void 0!==s&&s,jQuery(".dslc-init-masonry",e).each((function(){var e,t,o,a;e=jQuery(this).find(".dslc-posts-inner").length?jQuery(this).find(".dslc-posts-inner"):jQuery(this),t=".dslc-masonry-item",jQuery(t,e).width(),o=jQuery(e).width(),a=jQuery(this).closest(".dslc-modules-section").hasClass("dslc-no-columns-spacing")?0:o/100*2.05,e.data("masonry")?jQuery(e).imagesLoaded((function(){jQuery(e).masonry("destroy").masonry({gutter:a,itemSelector:t}),jQuery(e).find(".dslc-post:not(.dslc-masonry-item)").hide(),s&&jQuery(t,e).css({scale:"0.2"}).animate({scale:"1"},500)})):(jQuery(t).css({marginRight:0}),jQuery(e).imagesLoaded((function(){jQuery(e).masonry({gutter:a,itemSelector:t})})))}))},window.dslc_tabs_generate_code=e=>{var s=e.closest(".dslc-module-front");dslcTabsNav=jQuery(".dslc-tabs-nav",e),dslcTabsContent=jQuery(".dslc-tabs-content",e),dslcTabContent=jQuery(".dslc-tabs-tab-content",e);var t="",o="",a=0,c=0;jQuery(".dslc-tabs-nav-hook",dslcTabsNav).each((function(){++a>1&&(t+=" (dslc_sep) "),t+=jQuery(this).find(".dslc-tabs-nav-hook-title").text()})),dslcTabContent.each((function(){++c>1&&(o+=" (dslc_sep) "),o+=jQuery(this).find(".dslca-tab-plain-content").val()})),o=o.replace(/
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
/** math-expression-evaluator version 1.2.16
Dated:2017-02-02 */
!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.mexp=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g"+b.value+""+e[f].show+""+a.value+" ",type:10}):d.push({value:(1!=b.type?"(":"")+b.value+(1!=b.type?")":"")+""+a.value+" ",type:1})):2===e[f].type||9===e[f].type?(a=d.pop(),b=d.pop(),d.push({value:(1!=b.type?"(":"")+b.value+(1!=b.type?")":"")+e[f].show+(1!=a.type?"(":"")+a.value+(1!=a.type?")":""),type:e[f].type})):12===e[f].type&&(a=d.pop(),b=d.pop(),c=d.pop(),d.push({value:e[f].show+"("+c.value+","+b.value+","+a.value+")",type:12}));return d[0].value},b.exports=d},{"./postfix_evaluator.js":5}],2:[function(a,b,c){function d(a,b){for(var c=0;cs.length-2?s.length-1:x.length-i;t>0;t--)for(u=0;uc)h.push(a);else{for(;c>=e&&!k||k&&e1)throw new d.exception("Uncaught Syntax error");return f[0].value>1e15?"Infinity":Number(f[0].value.toFixed(15)).toPrecision()},d.eval=function(a,b,c){return"undefined"==typeof b?this.lex(a).toPostfix().postfixEval():"undefined"==typeof c?"undefined"!=typeof b.length?this.lex(a,b).toPostfix().postfixEval():this.lex(a).toPostfix().postfixEval(b):this.lex(a,b).toPostfix().postfixEval(c)},b.exports=d},{"./postfix.js":4}]},{},[1])(1)});
// TODO: Fix error collecting.
//window.onerror = function(message, url, lineNumber) {
// var data;
//
// data = {
// 'action': 'nf_log_js_error',
// 'security': nfFrontEnd.ajaxNonce,
// 'message': message,
// 'url': url,
// 'lineNumber': lineNumber
// };
//
// jQuery.ajax({
// url: nfFrontEnd.adminAjax,
// type: 'POST',
// data: data,
// cache: false,
// success: function( data, textStatus, jqXHR ) {
// try {
//
// } catch( e ) {
// console.log( e );
// console.log( 'Parse Error' );
// console.log( e );
// }
//
// },
// error: function( jqXHR, textStatus, errorThrown ) {
// // Handle errors here
// console.log('ERRORS: ' + errorThrown);
// console.log( jqXHR );
//
// try {
//
// } catch( e ) {
// console.log( 'Parse Error' );
// }
// }
// });
// return false;
//};
var nfRadio = Backbone.Radio;
nfRadio.channel( 'form' ).on( 'render:view', function() {
jQuery( '.g-recaptcha' ).each( function() {
var callback = jQuery( this ).data( 'callback' );
var fieldID = jQuery( this ).data( 'fieldid' );
if ( typeof window[ callback ] !== 'function' ){
window[ callback ] = function( response ) {
nfRadio.channel( 'recaptcha' ).request( 'update:response', response, fieldID );
};
}
} );
} );
var nfRecaptcha = Marionette.Object.extend( {
initialize: function() {
/*
* If we've already rendered our form view, render our recaptcha fields.
*/
if ( 0 != jQuery( '.g-recaptcha' ).length ) {
this.renderCaptcha();
}
/*
* We haven't rendered our form view, so hook into the view render radio message, and then render.
*/
this.listenTo( nfRadio.channel( 'form' ), 'render:view', this.renderCaptcha );
this.listenTo( nfRadio.channel( 'captcha' ), 'reset', this.renderCaptcha );
},
renderCaptcha: function() {
jQuery( '.g-recaptcha' ).each( function() {
var opts = {
fieldid: jQuery( this ).data( 'fieldid' ),
size: jQuery( this ).data( 'size' ),
theme: jQuery( this ).data( 'theme' ),
sitekey: jQuery( this ).data( 'sitekey' ),
callback: jQuery( this ).data( 'callback' )
};
var grecaptchaID = grecaptcha.render( jQuery( this )[0], opts );
if ( opts.size === 'invisible' ) {
try {
grecaptcha.execute( grecaptchaID );
} catch( e ){
console.log( 'Notice: Error trying to execute grecaptcha.' );
}
}
} );
}
} );
var nfRenderRecaptcha = function() {
new nfRecaptcha();
};
// source --> https://totaalonlinemarketing.nl/wp-content/plugins/ninja-forms/assets/js/min/front-end.js?ver=3.4.34.2
(function () {
/**
* @license almond 0.3.1 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved.
* Available via the MIT or new BSD license.
* see: http://github.com/jrburke/almond for details
*/
//Going sloppy to avoid 'use strict' string cost, but strict practices should
//be followed.
/*jslint sloppy: true */
/*global setTimeout: false */
var requirejs, require, define;
(function (undef) {
var main, req, makeMap, handlers,
defined = {},
waiting = {},
config = {},
defining = {},
hasOwn = Object.prototype.hasOwnProperty,
aps = [].slice,
jsSuffixRegExp = /\.js$/;
function hasProp(obj, prop) {
return hasOwn.call(obj, prop);
}
/**
* Given a relative module name, like ./something, normalize it to
* a real name that can be mapped to a path.
* @param {String} name the relative name
* @param {String} baseName a real name that the name arg is relative
* to.
* @returns {String} normalized name
*/
function normalize(name, baseName) {
var nameParts, nameSegment, mapValue, foundMap, lastIndex,
foundI, foundStarMap, starI, i, j, part,
baseParts = baseName && baseName.split("/"),
map = config.map,
starMap = (map && map['*']) || {};
//Adjust any relative paths.
if (name && name.charAt(0) === ".") {
//If have a base name, try to normalize against it,
//otherwise, assume it is a top-level require that will
//be relative to baseUrl in the end.
if (baseName) {
name = name.split('/');
lastIndex = name.length - 1;
// Node .js allowance:
if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) {
name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, '');
}
//Lop off the last part of baseParts, so that . matches the
//"directory" and not name of the baseName's module. For instance,
//baseName of "one/two/three", maps to "one/two/three.js", but we
//want the directory, "one/two" for this normalization.
name = baseParts.slice(0, baseParts.length - 1).concat(name);
//start trimDots
for (i = 0; i < name.length; i += 1) {
part = name[i];
if (part === ".") {
name.splice(i, 1);
i -= 1;
} else if (part === "..") {
if (i === 1 && (name[2] === '..' || name[0] === '..')) {
//End of the line. Keep at least one non-dot
//path segment at the front so it can be mapped
//correctly to disk. Otherwise, there is likely
//no path mapping for a path starting with '..'.
//This can still fail, but catches the most reasonable
//uses of ..
break;
} else if (i > 0) {
name.splice(i - 1, 2);
i -= 2;
}
}
}
//end trimDots
name = name.join("/");
} else if (name.indexOf('./') === 0) {
// No baseName, so this is ID is resolved relative
// to baseUrl, pull off the leading dot.
name = name.substring(2);
}
}
//Apply map config if available.
if ((baseParts || starMap) && map) {
nameParts = name.split('/');
for (i = nameParts.length; i > 0; i -= 1) {
nameSegment = nameParts.slice(0, i).join("/");
if (baseParts) {
//Find the longest baseName segment match in the config.
//So, do joins on the biggest to smallest lengths of baseParts.
for (j = baseParts.length; j > 0; j -= 1) {
mapValue = map[baseParts.slice(0, j).join('/')];
//baseName segment has config, find if it has one for
//this name.
if (mapValue) {
mapValue = mapValue[nameSegment];
if (mapValue) {
//Match, update name to the new value.
foundMap = mapValue;
foundI = i;
break;
}
}
}
}
if (foundMap) {
break;
}
//Check for a star map match, but just hold on to it,
//if there is a shorter segment match later in a matching
//config, then favor over this star map.
if (!foundStarMap && starMap && starMap[nameSegment]) {
foundStarMap = starMap[nameSegment];
starI = i;
}
}
if (!foundMap && foundStarMap) {
foundMap = foundStarMap;
foundI = starI;
}
if (foundMap) {
nameParts.splice(0, foundI, foundMap);
name = nameParts.join('/');
}
}
return name;
}
function makeRequire(relName, forceSync) {
return function () {
//A version of a require function that passes a moduleName
//value for items that may need to
//look up paths relative to the moduleName
var args = aps.call(arguments, 0);
//If first arg is not require('string'), and there is only
//one arg, it is the array form without a callback. Insert
//a null so that the following concat is correct.
if (typeof args[0] !== 'string' && args.length === 1) {
args.push(null);
}
return req.apply(undef, args.concat([relName, forceSync]));
};
}
function makeNormalize(relName) {
return function (name) {
return normalize(name, relName);
};
}
function makeLoad(depName) {
return function (value) {
defined[depName] = value;
};
}
function callDep(name) {
if (hasProp(waiting, name)) {
var args = waiting[name];
delete waiting[name];
defining[name] = true;
main.apply(undef, args);
}
if (!hasProp(defined, name) && !hasProp(defining, name)) {
throw new Error('No ' + name);
}
return defined[name];
}
//Turns a plugin!resource to [plugin, resource]
//with the plugin being undefined if the name
//did not have a plugin prefix.
function splitPrefix(name) {
var prefix,
index = name ? name.indexOf('!') : -1;
if (index > -1) {
prefix = name.substring(0, index);
name = name.substring(index + 1, name.length);
}
return [prefix, name];
}
/**
* Makes a name map, normalizing the name, and using a plugin
* for normalization if necessary. Grabs a ref to plugin
* too, as an optimization.
*/
makeMap = function (name, relName) {
var plugin,
parts = splitPrefix(name),
prefix = parts[0];
name = parts[1];
if (prefix) {
prefix = normalize(prefix, relName);
plugin = callDep(prefix);
}
//Normalize according
if (prefix) {
if (plugin && plugin.normalize) {
name = plugin.normalize(name, makeNormalize(relName));
} else {
name = normalize(name, relName);
}
} else {
name = normalize(name, relName);
parts = splitPrefix(name);
prefix = parts[0];
name = parts[1];
if (prefix) {
plugin = callDep(prefix);
}
}
//Using ridiculous property names for space reasons
return {
f: prefix ? prefix + '!' + name : name, //fullName
n: name,
pr: prefix,
p: plugin
};
};
function makeConfig(name) {
return function () {
return (config && config.config && config.config[name]) || {};
};
}
handlers = {
require: function (name) {
return makeRequire(name);
},
exports: function (name) {
var e = defined[name];
if (typeof e !== 'undefined') {
return e;
} else {
return (defined[name] = {});
}
},
module: function (name) {
return {
id: name,
uri: '',
exports: defined[name],
config: makeConfig(name)
};
}
};
main = function (name, deps, callback, relName) {
var cjsModule, depName, ret, map, i,
args = [],
callbackType = typeof callback,
usingExports;
//Use name if no relName
relName = relName || name;
//Call the callback to define the module, if necessary.
if (callbackType === 'undefined' || callbackType === 'function') {
//Pull out the defined dependencies and pass the ordered
//values to the callback.
//Default to [require, exports, module] if no deps
deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps;
for (i = 0; i < deps.length; i += 1) {
map = makeMap(deps[i], relName);
depName = map.f;
//Fast path CommonJS standard dependencies.
if (depName === "require") {
args[i] = handlers.require(name);
} else if (depName === "exports") {
//CommonJS module spec 1.1
args[i] = handlers.exports(name);
usingExports = true;
} else if (depName === "module") {
//CommonJS module spec 1.1
cjsModule = args[i] = handlers.module(name);
} else if (hasProp(defined, depName) ||
hasProp(waiting, depName) ||
hasProp(defining, depName)) {
args[i] = callDep(depName);
} else if (map.p) {
map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {});
args[i] = defined[depName];
} else {
throw new Error(name + ' missing ' + depName);
}
}
ret = callback ? callback.apply(defined[name], args) : undefined;
if (name) {
//If setting exports via "module" is in play,
//favor that over return value and exports. After that,
//favor a non-undefined return value over exports use.
if (cjsModule && cjsModule.exports !== undef &&
cjsModule.exports !== defined[name]) {
defined[name] = cjsModule.exports;
} else if (ret !== undef || !usingExports) {
//Use the return value from the function.
defined[name] = ret;
}
}
} else if (name) {
//May just be an object definition for the module. Only
//worry about defining if have a module name.
defined[name] = callback;
}
};
requirejs = require = req = function (deps, callback, relName, forceSync, alt) {
if (typeof deps === "string") {
if (handlers[deps]) {
//callback in this case is really relName
return handlers[deps](callback);
}
//Just return the module wanted. In this scenario, the
//deps arg is the module name, and second arg (if passed)
//is just the relName.
//Normalize module name, if it contains . or ..
return callDep(makeMap(deps, callback).f);
} else if (!deps.splice) {
//deps is a config object, not an array.
config = deps;
if (config.deps) {
req(config.deps, config.callback);
}
if (!callback) {
return;
}
if (callback.splice) {
//callback is an array, which means it is a dependency list.
//Adjust args if there are dependencies
deps = callback;
callback = relName;
relName = null;
} else {
deps = undef;
}
}
//Support require(['a'])
callback = callback || function () {};
//If relName is a function, it is an errback handler,
//so remove it.
if (typeof relName === 'function') {
relName = forceSync;
forceSync = alt;
}
//Simulate async callback;
if (forceSync) {
main(undef, deps, callback, relName);
} else {
//Using a non-zero value because of concern for what old browsers
//do, and latest browsers "upgrade" to 4 if lower value is used:
//http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout:
//If want a value immediately, use require('id') instead -- something
//that works in almond on the global level, but not guaranteed and
//unlikely to work in other AMD implementations.
setTimeout(function () {
main(undef, deps, callback, relName);
}, 4);
}
return req;
};
/**
* Just drops the config on the floor, but returns req in case
* the config return value is used.
*/
req.config = function (cfg) {
return req(cfg);
};
/**
* Expose module registry for debugging and tooling
*/
requirejs._defined = defined;
define = function (name, deps, callback) {
if (typeof name !== 'string') {
throw new Error('See almond README: incorrect module build, no module name');
}
//This module may not have dependencies
if (!deps.splice) {
//deps is not an array, so probably means
//an object literal or factory function for
//the value. Adjust args.
callback = deps;
deps = [];
}
if (!hasProp(defined, name) && !hasProp(waiting, name)) {
waiting[name] = [name, deps, callback];
}
};
define.amd = {
jQuery: true
};
}());
define("../lib/almond", function(){});
define( 'models/fieldErrorModel',[], function() {
var model = Backbone.Model.extend( {
} );
return model;
} );
define( 'models/fieldErrorCollection',['models/fieldErrorModel'], function( errorModel ) {
var collection = Backbone.Collection.extend( {
model: errorModel
} );
return collection;
} );
define( 'models/fieldModel',['models/fieldErrorCollection'], function( fieldErrorCollection ) {
var model = Backbone.Model.extend( {
defaults: {
placeholder: '',
value: '',
label_pos: '',
classes: 'ninja-forms-field',
reRender: false,
mirror_field: false,
confirm_field: false,
clean: true,
disabled: '',
visible: true,
invalid: false
},
initialize: function() {
var type = this.get('type');
this.set( 'formID', this.collection.options.formModel.get( 'id' ) );
this.listenTo( nfRadio.channel( 'form-' + this.get( 'formID' ) ), 'reset', this.resetModel );
this.bind( 'change', this.changeModel, this );
this.bind( 'change:value', this.changeValue, this );
this.set( 'errors', new fieldErrorCollection() );
if (type === 'listimage') {
this.get = this.listimageGet;
this.set = this.listimageSet;
}
/*
* Trigger an init event on two channels:
*
* fields
* field-type
*
* This lets specific field types modify model attributes before anything uses them.
*/
nfRadio.channel( 'fields' ).trigger( 'init:model', this );
nfRadio.channel( this.get( 'type' ) ).trigger( 'init:model', this );
nfRadio.channel( 'fields-' + this.get( 'type' ) ).trigger( 'init:model', this );
if( 'undefined' != this.get( 'parentType' ) ){
nfRadio.channel( this.get( 'parentType' ) ).trigger( 'init:model', this );
}
/*
* When we load our form, fire another event for this field.
*/
this.listenTo( nfRadio.channel( 'form-' + this.get( 'formID' ) ), 'loaded', this.formLoaded );
/*
* Before we submit our form, send out a message so that this field can be modified if necessary.
*/
this.listenTo( nfRadio.channel( 'form-' + this.get( 'formID' ) ), 'before:submit', this.beforeSubmit );
},
listimageGet: function(attr) {
if(attr === 'options') {
attr = 'image_options';
}
return Backbone.Model.prototype.get.call(this, attr);
},
listimageSet: function(attributes, options) {
if ('options' === attributes) {
attributes = 'image_options';
}
return Backbone.Model.prototype.set.call(this, attributes, options);
},
changeModel: function() {
nfRadio.channel( 'field-' + this.get( 'id' ) ).trigger( 'change:model', this );
nfRadio.channel( this.get( 'type' ) ).trigger( 'change:model', this );
nfRadio.channel( 'fields' ).trigger( 'change:model', this );
},
changeValue: function() {
nfRadio.channel( 'field-' + this.get( 'id' ) ).trigger( 'change:modelValue', this );
nfRadio.channel( this.get( 'type' ) ).trigger( 'change:modelValue', this );
nfRadio.channel( 'fields' ).trigger( 'change:modelValue', this );
},
addWrapperClass: function( cl ) {
this.set( 'addWrapperClass', cl );
},
removeWrapperClass: function( cl ) {
this.set( 'removeWrapperClass', cl );
},
setInvalid: function( invalid ) {
this.set( 'invalid', invalid );
},
formLoaded: function() {
nfRadio.channel( 'fields' ).trigger( 'formLoaded', this );
nfRadio.channel( 'fields-' + this.get( 'type' ) ).trigger( 'formLoaded', this );
},
beforeSubmit: function( formModel ) {
nfRadio.channel( this.get( 'type' ) ).trigger( 'before:submit', this );
nfRadio.channel( 'fields' ).trigger( 'before:submit', this );
}
} );
return model;
} );
define( 'models/fieldCollection',['models/fieldModel'], function( fieldModel ) {
var collection = Backbone.Collection.extend( {
model: fieldModel,
comparator: 'order',
initialize: function( models, options ) {
this.options = options;
this.on( 'reset', function( fieldCollection ){
nfRadio.channel( 'fields' ).trigger( 'reset:collection', fieldCollection );
}, this );
},
validateFields: function() {
_.each( this.models, function( fieldModel ) {
// added here for help with multi-part part validation
fieldModel.set( 'clean', false );
nfRadio.channel( 'submit' ).trigger( 'validate:field', fieldModel );
}, this );
},
showFields: function() {
this.invoke( 'set', { visible: true } );
this.invoke( function() {
this.trigger( 'change:value', this );
});
},
hideFields: function() {
this.invoke( 'set', { visible: false } );
this.invoke( function() {
this.trigger( 'change:value', this );
});
}
} );
return collection;
} );
define( 'models/formErrorModel',[], function() {
var model = Backbone.Model.extend( {
} );
return model;
} );
define( 'models/formErrorCollection',['models/formErrorModel'], function( errorModel ) {
var collection = Backbone.Collection.extend( {
model: errorModel
} );
return collection;
} );
define( 'models/formModel',[
'models/fieldCollection',
'models/formErrorCollection'
], function(
FieldCollection,
ErrorCollection
) {
var model = Backbone.Model.extend({
defaults: {
beforeForm: '',
afterForm: '',
beforeFields: '',
afterFields: '',
wrapper_class: '',
element_class: '',
hp: '',
fieldErrors: {},
extra: {}
},
initialize: function() {
// Loop over settings and map to attributes
_.each( this.get( 'settings' ), function( value, setting ) {
this.set( setting, value );
}, this );
this.set( 'loadedFields', this.get( 'fields' ) );
this.set( 'fields', new FieldCollection( this.get( 'fields' ), { formModel: this } ) );
this.set( 'errors', new ErrorCollection() );
/*
* Send out a radio message so that anyone who wants to filter our content data can register their filters.
*/
nfRadio.channel( 'form' ).trigger( 'before:filterData', this );
/*
* Set our formContentData to our form setting 'formContentData'
*/
var formContentData = this.get( 'formContentData' );
/*
* The formContentData variable used to be fieldContentsData.
* If we don't have a 'formContentData' setting, check to see if we have an old 'fieldContentsData'.
*
* TODO: This is for backwards compatibility and should be removed eventually.
*/
if ( ! formContentData ) {
formContentData = this.get( 'fieldContentsData' );
}
var formContentLoadFilters = nfRadio.channel( 'formContent' ).request( 'get:loadFilters' );
/*
* Get our first filter, this will be the one with the highest priority.
*/
var sortedArray = _.without( formContentLoadFilters, undefined );
var callback = _.first( sortedArray );
formContentData = callback( formContentData, this, this );
this.set( 'formContentData', formContentData );
nfRadio.channel( 'forms' ).trigger( 'init:model', this );
nfRadio.channel( 'form-' + this.get( 'id' ) ).trigger( 'init:model', this );
// Fields
nfRadio.channel( 'form-' + this.get( 'id' ) ).reply( 'get:fieldByKey', this.getFieldByKey, this );
// Form Errors
nfRadio.channel( 'form-' + this.get( 'id' ) ).reply( 'add:error', this.addError, this );
nfRadio.channel( 'form-' + this.get( 'id' ) ).reply( 'remove:error', this.removeError, this );
// Extra Data
nfRadio.channel( 'form-' + this.get( 'id' ) ).reply( 'get:extra', this.getExtra, this );
nfRadio.channel( 'form-' + this.get( 'id' ) ).reply( 'add:extra', this.addExtra, this );
nfRadio.channel( 'form-' + this.get( 'id' ) ).reply( 'remove:extra', this.removeExtra, this );
// Respond to requests to get this model.
nfRadio.channel( 'form-' + this.get( 'id' ) ).reply( 'get:form', this.getForm, this );
nfRadio.channel( 'form' ).trigger( 'loaded', this );
nfRadio.channel( 'form' ).trigger( 'after:loaded', this );
nfRadio.channel( 'form-' + this.get( 'id' ) ).trigger( 'loaded', this );
},
/*
|--------------------------------------------------------------------------
| Fields
|--------------------------------------------------------------------------
*/
getFieldByKey: function( key ) {
return this.get( 'fields' ).findWhere( { key: key } );
},
/*
|--------------------------------------------------------------------------
| Form Errors
|--------------------------------------------------------------------------
*/
addError: function( id, msg ) {
var errors = this.get( 'errors' );
errors.add( { id: id, msg: msg } );
nfRadio.channel( 'form-' + this.get( 'id' ) ).trigger( 'add:error', this, id, msg );
},
removeError: function( id ) {
var errors = this.get( 'errors' );
var errorModel = errors.get( id );
errors.remove( errorModel );
nfRadio.channel( 'form-' + this.get( 'id' ) ).trigger( 'remove:error', this, id );
},
/*
|--------------------------------------------------------------------------
| Extra Data
|--------------------------------------------------------------------------
*/
getExtra: function( key ) {
var extraData = this.get( 'extra' );
if( 'undefined' == typeof key ) return extraData;
return extraData[ key ];
},
addExtra: function( key, value ) {
var extraData = this.get( 'extra' );
extraData[ key ] = value;
nfRadio.channel( 'form-' + this.get( 'id' ) ).trigger( 'add:extra', this, key, value );
},
removeExtra: function( key ) {
var extraData = this.get( 'extra' );
delete extraData[ key ];
nfRadio.channel( 'form-' + this.get( 'id' ) ).trigger( 'remove:extra', this, key );
},
/*
|--------------------------------------------------------------------------
| Get this form
|--------------------------------------------------------------------------
*/
getForm: function() {
return this;
}
} );
return model;
} );
define( 'models/formCollection',['models/formModel'], function( formModel ) {
var collection = Backbone.Collection.extend( {
model: formModel
} );
return collection;
} );
/*
* Handles setting up our form.
*
* Holds a collection of our fields.
* Replies to requests for field data.
* Updates field models.
*/
define('controllers/formData',['models/formModel', 'models/formCollection', 'models/fieldCollection', 'models/formErrorCollection'], function( FormModel, FormCollection, FieldCollection, ErrorCollection ) {
var controller = Marionette.Object.extend( {
initialize: function() {
/*
* Setup our field collections.
*/
var that = this;
/*
* Initialize our form collection (incase we have multiple forms on the page)
*/
this.collection = new FormCollection( nfForms );
nfRadio.channel( 'forms' ).trigger( 'loaded', this.collection );
nfRadio.channel( 'app' ).trigger( 'forms:loaded', this.collection );
nfRadio.channel( 'app' ).reply( 'get:form', this.getForm, this );
nfRadio.channel( 'app' ).reply( 'get:forms', this.getForms, this );
nfRadio.channel( 'fields' ).reply( 'get:field', this.getField, this );
},
getForm: function( id ) {
return this.collection.get( id );
},
getForms: function() {
return this.collection;
},
getField: function( id ) {
var model = false;
_.each( this.collection.models, function( form ) {
if ( ! model ) {
model = form.get( 'fields' ).get( id );
}
} );
return model;
}
});
return controller;
} );
define('controllers/fieldError',['models/fieldErrorModel'], function( fieldErrorModel ) {
var controller = Marionette.Object.extend( {
initialize: function() {
nfRadio.channel( 'fields' ).reply( 'add:error', this.addError );
nfRadio.channel( 'fields' ).reply( 'remove:error', this.removeError );
nfRadio.channel( 'fields' ).reply( 'get:error', this.getError );
},
addError: function( targetID, id, msg ) {
var model = nfRadio.channel( 'fields' ).request( 'get:field', targetID );
if( 'undefined' == typeof model ) return;
var errors = model.get( 'errors' );
errors.add( { 'id': id, 'msg' : msg } );
model.set( 'errors', errors );
model.trigger( 'change:errors', model );
model.set( 'clean', false );
nfRadio.channel( 'fields' ).trigger( 'add:error', model, id, msg );
},
removeError: function( targetID, id ) {
var model = nfRadio.channel( 'fields' ).request( 'get:field', targetID );
if( 'undefined' == typeof model ) return;
var errors = model.get( 'errors' );
var targetError = errors.get( id );
if ( 'undefined' != typeof targetError ) {
errors.remove( targetError );
model.set( 'errors', errors );
model.trigger( 'change:errors', model );
nfRadio.channel( 'fields' ).trigger( 'remove:error', model, id );
}
},
getError: function( targetID, id ) {
var model = nfRadio.channel( 'fields' ).request( 'get:field', targetID );
var errors = model.get( 'errors' );
var targetError = errors.get( id );
if ( 'undefined' != targetError ) {
return targetError;
} else {
return false;
}
}
});
return controller;
} );
/**
* Controller responsible for replying to a Radio request stating that a field has been changed.
*
* This controller sends out a message to the field-specific channel, the field type channel,
* and the public fields channel so that the data model can be updated.
*/
define('controllers/changeField',[], function() {
var controller = Marionette.Object.extend( {
initialize: function() {
/*
* Reply to our request for changing a field.
*/
nfRadio.channel( 'nfAdmin' ).reply( 'change:field', this.changeField );
/*
* If we blur our field, set the model attribute of 'clean' to false.
* 'clean' tracks whether or not the user has every interacted with this element.
* Some validation, like required, uses this to decide whether or not to add an error.
*/
this.listenTo( nfRadio.channel( 'fields' ), 'blur:field', this.blurField );
},
changeField: function( el, model ) {
// Get our current value.
var value = nfRadio.channel( model.get( 'type' ) ).request( 'before:updateField', el, model );
value = ( 'undefined' != typeof value ) ? value : nfRadio.channel( model.get( 'parentType' ) ).request( 'before:updateField', el, model );
value = ( 'undefined' != typeof value ) ? value : jQuery( el ).val();
// Set our 'isUpdated' flag to false.
model.set( 'isUpdated', false );
// Set our 'clean' flag to false.
model.set( 'clean', false );
/*
* Send out a message saying that we've changed a field.
* The first channel is field id/key specific.
* The second channel is the field type, i.e. text, email, radio
* The third channel is a generic 'field' channel.
*
* If the submitted value you wish to store in the data model isn't the same as the value received above,
* you can set that model in the actions below and set the 'isUpdated' model attribute to true.
* i.e. model.set( 'isUpdated', true );
*/
nfRadio.channel( 'field-' + model.get( 'id' ) ).trigger( 'change:field', el, model );
nfRadio.channel( model.get( 'type' ) ).trigger( 'change:field', el, model );
nfRadio.channel( 'fields' ).trigger( 'change:field', el, model );
/*
* Send a request out on our nfAdmin channel to update our field model.
* If the field model has a 'isUpdated' property of false, nothing will be updated.
*/
nfRadio.channel( 'nfAdmin' ).request( 'update:field', model, value );
},
blurField: function( el, model ) {
// Set our 'clean' flag to false.
model.set( 'clean', false );
}
});
return controller;
} );
define('controllers/changeEmail',[], function() {
var radioChannel = nfRadio.channel( 'email' );
// var emailReg = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
var emailReg = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
var errorID = 'invalid-email';
var controller = Marionette.Object.extend( {
initialize: function() {
this.listenTo( radioChannel, 'change:modelValue', this.onChangeModelValue );
this.listenTo( radioChannel, 'keyup:field', this.emailKeyup );
this.listenTo( radioChannel, 'blur:field', this.onBlurField );
},
onChangeModelValue: function( model ) {
var value = model.get( 'value' );
var fieldID = model.get( 'id' );
this.emailChange( value, fieldID );
},
onBlurField: function( el, model ) {
var value = jQuery( el ).val();
var fieldID = model.get( 'id' );
this.emailChange( value, fieldID );
},
emailChange: function( value, fieldID ) {
if ( 0 < value.length ) {
if( emailReg.test( value ) ) {
nfRadio.channel( 'fields' ).request( 'remove:error', fieldID, errorID );
} else {
var fieldModel = nfRadio.channel( 'fields' ).request( 'get:field', fieldID );
var formModel = nfRadio.channel( 'app' ).request( 'get:form', fieldModel.get( 'formID' ) );
nfRadio.channel( 'fields' ).request( 'add:error', fieldID, errorID, formModel.get( 'settings' ).changeEmailErrorMsg );
}
} else {
nfRadio.channel( 'fields' ).request( 'remove:error', fieldID, errorID );
}
},
/**
* When a user types inside of an email field, track their keypresses and add the appropriate class.
* If the value validates as an email, add a class of nf-pass
* If the value does not validate as email, add a class of nf-fail
*
* @since 3.0
* @param {object} el Element that triggered the keyup event.
* @param {object} model Model connected to the element that triggered the event
* @return {void}
*/
emailKeyup: function( el, model, keyCode ) {
/*
* If we pressed the 'tab' key to get to this field, return false.
*/
if ( 9 == keyCode ) {
return false;
}
/*
* Get the current value from our element.
*/
var value = jQuery( el ).val();
/*
* Get our current ID
*/
var fieldID = model.get( 'id' );
/*
* Check our value to see if it is a valid email.
*/
if ( 0 == value.length ) {
nfRadio.channel( 'fields' ).request( 'remove:error', fieldID, errorID );
} else if ( ! emailReg.test( value ) && ! model.get( 'clean' ) ) {
var fieldModel = nfRadio.channel( 'fields' ).request( 'get:field', fieldID );
var formModel = nfRadio.channel( 'app' ).request( 'get:form', fieldModel.get( 'formID' ) );
nfRadio.channel( 'fields' ).request( 'add:error', fieldID, errorID, formModel.get( 'settings' ).changeEmailErrorMsg );
model.removeWrapperClass( 'nf-pass' );
} else if ( emailReg.test( value ) ) {
nfRadio.channel( 'fields' ).request( 'remove:error', fieldID, errorID );
/*
* Add nf-pass class to the wrapper.
*/
model.addWrapperClass( 'nf-pass' );
model.set( 'clean', false );
}
}
});
return controller;
} );
define('controllers/changeDate',[], function() {
var radioChannel = nfRadio.channel( 'date' );
var errorID = 'invalid-date';
var controller = Marionette.Object.extend( {
initialize: function() {
this.listenTo( radioChannel, 'change:modelValue', this.onChangeModelValue );
this.listenTo( radioChannel, 'keyup:field', this.dateKeyup );
this.listenTo( radioChannel, 'blur:field', this.onBlurField );
},
onChangeModelValue: function( model ) {
this.dateChange( model );
},
onBlurField: function( el, model ) {
this.dateChange( model );
},
dateChange: function( model ) {
var fieldID = model.get( 'id' );
var value = model.get( 'value' );
var format = model.get( 'date_format' );
if( 'default' === format) {
format = nfi18n.dateFormat;
}
if ( 0 < value.length ) {
// use moment's isValid to check against the fields format setting
if( moment( value, format ).isValid() ) {
nfRadio.channel( 'fields' ).request( 'remove:error', fieldID, errorID );
} else {
var fieldModel = nfRadio.channel( 'fields' ).request( 'get:field', fieldID );
var formModel = nfRadio.channel( 'app' ).request( 'get:form', fieldModel.get( 'formID' ) );
nfRadio.channel( 'fields' ).request( 'add:error', fieldID, errorID, formModel.get( 'settings' ).changeDateErrorMsg );
}
} else {
nfRadio.channel( 'fields' ).request( 'remove:error', fieldID, errorID );
}
},
/**
* When a user types inside of an dat field, track their keypresses
* and add the appropriate class.
* If the value validates as an date, add a class of nf-pass
* If the value does not validate as date, add a class of nf-fail
*
* @since 3.0
* @param {object} el Element that triggered the keyup event.
* @param {object} model Model connected to the element that triggered the event
* @return {void}
*/
dateKeyup: function( el, model, keyCode ) {
/*
* If we pressed the 'tab' key to get to this field, return false.
*/
if ( 9 == keyCode ) {
return false;
}
/*
* Get the current value from our element.
*/
var value = jQuery( el ).val();
/*
* Get our current ID
*/
var fieldID = model.get( 'id' );
/*
* Get our current date format
*/
var format = model.get( 'date_format' );
if( 'default' === format) {
format = nfi18n.dateFormat;
}
/*
* Check our value to see if it is a valid email.
*/
if ( 0 == value.length ) {
nfRadio.channel( 'fields' ).request( 'remove:error', fieldID, errorID );
}
// use moment's isValid to check against the fields format setting
else if ( ! moment( value, format ).isValid() && ! model.get( 'clean' ) ) {
var fieldModel = nfRadio.channel( 'fields' ).request( 'get:field', fieldID );
var formModel = nfRadio.channel( 'app' ).request( 'get:form', fieldModel.get( 'formID' ) );
nfRadio.channel( 'fields' ).request( 'add:error', fieldID, errorID, formModel.get( 'settings' ).changeDateErrorMsg );
model.removeWrapperClass( 'nf-pass' );
}
// use moment's isValid to check against the fields format setting
else if ( moment( value, format ).isValid() ) {
nfRadio.channel( 'fields' ).request( 'remove:error', fieldID, errorID );
/*
* Add nf-pass class to the wrapper.
*/
model.addWrapperClass( 'nf-pass' );
model.set( 'clean', false );
}
}
});
return controller;
} );
define('controllers/fieldCheckbox',[], function() {
var controller = Marionette.Object.extend( {
initialize: function() {
/*
* When we init our checkbox model, register our renderClasses() function
*/
this.listenTo( nfRadio.channel( 'checkbox' ), 'init:model', this.registerRenderClasses );
nfRadio.channel( 'checkbox' ).reply( 'validate:required', this.validateRequired );
nfRadio.channel( 'checkbox' ).reply( 'validate:modelData', this.validateModelData );
nfRadio.channel( 'checkbox' ).reply( 'before:updateField', this.beforeUpdateField, this );
nfRadio.channel( 'checkbox' ).reply( 'get:calcValue', this.getCalcValue, this );
},
beforeUpdateField: function( el, model ) {
var checked = jQuery( el ).prop( 'checked' );
if ( checked ) {
var value = 1;
jQuery( el ).addClass( 'nf-checked' );
jQuery( el ).closest( '.field-wrap' ).find( 'label[for="' + jQuery( el ).prop( 'id' ) + '"]' ).addClass( 'nf-checked-label' );
} else {
var value = 0;
jQuery( el ).removeClass( 'nf-checked' );
jQuery( el ).closest( '.field-wrap' ).find( 'label[for="' + jQuery( el ).prop( 'id' ) + '"]' ).removeClass( 'nf-checked-label' );
}
return value;
},
validateRequired: function( el, model ) {
return el[0].checked;
},
validateModelData: function( model ) {
return model.get( 'value' ) != 0;
},
getCalcValue: function( fieldModel ) {
if ( 1 == fieldModel.get( 'value' ) ) {
calcValue = fieldModel.get( 'checked_calc_value' );
} else {
calcValue = fieldModel.get( 'unchecked_calc_value' );
}
return calcValue;
},
registerRenderClasses: function( model ) {
if ( 'checked' == model.get( 'default_value' ) ) {
model.set( 'value', 1 );
} else {
model.set( 'value', 0 );
}
model.set( 'customClasses', this.customClasses );
model.set( 'customLabelClasses', this.customLabelClasses );
model.set( 'maybeChecked', this.maybeChecked );
},
customClasses: function( classes ) {
if ( 1 == this.value || ( this.clean && 'undefined' != typeof this.default_value && 'checked' == this.default_value ) ) {
classes += ' nf-checked';
} else {
classes.replace( 'nf-checked', '' );
}
return classes;
},
customLabelClasses: function( classes ) {
if ( 1 == this.value || ( this.clean && 'undefined' != typeof this.default_value && 'checked' == this.default_value ) ) {
classes += ' nf-checked-label';
} else {
classes.replace( 'nf-checked-label', '' );
}
return classes;
},
maybeChecked: function() {
if ( 1 == this.value || ( this.clean && 'undefined' != typeof this.default_value && 'checked' == this.default_value ) ) {
return ' checked';
} else {
return '';
}
}
});
return controller;
} );
define('controllers/fieldCheckboxList',[], function() {
var controller = Marionette.Object.extend( {
initialize: function() {
this.listenTo( nfRadio.channel( 'listcheckbox' ), 'init:model', this.register );
this.listenTo( nfRadio.channel( 'terms' ), 'init:model', this.register );
nfRadio.channel( 'listcheckbox' ).reply( 'before:updateField', this.beforeUpdateField, this );
nfRadio.channel( 'terms' ).reply( 'before:updateField', this.beforeUpdateField, this );
nfRadio.channel( 'listcheckbox' ).reply( 'get:calcValue', this.getCalcValue, this );
nfRadio.channel( 'terms' ).reply( 'get:calcValue', this.getCalcValue, this );
},
register: function( model ) {
model.set( 'renderOptions', this.renderOptions );
model.set( 'renderOtherText', this.renderOtherText );
model.set( 'selected', [] );
/*
* When we init a model, we need to set our 'value' to the selected option's value.
* This is the list equivalent of a 'default value'.
*/
if ( 0 != model.get( 'options' ).length ) {
var selected = _.filter( model.get( 'options' ), function( opt ) { return 1 == opt.selected } );
selected = _.map( selected, function( opt ) { return opt.value } );
}
/*
* This part is re-worked to take into account custom user-meta
* values for fields.
*/
var savedVal = model.get( 'value' );
if( 'undefined' !== typeof savedVal && Array.isArray( savedVal ) ) {
model.set( 'value', savedVal );
} else if ( 'undefined' != typeof selected ) {
model.set( 'value', selected );
}
},
renderOptions: function() {
var html = '';
if ( '' == this.value || ( Array.isArray( this.value ) && 0 < this.value.length )
|| 0 < this.value.length ) {
var valueFound = true;
} else {
var valueFound = false;
}
_.each( this.options, function( option, index ) {
if( Array.isArray( this.value ) ) {
if( Array.isArray( this.value[ 0 ] ) && -1 !== _.indexOf( this.value[ 0 ], option.value ) ) {
valueFound = true;
}
else if( _.indexOf( this.value, option.value ) ) {
valueFound = true;
}
}
if ( option.value == this.value ) {
valueFound = true;
}
/*
* TODO: This is a bandaid fix for making sure that each option has a "visible" property.
* This should be moved to creation so that when an option is added, it has a visible property by default.
*/
if ( 'undefined' == typeof option.visible ) {
option.visible = true;
}
option.fieldID = this.id;
option.classes = this.classes;
option.index = index;
var selected = false;
/*
* This part has been re-worked to account for values passed in
* via custom user-meta ( a la User Mgmt add-on)
*/
if( Array.isArray( this.value ) && 0 < this.value.length ) {
if ( -1 !== _.indexOf( this.value[ 0 ].split( ',' ), option.value )
|| -1 !== _.indexOf( this.value, option.value ) ) {
selected = true;
}
} else if ( ! _.isArray( this.value ) && option.value == this.value ) {
selected = true;
} else if ( ( 1 == option.selected && this.clean ) && 'undefined' === typeof this.value ) {
selected = true;
}
// else if( ( option.selected && "0" != option.selected ) && this.clean ){
// isSelected = true;
// } else {
// var testValues = _.map( this.value, function( value ) {
// return value.toString();
// } );
//
// option.isSelected = ( -1 != testValues.indexOf( option.value.toString() ) );
// }
option.selected = selected;
option.isSelected = selected;
option.required = this.required;
var template = nfRadio.channel( 'app' ).request( 'get:template', '#tmpl-nf-field-listcheckbox-option' );
html += template( option );
}, this );
if ( 1 == this.show_other ) {
if ( 'nf-other' == this.value ) {
valueFound = false;
}
var data = {
fieldID: this.id,
classes: this.classes,
currentValue: this.value,
renderOtherText: this.renderOtherText,
valueFound: valueFound
};
var template = nfRadio.channel( 'app' ).request( 'get:template', '#tmpl-nf-field-listcheckbox-other' );
html += template( data );
}
return html;
},
renderOtherText: function() {
if ( 'nf-other' == this.currentValue || ! this.valueFound ) {
if ( 'nf-other' == this.currentValue ) {
this.currentValue = '';
}
var data = {
fieldID: this.fieldID,
classes: this.classes,
currentValue: this.currentValue
};
var template = nfRadio.channel( 'app' ).request( 'get:template', '#tmpl-nf-field-listcheckbox-other-text' );
return template( data );
}
},
getCalcValue: function( fieldModel ) {
var calc_value = 0;
var options = fieldModel.get( 'options' );
if ( 0 != options.length ) {
_.each( fieldModel.get( 'value' ), function( val ) {
var tmp_opt = _.find( options, function( opt ) { return opt.value == val } );
calc_value = Number( calc_value ) + Number( tmp_opt.calc );
} );
}
return calc_value;
},
beforeUpdateField: function( el, model ) {
var selected = model.get( 'value' ) || [];
if ( typeof selected == 'string' ) selected = [ selected ];
var value = jQuery( el ).val();
var checked = jQuery( el ).prop( 'checked' );
if ( checked ) {
selected.push( value );
jQuery( el ).addClass( 'nf-checked' );
jQuery( el ).parent().find( 'label[for="' + jQuery( el ).prop( 'id' ) + '"]' ).addClass( 'nf-checked-label' );
} else {
jQuery( el ).removeClass( 'nf-checked' );
jQuery( el ).parent().find( 'label[for="' + jQuery( el ).prop( 'id' ) + '"]' ).removeClass( 'nf-checked-label' );
var i = selected.indexOf( value );
if( -1 != i ){
selected.splice( i, 1 );
} else if ( Array.isArray( selected ) ) {
var optionArray = selected[0].split( ',' );
var valueIndex = optionArray.indexOf( value );
if( -1 !== valueIndex) {
optionArray.splice( valueIndex, 1 );
}
selected = optionArray.join( ',' );
}
}
// if ( 1 == model.get( 'show_other' ) ) {
// model.set( 'reRender', true );
// }
return _.clone( selected );
}
});
return controller;
} );
define('controllers/fieldImageList',[], function() {
var controller = Marionette.Object.extend( {
initialize: function() {
this.listenTo( nfRadio.channel( 'listimage' ), 'init:model', this.register );
nfRadio.channel( 'listimage' ).reply( 'before:updateField', this.beforeUpdateField, this );
nfRadio.channel( 'listimage' ).reply( 'get:calcValue', this.getCalcValue, this );
},
register: function( model ) {
model.set( 'renderOptions', this.renderOptions );
model.set( 'renderOtherText', this.renderOtherText );
model.set( 'selected', [] );
/*
* When we init a model, we need to set our 'value' to the selected option's value.
* This is the list equivalent of a 'default value'.
*/
if ( 0 != model.get( 'image_options' ).length ) {
var selected = _.filter( model.get( 'image_options' ), function( opt ) { return 1 == opt.selected } );
selected = _.map( selected, function( opt ) { return opt.value } );
}
/*
* This part is re-worked to take into account custom user-meta
* values for fields.
*/
var savedVal = model.get( 'value' );
if( 'undefined' !== typeof savedVal && Array.isArray( savedVal ) ) {
model.set( 'value', savedVal );
} else if ( 'undefined' != typeof selected ) {
model.set( 'value', selected );
}
},
renderOptions: function() {
var html = '';
if ( '' == this.value || ( Array.isArray( this.value ) && 0 < this.value.length )
|| 0 < this.value.length ) {
var valueFound = true;
} else {
var valueFound = false;
}
if (this.allow_multi_select === 1) {
this.old_classname = 'list-checkbox';
this.image_type = 'checkbox';
} else {
this.image_type = 'radio';
}
if(this.list_orientation === 'horizontal') {
this.flex_direction = 'row';
} else {
this.flex_direction = 'column';
}
var that = this;
var num_columns = parseInt(this.num_columns) || 1;
var current_column = 1;
var current_row = 1;
_.each( this.image_options, function( image, index ) {
if (!this.show_option_labels) {
image.label = '';
}
if( Array.isArray( this.value ) ) {
if( Array.isArray( this.value[ 0 ] ) && -1 !== _.indexOf( this.value[ 0 ], image.value ) ) {
valueFound = true;
}
else if( _.indexOf( this.value, image.value ) ) {
valueFound = true;
}
}
if ( image.value == this.value ) {
valueFound = true;
}
/*
* TODO: This is a bandaid fix for making sure that each option has a "visible" property.
* This should be moved to creation so that when an option is added, it has a visible property by default.
*/
if ( 'undefined' == typeof image.visible ) {
image.visible = true;
}
if(that.list_orientation === 'horizontal' && current_column <= num_columns) {
image.styles = "margin:auto;grid-column: " + current_column + "; grid-row = " + current_row;
if(current_column === num_columns) {
current_column = 1;
current_row += 1;
} else {
current_column += 1;
}
}
image.image_type = that.image_type;
image.fieldID = this.id;
image.classes = this.classes;
image.index = index;
var selected = false;
/*
* This part has been re-worked to account for values passed in
* via custom user-meta ( a la User Mgmt add-on)
*/
if( Array.isArray( this.value ) && 0 < this.value.length ) {
if ( -1 !== _.indexOf( this.value[ 0 ].split( ',' ), image.value )
|| -1 !== _.indexOf( this.value, image.value ) ) {
selected = true;
}
} else if ( ! _.isArray( this.value ) && image.value == this.value ) {
selected = true;
} else if ( ( 1 == image.selected && this.clean ) && ('undefined' === typeof this.value || '' === this.value)) {
selected = true;
}
image.selected = selected;
image.isSelected = selected;
image.required = this.required;
var template = nfRadio.channel( 'app' ).request( 'get:template', '#tmpl-nf-field-listimage-option' );
html += template( image );
}, this );
if ( 1 == this.show_other ) {
if ( 'nf-other' == this.value ) {
valueFound = false;
}
var data = {
fieldID: this.id,
classes: this.classes,
value: this.value,
currentValue: this.value,
renderOtherText: this.renderOtherText,
valueFound: valueFound
};
var template = nfRadio.channel( 'app' ).request( 'get:template', '#tmpl-nf-field-listimage-other' );
html += template( data );
}
return html;
},
renderOtherText: function() {
if ( 'nf-other' == this.currentValue || ! this.valueFound ) {
if ( 'nf-other' == this.currentValue ) {
this.currentValue = '';
}
var data = {
fieldID: this.fieldID,
classes: this.classes,
currentValue: this.currentValue
};
var template = nfRadio.channel( 'app' ).request( 'get:template', '#tmpl-nf-field-listimage-other-text' );
return template( data );
}
},
getCalcValue: function( fieldModel ) {
var calc_value = 0;
var options = fieldModel.get( 'options' );
if ( 0 != options.length ) {
/*
* Check to see if this is a multi-select list.
*/
if ( 1 == parseInt( fieldModel.get( 'allow_multi_select' ) ) ) {
/*
* We're using a multi-select, so we need to check out any selected options and add them together.
*/
_.each( fieldModel.get( 'value' ), function( val ) {
var tmp_opt = _.find( options, function( opt ) { return opt.value == val } );
calc_value += Number( tmp_opt.calc );
} );
} else {
/*
* We are using a single select, so our selected option is in the 'value' attribute.
*/
var selected = _.find( options, function( opt ) { return fieldModel.get( 'value' ) == opt.value } );
/*
* If we have a selcted value, use it.
*/
if ( 'undefined' !== typeof selected ) {
calc_value = selected.calc;
}
}
}
return calc_value;
},
beforeUpdateField: function( el, model ) {
if(model.get('allow_multi_select') !== 1) {
var selected = jQuery( el ).val();
var options = model.get('image_options');
_.each(options, function(option, index) {
if(option.value === selected) {
option.isSelected = true;
option.selected = true;
} else {
option.isSelected = false;
option.selected = false;
}
if(!option.isSelected) {
option.selected = false;
jQuery("#nf-field-" + option.fieldID + "-" + index).removeClass('nf-checked');
jQuery("#nf-label-field-" + option.fieldID + "-" + index).removeClass('nf-checked-label');
} else {
jQuery("#nf-field-" + option.fieldID + "-" + index).addClass('nf-checked');
jQuery("#nf-label-field-" + option.fieldID + "-" + index).addClass('nf-checked-label');
}
});
} else {
var selected = model.get( 'value' ) || [];
if ( typeof selected == 'string' ) selected = [ selected ];
var value = jQuery( el ).val();
var checked = jQuery( el ).prop( 'checked' );
if ( checked ) {
selected.push( value );
jQuery( el ).addClass( 'nf-checked' );
jQuery( el ).parent().find( 'label[for="' + jQuery( el ).prop( 'id' ) + '"]' ).addClass( 'nf-checked-label' );
} else {
jQuery( el ).removeClass( 'nf-checked' );
jQuery( el ).parent().find( 'label[for="' + jQuery( el ).prop( 'id' ) + '"]' ).removeClass( 'nf-checked-label' );
var i = selected.indexOf( value );
if( -1 != i ){
selected.splice( i, 1 );
} else if ( Array.isArray( selected ) ) {
var optionArray = selected[0].split( ',' );
var valueIndex = optionArray.indexOf( value );
if( -1 !== valueIndex) {
optionArray.splice( valueIndex, 1 );
}
selected = optionArray.join( ',' );
}
}
}
return _.clone( selected );
}
});
return controller;
} );
define('controllers/fieldRadio',[], function() {
var controller = Marionette.Object.extend( {
initialize: function() {
this.listenTo( nfRadio.channel( 'listradio' ), 'change:modelValue', this.changeModelValue );
this.listenTo( nfRadio.channel( 'listradio' ), 'init:model', this.register );
nfRadio.channel( 'listradio' ).reply( 'get:calcValue', this.getCalcValue, this );
this.listenTo( nfRadio.channel( 'listradio' ), 'change:field', this.updateCheckedClass, this );
},
register: function( model ) {
model.set( 'renderOptions', this.renderOptions );
model.set( 'renderOtherText', this.renderOtherText );
/*
* When we init a model, we need to set our 'value' to the selected option's value.
* This is the list equivalent of a 'default value'.
*/
if ( 0 != model.get( 'options' ).length ) {
/*
* Check to see if we have a selected value.
*/
var selected = _.find( model.get( 'options' ), function( opt ) { return 1 == opt.selected } );
if ( 'undefined' != typeof selected ) {
model.set( 'value', selected.value );
}
}
},
changeModelValue: function( model ) {
if ( 1 == model.get( 'show_other' ) ) {
// model.set( 'reRender', true );
model.trigger( 'reRender');
}
},
renderOptions: function() {
var html = '';
if ( '' == this.value ) {
var valueFound = true;
} else {
var valueFound = false;
}
_.each( this.options, function( option, index ) {
if ( option.value == this.value ) {
valueFound = true;
}
/*
* TODO: This is a bandaid fix for making sure that each option has a "visible" property.
* This should be moved to creation so that when an option is added, it has a visible property by default.
*/
if ( 'undefined' == typeof option.visible ) {
option.visible = true;
}
option.selected = false;
option.fieldID = this.id;
option.classes = this.classes;
option.currentValue = this.value;
option.index = index;
option.required = this.required;
/*
* If we haven't edited this field yet, use the default checked
*/
if ( this.clean && 1 == this.selected ) {
option.selected = true;
} else if ( this.value == option.value ) {
option.selected = true;
} else {
option.selected = false;
}
var template = nfRadio.channel( 'app' ).request( 'get:template', '#tmpl-nf-field-listradio-option' );
html += template( option );
}, this );
if ( 1 == this.show_other ) {
if ( 'nf-other' == this.value ) {
valueFound = false;
}
var data = {
fieldID: this.id,
classes: this.classes,
currentValue: this.value,
renderOtherText: this.renderOtherText,
valueFound: valueFound
};
var template = nfRadio.channel( 'app' ).request( 'get:template', '#tmpl-nf-field-listradio-other' );
html += template( data );
}
return html;
},
renderOtherText: function() {
if ( 'nf-other' == this.currentValue || ! this.valueFound ) {
if ( 'nf-other' == this.currentValue ) {
this.currentValue = '';
}
var data = {
fieldID: this.fieldID,
classes: this.classes,
currentValue: this.currentValue
};
var template = nfRadio.channel( 'app' ).request( 'get:template', '#tmpl-nf-field-listradio-other-text' );
return template( data );
}
},
getCalcValue: function( fieldModel ) {
/*
* Default to 0, in case we have no selection.
*/
var calc_value = 0;
if ( 0 != fieldModel.get( 'options' ).length ) {
/*
* Check to see if we have a selected value.
*/
var selected = _.find( fieldModel.get( 'options' ), function( opt ) { return fieldModel.get( 'value' ) == opt.value } );
if ( 'undefined' !== typeof selected ) {
calc_value = selected.calc;
}
}
return calc_value;
},
updateCheckedClass: function( el, model ) {
jQuery( '[name="' + jQuery( el ).attr( 'name' ) + '"]' ).removeClass( 'nf-checked' );
jQuery( el ).closest( 'ul' ).find( 'label' ).removeClass( 'nf-checked-label' );
jQuery( el ).addClass( 'nf-checked' );
jQuery( el ).closest( 'li' ).find( 'label[for="' + jQuery( el ).prop( 'id' ) + '"]' ).addClass( 'nf-checked-label' );
}
});
return controller;
} );
define('controllers/fieldNumber',[], function() {
var controller = Marionette.Object.extend( {
initialize: function() {
this.listenTo( nfRadio.channel( 'number' ), 'init:model', this.maybeMinDefault );
this.listenTo( nfRadio.channel( 'number' ), 'keyup:field', this.validateMinMax );
},
maybeMinDefault: function( model ) {
if( '' == model.get( 'value' ) && '' == model.get( 'placeholder' ) ){
var min = model.get( 'num_min' );
model.set( 'placeholder', min );
}
},
validateMinMax: function( el, model ) {
var $el = jQuery( el );
var value = parseFloat( $el.val() );
var min = $el.attr( 'min' );
var max = $el.attr( 'max' );
var step = parseFloat( $el.attr( 'step' ) );
if( min && value < min ){
var fieldModel = nfRadio.channel( 'fields' ).request( 'get:field', model.get( 'id' ) );
var formModel = nfRadio.channel( 'app' ).request( 'get:form', fieldModel.get( 'formID' ) );
nfRadio.channel( 'fields' ).request( 'add:error', model.get( 'id' ), 'number-min', formModel.get( 'settings' ).fieldNumberNumMinError );
} else {
nfRadio.channel( 'fields' ).request( 'remove:error', model.get( 'id' ), 'number-min' );
}
if ( max && value > max ){
var fieldModel = nfRadio.channel( 'fields' ).request( 'get:field', model.get( 'id' ) );
var formModel = nfRadio.channel( 'app' ).request( 'get:form', fieldModel.get( 'formID' ) );
nfRadio.channel( 'fields' ).request( 'add:error', model.get( 'id' ), 'number-max', formModel.get( 'settings' ).fieldNumberNumMaxError );
} else {
nfRadio.channel( 'fields' ).request( 'remove:error', model.get( 'id' ), 'number-max' );
}
var testValue = Math.round( parseFloat( value ) * 1000000000 );
var testStep = Math.round( parseFloat( step ) * 1000000000 );
if( value && 0 !== testValue % testStep ){
var fieldModel = nfRadio.channel( 'fields' ).request( 'get:field', model.get( 'id' ) );
var formModel = nfRadio.channel( 'app' ).request( 'get:form', fieldModel.get( 'formID' ) );
nfRadio.channel( 'fields' ).request( 'add:error', model.get( 'id' ), 'number-step', formModel.get( 'settings' ).fieldNumberIncrementBy + step );
} else {
nfRadio.channel( 'fields' ).request( 'remove:error', model.get( 'id' ), 'number-step' );
}
}
});
return controller;
} );
define( 'controllers/mirrorField',[], function() {
var radioChannel = nfRadio.channel( 'fields' );
var controller = Marionette.Object.extend( {
listeningModel: '',
initialize: function() {
this.listenTo( radioChannel, 'init:model', this.registerMirror );
},
registerMirror: function( model ) {
if ( model.get( 'mirror_field' ) ) {
this.listeningModel = model;
var targetID = model.get( 'mirror_field' );
this.listenTo( nfRadio.channel( 'field-' + targetID ), 'change:modelValue', this.changeValue );
}
},
changeValue: function( targetModel ) {
this.listeningModel.set( 'value', targetModel.get( 'value' ) );
// this.listeningModel.set( 'reRender', true );
this.listeningModel.trigger( 'reRender' );
}
});
return controller;
} );
define( 'controllers/confirmField',[], function() {
var radioChannel = nfRadio.channel( 'fields' );
var errorID = 'confirm-mismatch';
var controller = Marionette.Object.extend( {
initialize: function() {
this.listenTo( radioChannel, 'init:model', this.registerConfirm );
this.listenTo( radioChannel, 'keyup:field', this.confirmKeyup );
},
registerConfirm: function( confirmModel ) {
if ( ! confirmModel.get( 'confirm_field' ) ) return;
this.listenTo( nfRadio.channel( 'form' ), 'loaded', function( formModal ){
this.registerConfirmListeners( confirmModel );
});
},
registerConfirmListeners: function( confirmModel ) {
var targetModel = nfRadio.channel( 'form-' + confirmModel.get( 'formID' ) ).request( 'get:fieldByKey', confirmModel.get( 'confirm_field' ) );
//TODO: Add better handling for password confirm fields on the front end.
if( 'undefined' == typeof targetModel ) return;
targetModel.set( 'confirm_with', confirmModel.get( 'id' ) );
this.listenTo( nfRadio.channel( 'field-' + targetModel.get( 'id' ) ), 'change:modelValue', this.changeValue );
this.listenTo( nfRadio.channel( 'field-' + confirmModel.get( 'id' ) ), 'change:modelValue', this.changeValue );
},
changeValue: function( model ) {
if ( 'undefined' == typeof model.get( 'confirm_with' ) ) {
var confirmModel = model;
var targetModel = nfRadio.channel( 'form-' + model.get( 'formID' ) ).request( 'get:fieldByKey', confirmModel.get( 'confirm_field' ) );
} else {
var targetModel = model;
var confirmModel = radioChannel.request( 'get:field', targetModel.get( 'confirm_with' ) );
}
var targetID = targetModel.get( 'id' );
var confirmID = confirmModel.get( 'id' );
if ( '' == confirmModel.get( 'value' ) || confirmModel.get( 'value' ) == targetModel.get( 'value' ) ) {
nfRadio.channel( 'fields' ).request( 'remove:error', confirmID, errorID );
} else {
var fieldModel = nfRadio.channel( 'fields' ).request( 'get:field', confirmID );
var formModel = nfRadio.channel( 'app' ).request( 'get:form', fieldModel.get( 'formID' ) );
nfRadio.channel( 'fields' ).request( 'add:error', confirmID, errorID, formModel.get( 'settings' ).confirmFieldErrorMsg );
}
},
confirmKeyup: function( el, model, keyCode ) {
var currentValue = jQuery( el ).val();
if ( model.get( 'confirm_field' ) ) {
var confirmModel = model;
var confirmID = model.get( 'id' );
var targetModel = nfRadio.channel( 'form-' + model.get( 'formID' ) ).request( 'get:fieldByKey', confirmModel.get( 'confirm_field' ) );
var compareValue = targetModel.get( 'value' );
var confirmValue = currentValue;
} else if ( model.get( 'confirm_with' ) ) {
var confirmModel = nfRadio.channel( 'fields' ).request( 'get:field', model.get( 'confirm_with' ) );
var confirmID = confirmModel.get( 'id' );
var confirmValue = confirmModel.get( 'value' );
var compareValue = confirmValue;
}
if ( 'undefined' !== typeof confirmModel ) {
if ( '' == confirmValue ) {
nfRadio.channel( 'fields' ).request( 'remove:error', confirmID, errorID );
} else if ( currentValue == compareValue ) {
nfRadio.channel( 'fields' ).request( 'remove:error', confirmID, errorID );
} else {
var fieldModel = nfRadio.channel( 'fields' ).request( 'get:field', confirmID );
var formModel = nfRadio.channel( 'app' ).request( 'get:form', fieldModel.get( 'formID' ) );
nfRadio.channel( 'fields' ).request( 'add:error', confirmID, errorID, formModel.get( 'settings' ).confirmFieldErrorMsg );
}
}
}
});
return controller;
} );
define('controllers/updateFieldModel',[], function() {
var controller = Marionette.Object.extend( {
initialize: function() {
nfRadio.channel( 'nfAdmin' ).reply( 'update:field', this.updateField );
},
updateField: function( model, value ) {
if ( ! model.get( 'isUpdated' ) ) {
model.set( 'value', value );
model.set( 'isUpdated', true );
/*
* If we're working with an array, it won't trigger a change event on the value attribute.
* Instead, we have to manually trigger a change event.
*/
if ( _.isArray( value ) ) {
model.trigger( 'change:value', model );
}
}
}
});
return controller;
} );
define('controllers/submitButton',['controllers/submitButton'], function( submitButton ) {
var controller = Marionette.Object.extend( {
bound: {},
initialize: function() {
this.listenTo( nfRadio.channel( 'submit' ), 'init:model', this.registerHandlers );
},
registerHandlers: function( fieldModel ) {
if ( 'undefined' != typeof this.bound[ fieldModel.get( 'id' ) ] ) {
return false;
}
this.listenTo( nfRadio.channel( 'field-' + fieldModel.get( 'id' ) ), 'click:field', this.click, this );
/*
* Register an interest in the 'before:submit' event of our form.
*/
fieldModel.listenTo( nfRadio.channel( 'form-' + fieldModel.get( 'formID' ) ), 'before:submit', this.beforeSubmit, fieldModel );
fieldModel.listenTo( nfRadio.channel( 'form-' + fieldModel.get( 'formID' ) ), 'submit:failed', this.resetLabel, fieldModel );
fieldModel.listenTo( nfRadio.channel( 'form-' + fieldModel.get( 'formID' ) ), 'submit:response', this.resetLabel, fieldModel );
fieldModel.listenTo( nfRadio.channel( 'form-' + fieldModel.get( 'formID' ) ), 'enable:submit', this.maybeEnable, fieldModel );
fieldModel.listenTo( nfRadio.channel( 'form-' + fieldModel.get( 'formID' ) ), 'disable:submit', this.maybeDisable, fieldModel );
fieldModel.listenTo( nfRadio.channel( 'form-' + fieldModel.get( 'formID' ) ), 'processingLabel', this.processingLabel, fieldModel );
fieldModel.listenTo( nfRadio.channel( 'fields' ), 'add:error', this.maybeDisable, fieldModel );
fieldModel.listenTo( nfRadio.channel( 'fields' ), 'remove:error', this.maybeEnable, fieldModel );
this.bound[ fieldModel.get( 'id') ] = true;
},
click: function( e, fieldModel ) {
var formModel = nfRadio.channel( 'app' ).request( 'get:form', fieldModel.get( 'formID' ) );
nfRadio.channel( 'form-' + fieldModel.get( 'formID' ) ).request( 'submit', formModel );
},
beforeSubmit: function() {
this.set( 'disabled', true );
nfRadio.channel( 'form-' + this.get( 'formID' ) ).trigger( 'processingLabel', this );
},
maybeDisable: function( fieldModel ) {
if( 'undefined' != typeof fieldModel && fieldModel.get( 'formID' ) != this.get( 'formID' ) ) return;
this.set( 'disabled', true );
this.trigger( 'reRender' );
},
maybeEnable: function( fieldModel ) {
/*
* If the field reporting the error is not on the same form as the submit button, return false;
*/
if ( 'undefined' != typeof fieldModel && fieldModel.get( 'formID' ) != this.get( 'formID' ) ) {
return false;
}
var formModel = nfRadio.channel( 'app' ).request( 'get:form', this.get( 'formID' ) );
if ( 0 == _.size( formModel.get( 'fieldErrors' ) ) ) {
this.set( 'disabled', false );
this.trigger( 'reRender' );
}
},
processingLabel: function() {
if ( this.get( 'label' ) == this.get( 'processing_label' ) ) return false;
this.set( 'oldLabel', this.get( 'label' ) );
this.set( 'label', this.get( 'processing_label' ) );
this.trigger( 'reRender' );
},
resetLabel: function( response ) {
if ( 'undefined' != typeof response.errors &&
'undefined' != typeof response.errors.nonce &&
_.size( response.errors.nonce ) > 0 ) {
if( 'undefined' != typeof response.errors.nonce.new_nonce && 'undefined' != typeof response.errors.nonce.nonce_ts ) {
// Do not reset label for nonce errors, which will re-submit the form.
return;
}
}
if ( 'undefined' != typeof this.get( 'oldLabel' ) ) {
this.set( 'label', this.get( 'oldLabel' ) );
}
this.set( 'disabled', false );
this.trigger( 'reRender' );
}
});
return controller;
} );
define('controllers/submitDebug',[], function() {
var controller = Marionette.Object.extend( {
initialize: function() {
this.listenTo( nfRadio.channel( 'forms' ), 'submit:response', this.submitDebug );
},
submitDebug: function( response, textStatus, jqXHR, formID ) {
if( 'undefined' == typeof response.debug ) return;
/* Form Debug Messages */
if( 'undefined' != typeof response.debug.form ) {
var debugMessages = document.createElement( 'span' );
_.each(response.debug.form, function (message, index) {
var messageText = document.createTextNode( message );
debugMessages.appendChild( messageText );
debugMessages.appendChild(
document.createElement( 'br' )
);
});
jQuery('.nf-debug-msg').html( debugMessages );
}
/* Console Debug Messages */
if( 'undefined' != typeof response.debug.console ) {
var style = '';
console.log( '%c%s', style, 'NINJA SUPPORT' );
_.each(response.debug.console, function (message, index) {
console.log( message );
});
console.log( '%c%s', style, 'END NINJA SUPPORT' );
}
}
});
return controller;
} );
define('controllers/getFormErrors',[], function() {
var radioChannel = nfRadio.channel( 'fields' );
var controller = Marionette.Object.extend( {
initialize: function( model ) {
nfRadio.channel( 'form' ).reply( 'get:errors', this.getFormErrors );
},
getFormErrors: function( formID ) {
var formModel = nfRadio.channel( 'app' ).request( 'get:form', formID );
var errors = false;
if ( formModel ) {
/*
* Check to see if we have any errors on our form model.
*/
if ( 0 !== formModel.get( 'errors' ).length ) {
_.each( formModel.get( 'errors' ).models, function( error ) {
errors = errors || {};
errors[ error.get( 'id' ) ] = error.get( 'msg' );
} );
}
_.each( formModel.get( 'fields' ).models, function( field ) {
if ( field.get( 'type' ) != 'submit' && field.get( 'errors' ).length > 0 ) {
errors = errors || {};
errors[ field.get( 'id' ) ] = field.get( 'errors' );
}
} );
}
return errors;
},
});
return controller;
} );
define('controllers/validateRequired',[], function() {
var controller = Marionette.Object.extend( {
initialize: function() {
this.listenTo( nfRadio.channel( 'fields' ), 'blur:field', this.validateRequired );
this.listenTo( nfRadio.channel( 'fields' ), 'change:field', this.validateRequired );
this.listenTo( nfRadio.channel( 'fields' ), 'keyup:field', this.validateKeyup );
this.listenTo( nfRadio.channel( 'fields' ), 'change:modelValue', this.validateModelData );
this.listenTo( nfRadio.channel( 'submit' ), 'validate:field', this.validateModelData );
},
validateKeyup: function( el, model, keyCode ) {
if ( 1 != model.get( 'required' ) ) {
return false;
}
if ( ! model.get( 'clean' ) ) {
this.validateRequired( el, model );
}
},
validateRequired: function( el, model ) {
if ( 1 != model.get( 'required' ) || ! model.get( 'visible' ) ) {
return false;
}
var currentValue = jQuery( el ).val();
var customReqValidation = nfRadio.channel( model.get( 'type' ) ).request( 'validate:required', el, model );
var defaultReqValidation = true;
var maskPlaceholder = model.get( 'mask' );
if ( maskPlaceholder ) {
maskPlaceholder = maskPlaceholder.replace( /9/g, '_' );
maskPlaceholder = maskPlaceholder.replace( /a/g, '_' );
maskPlaceholder = maskPlaceholder.replace( /\*/g, '_' );
}
// If the field has a mask...
// AND that mask is equal to the current value...
if ( maskPlaceholder && currentValue === maskPlaceholder ) {
// If we have a pre-existing error...
if ( 0 < model.get( 'errors' ).length ) {
// Persist that error.
defaultReqValidation = false;
}
}
// If our value is an empty string...
if ( ! jQuery.trim( currentValue ) ) {
// Throw an error.
defaultReqValidation = false;
}
if ( 'undefined' !== typeof customReqValidation ) {
var valid = customReqValidation;
} else {
var valid = defaultReqValidation;
}
this.maybeError( valid, model );
},
validateModelData: function( model ) {
if ( 1 != model.get( 'required' ) || ! model.get( 'visible' ) || model.get( 'clean' ) ) {
return false;
}
/*
* If we already have a required error on this model, return false
*/
if ( model.get( 'errors' ).get( 'required-error' ) ) {
return false;
}
currentValue = model.get( 'value' );
var defaultReqValidation = true;
if ( ! jQuery.trim( currentValue ) ) {
defaultReqValidation = false;
}
var customReqValidation = nfRadio.channel( model.get( 'type' ) ).request( 'validate:modelData', model );
if ( 'undefined' !== typeof customReqValidation ) {
var valid = customReqValidation;
} else {
var valid = defaultReqValidation;
}
this.maybeError( valid, model );
},
maybeError: function( valid, model ) {
if ( ! valid ) {
var formModel = nfRadio.channel( 'form-' + model.get( 'formID' ) ).request( 'get:form' );
if( 'undefined' != typeof formModel ) {
nfRadio.channel('fields').request('add:error', model.get('id'), 'required-error', formModel.get('settings').validateRequiredField);
}
} else {
nfRadio.channel( 'fields' ).request( 'remove:error', model.get( 'id' ), 'required-error' );
}
}
});
return controller;
} );
define('controllers/submitError',[], function() {
var controller = Marionette.Object.extend( {
initialize: function() {
this.listenTo( nfRadio.channel( 'forms' ), 'submit:response', this.submitErrors );
},
submitErrors: function( response, textStatus, jqXHR, formID ) {
// Check for nonce error.
if ( _.size( response.errors.nonce ) > 0 ) {
if( 'undefined' != typeof response.errors.nonce.new_nonce && 'undefined' != typeof response.errors.nonce.nonce_ts ) {
// Update nonce from response.
nfFrontEnd.ajaxNonce = response.errors.nonce.new_nonce;
nfFrontEnd.nonce_ts = response.errors.nonce.nonce_ts;
// Re-submit form.
var formModel = nfRadio.channel( 'app' ).request( 'get:form', formID );
nfRadio.channel( 'form-' + formID ).request( 'submit', formModel );
}
}
if ( _.size( response.errors.fields ) > 0 ) {
_.each( response.errors.fields, function( data, fieldID ) {
if ( typeof( data ) === 'object' ) {
nfRadio.channel( 'fields' ).request( 'add:error', fieldID, data.slug, data.message );
} else {
nfRadio.channel( 'fields' ).request( 'add:error', fieldID, 'required-error', data );
}
} );
}
if ( _.size( response.errors.form ) > 0 ) {
_.each( response.errors.form, function( msg, errorID ) {
nfRadio.channel( 'form-' + formID ).request( 'remove:error', errorID );
nfRadio.channel( 'form-' + formID ).request( 'add:error', errorID, msg );
} );
}
if ( 'undefined' != typeof response.errors.last ) {
if( 'undefined' != typeof response.errors.last.message ) {
var style = 'background: rgba( 255, 207, 115, .5 ); color: #FFA700; display: block;';
console.log( '%c NINJA FORMS SUPPORT: SERVER ERROR', style );
console.log( response.errors.last.message );
console.log( '%c END SERVER ERROR MESSAGE', style );
}
}
/**
* TODO: This needs to be re-worked for backbone. It's not dynamic enough.
*/
/*
* Re-show any hidden fields during a form submission re-start.
*/
jQuery( '#nf-form-' + formID + '-cont .nf-field-container' ).show();
}
});
return controller;
} );
define('controllers/actionRedirect',[], function() {
var controller = Marionette.Object.extend( {
initialize: function() {
this.listenTo( nfRadio.channel( 'forms' ), 'submit:response', this.actionRedirect );
},
actionRedirect: function( response ) {
if ( 'undefined' != typeof response.data.halt && 'undefined' != typeof response.data.halt.redirect && '' != response.data.halt.redirect ) {
window.location = response.data.halt.redirect;
}
if ( _.size( response.errors ) == 0 && 'undefined' != typeof response.data.actions ) {
if ( 'undefined' != typeof response.data.actions.redirect && '' != response.data.actions.redirect ) {
window.location = response.data.actions.redirect;
}
}
}
});
return controller;
} );
define('controllers/actionSuccess',[], function() {
var controller = Marionette.Object.extend( {
initialize: function() {
this.listenTo( nfRadio.channel( 'forms' ), 'submit:response', this.actionSubmit );
},
actionSubmit: function( response ) {
if ( _.size( response.errors ) == 0 && 'undefined' != typeof response.data.actions ) {
if ( 'undefined' != typeof response.data.actions.success_message && '' != response.data.actions.success_message ) {
var form_id = response.data.form_id;
var success_message = jQuery( '#nf-form-' + form_id + '-cont .nf-response-msg' );
success_message.html( response.data.actions.success_message ).show();
//Let's check if the success message is already fully visible in the viewport without scrolling
var top_of_success_message = success_message.offset().top;
var bottom_of_success_message = success_message.offset().top + success_message.outerHeight();
var bottom_of_screen = jQuery(window).scrollTop() + jQuery(window).height();
var top_of_screen = jQuery(window).scrollTop();
var the_element_is_visible = ((bottom_of_screen > bottom_of_success_message) && (top_of_screen < top_of_success_message));
if(!the_element_is_visible){
//The element isn't visible, so let's scroll to the success message as in the previous release, but with a short animation
jQuery('html, body').animate({
scrollTop: ( success_message.offset().top - 50 )
}, 300 );
}
}
}
}
});
return controller;
} );
define('controllers/fieldSelect',[], function() {
var controller = Marionette.Object.extend( {
initialize: function() {
this.listenTo( nfRadio.channel( 'fields' ), 'init:model', function( model ){
if( 'list' == model.get( 'parentType' ) ) this.register( model );
}, this );
nfRadio.channel( 'listselect' ).reply( 'get:calcValue', this.getCalcValue, this );
nfRadio.channel( 'listmultiselect' ).reply( 'get:calcValue', this.getCalcValue, this );
},
register: function( model ) {
model.set( 'renderOptions', this.renderOptions );
model.set( 'renderOtherAttributes', this.renderOtherAttributes );
/*
* When we init a model, we need to set our 'value' to the selected option's value.
* This is the list equivalent of a 'default value'.
*/
if ( 0 != model.get( 'options' ).length ) {
//Check to see if there is a value set for the field
var savedVal = model.get( 'value' );
/*
* Check to see if this is a multi-select list.
*/
if ( 'listmultiselect' == model.get( 'type' ) ) {
/*
* We're using a multi-select, so we need to check out any selected options and add them together.
*/
var selected = _.filter( model.get( 'options' ), function( opt ) { return 1 == opt.selected } );
selected = _.map( selected, function( opt ) { return opt.value } );
var value = selected;
} else if ( 'listradio' !== model.get( 'type' ) ) {
/*
* Check to see if we have a selected value.
*/
var selected = _.find( model.get( 'options' ), function( opt ) { return 1 == opt.selected } );
/*
* We don't have a selected value, so use our first option.
*/
if ( 'undefined' == typeof selected ) {
selected = _.first( model.get( 'options' ) );
}
if ( 'undefined' != typeof selected
&& 'undefined' != typeof selected.value ) {
var value = selected.value;
} else if ( 'undefined' != typeof selected ) {
var value = selected.label;
}
}
/*
* This part is re-worked to take into account custom user-meta
* values for fields.
*/
if( 'undefined' !== typeof savedVal && '' !== savedVal
&& Array.isArray( savedVal ) ) {
model.set( 'value', savedVal );
} else if ( 'undefined' != typeof selected ) {
model.set( 'value', value );
}
}
},
renderOptions: function() {
var html = '';
_.each( this.options, function( option ) {
/*
* This part has been re-worked to account for values passed in
* via custom user-meta ( a la User Mgmt add-on)
*/
if ( _.isArray( this.value ) ) {
// If we have a multiselect list...
// AND it has selected values...
if( 'listmultiselect' === this.type && 0 < this.value.length &&
-1 != _.indexOf( this.value[ 0 ].split( ',' ), option.value ) ) {
var selected = true;
} else if( -1 != _.indexOf( this.value, option.value ) ) {
var selected = true;
}
} else if ( ! _.isArray( this.value ) && option.value == this.value ) {
var selected = true;
} else if ( ( 1 == option.selected && this.clean )
&& 'undefined' === typeof this.value ) {
var selected = true;
} else {
var selected = false;
}
/*
* TODO: This is a bandaid fix for making sure that each option has a "visible" property.
* This should be moved to creation so that when an option is added, it has a visible property by default.
*/
if ( 'undefined' == typeof option.visible ) {
option.visible = true;
}
option.selected = selected;
option.fieldID = this.id;
option.classes = this.classes;
option.currentValue = this.value;
var template = nfRadio.channel( 'app' ).request( 'get:template', '#tmpl-nf-field-listselect-option' );
html += template( option );
}, this );
return html;
},
renderOtherAttributes: function() {
var otherAttributes = '';
if( 'listmultiselect' == this.type ){
otherAttributes = otherAttributes + ' multiple';
var multiSize = this.multi_size || 5;
otherAttributes = otherAttributes + ' size="' + multiSize + '"';
}
return otherAttributes;
},
getCalcValue: function( fieldModel ) {
var calc_value = 0;
var options = fieldModel.get( 'options' );
if ( 0 != options.length ) {
/*
* Check to see if this is a multi-select list.
*/
if ( 'listmultiselect' == fieldModel.get( 'type' ) ) {
/*
* We're using a multi-select, so we need to check out any selected options and add them together.
*/
_.each( fieldModel.get( 'value' ), function( val ) {
var tmp_opt = _.find( options, function( opt ) { return opt.value == val } );
calc_value += Number( tmp_opt.calc );
} );
} else {
/*
* We are using a single select, so our selected option is in the 'value' attribute.
*/
var selected = _.find( options, function( opt ) { return fieldModel.get( 'value' ) == opt.value } );
/*
* We don't have a selected value, so use our first option.
*/
if ( 'undefined' == typeof selected ) {
selected = fieldModel.get( 'options' )[0];
}
calc_value = selected.calc;
}
}
return calc_value;
}
});
return controller;
} );
define('controllers/coreSubmitResponse',[], function() {
var controller = Marionette.Object.extend( {
initialize: function() {
this.listenTo( nfRadio.channel( 'forms' ), 'submit:response', this.actionSubmit );
},
actionSubmit: function( response ) {
var formModel = nfRadio.channel( 'app' ).request( 'get:form', response.data.form_id );
/*
* If we have errors, don't hide or clear.
*/
if ( 0 != _.size( response.errors ) ) {
return false;
}
if ( 1 == response.data.settings.clear_complete ) {
// nfRadio.channel( 'form-' + response.data.form_id ).trigger( 'reset' );
formModel.get( 'fields' ).reset( formModel.get( 'loadedFields' ) );
if ( 1 != response.data.settings.hide_complete ) {
nfRadio.channel( 'captcha' ).trigger( 'reset' );
}
}
if ( 1 == response.data.settings.hide_complete ) {
/**
* TODO: This needs to be re-worked for backbone. It's not dynamic enough.
*/
formModel.trigger( 'hide' );
// jQuery( '.nf-fields' ).hide();
// jQuery( '.nf-form-title' ).hide();
}
}
});
return controller;
} );
define('controllers/fieldProduct',[], function() {
var controller = Marionette.Object.extend( {
initialize: function() {
this.listenTo( nfRadio.channel( 'product' ), 'init:model', this.register );
nfRadio.channel( 'product' ).reply( 'get:calcValue', this.getCalcValue, this );
},
register: function( model ) {
model.set( 'renderProductQuantity', this.renderProductQuantity );
model.set( 'renderProduct', this.renderProduct );
model.set( 'renderOptions', this.renderOptions );
},
renderProduct: function(){
switch( this.product_type ) {
case 'user':
var template = nfRadio.channel( 'app' ).request( 'get:template', '#tmpl-nf-field-textbox' );
return template( this );
break;
case 'hidden':
var template = nfRadio.channel( 'app' ).request( 'get:template', '#tmpl-nf-field-hidden' );
return template( this );
break;
case 'dropdown':
var template = nfRadio.channel( 'app' ).request( 'get:template', '#tmpl-nf-product-dropdown' );
return template( this );
break;
default:
var template = nfRadio.channel( 'app' ).request( 'get:template', '#tmpl-nf-product-single' );
return template( this );
}
},
renderProductQuantity: function(){
if ( 1 == this.product_use_quantity ) {
var template = nfRadio.channel( 'app' ).request( 'get:template', '#tmpl-nf-product-quantity' );
return template( this );
}
},
renderOptions: function() {
var that = this;
var html = '';
_.each( this.options, function( option ) {
if ( 1 == option.selected ) {
var selected = true;
} else {
var selected = false;
}
option.selected = selected;
option.fieldID = that.id;
option.classes = that.classes;
option.currentValue = that.value;
var template = nfRadio.channel( 'app' ).request( 'get:template', '#tmpl-nf-product-' + that.product_type + '-option' );
html += template( option );
} );
return html;
},
getCalcValue: function( fieldModel ) {
var product_price = fieldModel.get( 'product_price' );
var product_quantity = fieldModel.get( 'value' );
return product_price * product_quantity;
}
});
return controller;
} );
define('controllers/fieldTotal',[], function() {
var controller = Marionette.Object.extend( {
totalModel: {},
productTotals: {},
initialize: function() {
this.listenTo( nfRadio.channel( 'total' ), 'init:model', this.register );
this.listenTo( nfRadio.channel( 'shipping' ), 'init:model', this.registerShipping );
},
register: function( totalModel ){
this.totalModel = totalModel;
var formID = totalModel.get( 'formID' );
this.listenTo( nfRadio.channel( 'form-' + formID ), 'loaded', this.onFormLoaded );
this.listenTo( nfRadio.channel( 'product' ), 'change:modelValue', this.onChangeProduct );
this.listenTo( nfRadio.channel( 'quantity' ), 'change:modelValue', this.onChangeQuantity );
},
registerShipping: function( shippingModel ){
this.shippingCost = shippingModel.get( 'shipping_cost' );
},
onFormLoaded: function( formModel ){
var fieldModels = formModel.get( 'fields' ).models;
var productFields = {};
var quantityFields = {};
for( var model in fieldModels ){
var field = fieldModels[ model ];
var fieldID = field.get( 'id' );
// TODO: Maybe use switch
if( 'product' == field.get( 'type' ) ){
productFields[ fieldID ] = field;
} else if( 'quantity' == field.get( 'type' ) ){
var productID = field.get( 'product_assignment' );
quantityFields[ productID ] = field;
}
}
for( var productID in productFields ){
var product = productFields[ productID ];
var productPrice = Number( product.get( 'product_price' ) );
if( quantityFields[ productID ] ){
productPrice *= quantityFields[ productID ].get( 'value' );
} else if( 1 == product.get( 'product_use_quantity' ) ){
productPrice *= product.get( 'value' );
}
this.productTotals[ productID ] = productPrice;
}
this.updateTotal();
},
onChangeProduct: function( model ){
var productID = model.get( 'id' );
var productPrice = Number( model.get( 'product_price' ) );
var productQuantity = Number( model.get( 'value' ) );
var newTotal = productQuantity * productPrice;
this.productTotals[ productID ] = newTotal;
this.updateTotal();
},
onChangeQuantity: function( model ){
var productID = model.get( 'product_assignment' );
var productField = nfRadio.channel( 'fields' ).request( 'get:field', productID );
var productPrice = Number( productField.get( 'product_price' ) );
var quantity = Number( model.get( 'value' ) );
var newTotal = quantity * productPrice;
this.productTotals[ productID ] = newTotal;
this.updateTotal();
},
updateTotal: function(){
var newTotal = 0;
for( var product in this.productTotals ){
newTotal += Number( this.productTotals[ product ] );
}
if( newTotal && this.shippingCost ) {
// Only add shipping if there is a cost.
newTotal += Number(this.shippingCost);
}
this.totalModel.set( 'value', newTotal.toFixed( 2 ) );
this.totalModel.trigger( 'reRender' );
}
});
return controller;
});
define('controllers/fieldQuantity',[], function() {
var controller = Marionette.Object.extend( {
initialize: function() {
this.listenTo( nfRadio.channel( 'quantity' ), 'init:model', this.registerQuantity );
},
registerQuantity: function( model ){
var productID = model.get( 'product_assignment' );
var product = nfRadio.channel( 'fields' ).request( 'get:field', productID );
if( product ) {
product.set('product_use_quantity', 0);
}
},
});
return controller;
});
/**
* Model that represents a calculation.
*
* On init, we trigger a radio message so that controllers can do things when a calc model inits.
*/
define( 'models/calcModel',[], function() {
var model = Backbone.Model.extend( {
initialize: function() {
// Set our form id
this.set( 'formID', this.collection.options.formModel.get( 'id' ) );
// Set our initial fields object to empty. This will hold our key/value pairs.
this.set( 'fields', {} );
// Trigger a radio message to let controllers know we've inited this model.
nfRadio.channel( 'calc' ).trigger( 'init:model', this );
// When we change the value of this calculation, send out a radio message
this.on( 'change:value', this.changeValue, this );
},
/**
* Trigger a radio message when a field present in our calculation changes
*
* The listener that triggers/calls this function is in controllers/calculations
*
* @since 3.0
* @return void
*/
changeField: function( fieldModel ) {
nfRadio.channel( 'calc' ).trigger( 'change:field', this, fieldModel );
},
changeCalc: function( targetCalcModel ) {
nfRadio.channel( 'calc' ).trigger( 'change:calc', this, targetCalcModel );
},
changeValue: function() {
nfRadio.channel( 'calc' ).trigger( 'change:value', this );
}
} );
return model;
} );
define( 'models/calcCollection',['models/calcModel'], function( CalcModel ) {
var collection = Backbone.Collection.extend( {
model: CalcModel,
comparator: 'order',
initialize: function( models, options ) {
this.options = options;
_.each( models, function( model ) {
if( 'undefined' == typeof model.dec ) return;
if ( '' === model.dec.toString().trim() ) model.dec = 2;
model.dec = parseInt( model.dec );
} );
/*
* Respond to requests for our calc model
*/
nfRadio.channel( 'form-' + options.formModel.get( 'id' ) ).reply( 'get:calc', this.getCalc, this );
},
getCalc: function( key ) {
return this.findWhere( { name: key } );
}
} );
return collection;
} );
/**
* Controller responsible for keeping up with calculations.
*/
define('controllers/calculations',['models/calcCollection'], function( CalcCollection ) {
var controller = Marionette.Object.extend( {
initialize: function() {
this.calcs = {};
this.displayFields = {};
// When our form initialises, check to see if there are any calculations that need to be tracked.
this.listenTo( nfRadio.channel( 'form' ), 'loaded', this.registerCalcs );
// When our collection gets reset, reset calculation tracking as well.
this.listenTo( nfRadio.channel( 'fields' ), 'reset:collection', this.resetCalcs );
// When a calc model is initialised, run a setup function.
// this.listenTo( nfRadio.channel( 'calc' ), 'init:model', this.setupCalc );
// When a field referenced by a calc model changes, update our calc.
this.listenTo( nfRadio.channel( 'calc' ), 'change:field', this.changeField );
// When a calculation referenced by a calc model changes, update our calc.
this.listenTo( nfRadio.channel( 'calc' ), 'change:calc', this.changeCalc );
/*
* Listen to our field model init for fields that want to display calc values.
* If that field has a calc merge tag, replace it with the default calc value.
*/
var that = this;
_.each( nfFrontEnd.use_merge_tags.calculations, function( fieldType ) {
that.listenTo( nfRadio.channel( 'fields-' + fieldType ), 'init:model', that.initDisplayField );
} );
// When we change our calc value, update any display fields.
this.listenTo( nfRadio.channel( 'calc' ), 'change:value', this.updateDisplayFields );
// Set an init variable so that we only call reRender on the display field on change, not on init.
this.init = {};
},
/**
* Passthrough function to reset tracking of calculations when the fieldCollection is reset.
*
* @since 3.2
* @param backbone.collection fieldCollection
* @return void
*/
resetCalcs: function( fieldCollection ) {
if( 'undefined' != typeof( fieldCollection.options.formModel ) ) {
this.registerCalcs( fieldCollection.options.formModel );
}
},
/**
* When our form loads, create a collection out of any calculations.
*
* @since 3.0
* @param backbone.model formModel
* @return void
*/
registerCalcs: function( formModel ) {
var calcCollection = new CalcCollection( formModel.get( 'settings' ).calculations, { formModel: formModel } );
this.calcs[ formModel.get( 'id' ) ] = calcCollection;
var that = this;
_.each( calcCollection.models, function( calcModel ) {
/*
* We set a property on our init variable for the calc model we're looping over.
* This property is set to true so that when we make changes to the calc model on the next line
* the field view doesn't try to redraw itself.
* If we don't do this, the 'reRender' attribute of the model will be set before the view is initialized,
* which means that setting 'reRender' to true will never re-render the view.
*/
that.init[ calcModel.get( 'name' ) ] = true;
// Setup our calculation models with initial values and register listeners for calc-related fields.
that.setupCalc( calcModel );
} );
},
/**
* When a calculation model is instantiated from the registerCalcs function:
*
* Use a regex to get an array of the field keys
* Setup an initial key/values array
* Check for any references to other calculations
* Set the initial value of our calculation
*
* @since 3.0
* @param backbone.model calcModel
* @return void
*/
setupCalc: function( calcModel ) {
// Setup our that var so we can access 'this' context in our loop.
var that = this;
// Get our equation
var eq = calcModel.get( 'eq' );
// We want to keep our original eq intact, so we use a different var for string replacment.
var eqValues = eq;
// Store the name for debugging later.
var calcName = calcModel.get( 'name' );
/* TODO:
* It might be possible to refactor these two if statements.
* The difficulty is that each has a different method of retreiving the specific data model.
*/
// Check to see if we have any field merge tags in our equation.
var fields = eq.match( new RegExp( /{field:(.*?)}/g ) );
if ( fields ) {
/*
* fields is now an array of field keys that looks like:
* ['{field:key'], ['{field:key'], etc.
*
* We need to run a function with each of our field keys to setup our field key array and hook up our field change listner.
*/
fields = fields.map( function( field ) {
// field will be {field:key}
var key = field.replace( ':calc}', '' ).replace( '}', '' ).replace( '{field:', '' );
// Get our field model
fieldModel = nfRadio.channel( 'form-' + calcModel.get( 'formID' ) ).request( 'get:fieldByKey', key );
if( 'undefined' == typeof fieldModel ) return;
fieldModel.set( 'clean', false );
// Register a listener in our field model for value changes.
fieldModel.on( 'change:value', calcModel.changeField, calcModel );
// Get our calc value from our field model.
var calcValue = that.getCalcValue( fieldModel );
// Add this field to our internal key/value object.
that.updateCalcFields( calcModel, key, calcValue );
// Update the string tracking our merged eq with the calc value.
eqValues = that.replaceKey( 'field', key, calcValue, eqValues );
} );
}
// Check to see if we have any calc merge tags in our equation.
var calcs = eq.match( new RegExp( /{calc:(.*?)}/g ) );
if ( calcs ) {
/*
* calcs is now an array of calc keys that looks like:
* ['{calc:key'], ['{calc:key'], etc.
*
* We need to run a function with each of our calc keys to setup our calc key array and hook up our calc change listner.
*/
calcs = calcs.map( function( calc ) {
// calc will be {calc:name}
var name = calc.replace( '}', '' ).replace( '{calc:', '' );
// Get our calc model
var targetCalcModel = calcModel.collection.findWhere( { name: name } );
if( 'undefined' == typeof targetCalcModel ) return;
// Listen for changes on our calcluation, since we need to update our calc when it changes.
targetCalcModel.on( 'change:value', calcModel.changeCalc, calcModel );
// // Get our calc value from our calc model.
var calcValue = targetCalcModel.get( 'value' );
// Update the string tracking our merged eq with the calc value.
eqValues = that.replaceKey( 'calc', name, calcValue, eqValues );
} );
}
// Scrub unmerged tags (ie deleted/nox-existent fields/calcs, etc).
eqValues = eqValues.replace( /{([a-zA-Z0-9]|:|_|-)*}/g, 0 );
// Scrub line breaks.
eqValues = eqValues.replace( /\r?\n|\r/g, '' );
// Evaluate the equation and update the value of this model.
try {
this.debug('Calculation Decoder ' + eqValues + ' -> ' + this.localeDecodeEquation(eqValues) + ' (Setup)');
calcModel.set( 'value', Number( mexp.eval( this.localeDecodeEquation(eqValues) ) ).toFixed( calcModel.get( 'dec' ) ) );
} catch( e ) {
//console.log( calcName );
console.log( e );
}
// If for whatever reason, we got NaN, reset that to 0.
if( calcModel.get( 'value' ) === 'NaN' ) calcModel.set( 'value', '0' );
// Debugging console statement.
// console.log( eqValues + ' = ' + calcModel.get( 'value' ) );
},
/**
* Update an item in our key/value pair that represents our fields and calc values.
*
* @since 3.0
* @param backbone.model calcModel
* @param string key
* @param string calcValue
* @return void
*/
updateCalcFields: function( calcModel, key, calcValue ) {
var fields = calcModel.get( 'fields' );
fields[ key ] = calcValue;
calcModel.set( 'fields', fields );
},
/**
* Get a calc value from a field model.
*
* Sends a request to see if there's a special calc value
* Uses the value of the field if there is not.
*
* @since 3.0
* @param backbone.model fieldModel
* @return value
*/
getCalcValue: function( fieldModel ) {
/*
* Send out a request on the field type and parent type channel asking if they need to modify the calc value.
* This is helpful for fields like lists that can have a different calc_value than selected value.
*/
var value = nfRadio.channel( fieldModel.get( 'type' ) ).request( 'get:calcValue', fieldModel );
var localeConverter = new nfLocaleConverter(nfi18n.siteLocale, nfi18n.thousands_sep, nfi18n.decimal_point);
var calcValue = value || fieldModel.get( 'value' );
var machineNumber = localeConverter.numberDecoder(calcValue);
var formattedNumber = localeConverter.numberEncoder(calcValue);
if ( 'undefined' !== typeof machineNumber && jQuery.isNumeric( machineNumber ) ) {
value = formattedNumber;
} else {
value = 0;
}
// }
if ( ! fieldModel.get( 'visible' ) ) {
value = 0;
}
return value;
},
/**
* Replace instances of key with calcValue. This is used to replace one key at a time.
*
* If no eq is passed, use calcModel eq.
*
* Returns a string with instances of key replaced with calcValue.
*
* @since version
* @param string key
* @param string calcValue
* @param string eq
* @return string eq
*/
replaceKey: function( type, key, calcValue, eq ) {
eq = eq || calcModel.get( 'eq' );
tag = '{' + type + ':' + key + '}';
var reTag = new RegExp( tag, 'g' );
calcTag = '{' + type + ':' + key + ':calc}';
var reCalcTag = new RegExp( calcTag, 'g' );
eq = eq.replace( reTag, calcValue );
eq = eq.replace( reCalcTag, calcValue );
return eq;
},
/**
* Takes a calcModel and returns a string eq with all keys replaced by their appropriate calcValues.
*
* @since 3.0
* @param backbone.model calcModel
* @return string eq
*/
replaceAllKeys: function( calcModel ) {
var eq = calcModel.get( 'eq' );
var that = this;
_.each( calcModel.get( 'fields' ), function( value, key ) {
eq = that.replaceKey( 'field', key, value, eq );
} );
// If we have any calc merge tags, replace those as well.
var calcs = eq.match( new RegExp( /{calc:(.*?)}/g ) );
if ( calcs ) {
_.each( calcs, function( calc ) {
// calc will be {calc:key}
var name = calc.replace( '}', '' ).replace( '{calc:', '' );
var targetCalcModel = calcModel.collection.findWhere( { name: name } );
if( 'undefined' == typeof targetCalcModel ) return;
var re = new RegExp( calc, 'g' );
eq = eq.replace( re, targetCalcModel.get( 'value' ) );
} );
}
return eq;
},
/**
* Function that's called when a field within the calculation changes.
*
* @since 3.0
* @param backbone.model calcModel
* @param backbone.model fieldModel
* @return void
*/
changeField: function( calcModel, fieldModel ) {
var key = fieldModel.get( 'key' );
var value = this.getCalcValue( fieldModel );
this.updateCalcFields( calcModel, key, value );
var eqValues = this.replaceAllKeys( calcModel );
// Scrub unmerged tags (ie deleted/nox-existent fields/calcs, etc).
eqValues = eqValues.replace( /{([a-zA-Z0-9]|:|_|-)*}/g, '0' );
eqValues = eqValues.replace( /\r?\n|\r/g, '' );
try {
this.debug('Calculation Decoder ' + eqValues + ' -> ' + this.localeDecodeEquation(eqValues) + ' (Change Field)');
calcModel.set( 'value', Number( mexp.eval( this.localeDecodeEquation(eqValues) ) ).toFixed( calcModel.get( 'dec' ) ) );
} catch( e ) {
if(this.debug())console.log( e );
}
if( calcModel.get( 'value' ) === 'NaN' ) calcModel.set( 'value', '0' );
// Debugging console statement.
// console.log( eqValues + ' = ' + calcModel.get( 'value' ) );
},
initDisplayField: function( fieldModel ) {
if( ! fieldModel.get( 'default' ) || 'string' != typeof fieldModel.get( 'default' ) ) return;
var calcs = fieldModel.get( 'default' ).match( new RegExp( /{calc:(.*?)}/g ) );
if ( calcs ) {
_.each( calcs, function( calcName ) {
calcName = calcName.replace( '{calc:', '' ).replace( '}', '' ).replace( ':2', '' );
this.displayFields[ calcName ] = this.displayFields[ calcName ] || [];
this.displayFields[ calcName ].push( fieldModel );
}, this );
}
},
updateDisplayFields: function( calcModel ) {
var that = this;
if ( 'undefined' != typeof this.displayFields[ calcModel.get( 'name' ) ] ) {
_.each( this.displayFields[ calcModel.get( 'name' ) ], function( fieldModel ) {
var value = '';
/**
* if we have a html field, we want to use the actual
* value and re-evaluate
**/
if( "html" === fieldModel.get( 'type' ) ) {
value = fieldModel.get( 'value' );
} else {
// if not a html field, use default to re-evaluate
value = fieldModel.get( 'default' );
}
/*
This is a fix for the issue of the merge tags being
display'd
*/
// Find spans with calc data-key values
var spans = value.match( new RegExp( /(.*?)<\/span>/, "" ) + "}";
value = value.replace( spanVar, tmpCalcTag );
} );
var calcs = value.match( new RegExp( /{calc:(.*?)}/g ) );
_.each( calcs, function( calc ) {
// var rounding = false;
// calc will be {calc:key} or {calc:key:2}
var name = calc.replace( '}', '' ).replace( '{calc:', '' ).replace( ':2', '' );
/*
* TODO: Bandaid for rounding calculations to two decimal places when displaying the merge tag.
* Checks to see if we have a :2. If we do, remove it and set our rounding variable to true.
*/
// if ( -1 != name.indexOf( ':2' ) ) {
// rounding = true;
// name = name.replace( ':2', '' );
// }
var calcModel = that.calcs[ fieldModel.get( 'formID' ) ].findWhere( { name: name } );
var re = new RegExp( calc, 'g' );
var calcValue = calcModel.get( 'value' ) ;
// if ( rounding ) {
// calcValue = calcValue.toFixed( 2 );
// rounding = false;
// }
if( 'undefined' != typeof( calcValue ) ) {
calcValue = that.applyLocaleFormatting( calcValue, calcModel );
}
/*
* We replace the merge tag with the value
* surrounded by a span so that we can still find it
* and not affect itself or other field merge tags
*
* Unless this isn't a html field, then we just set
* value to calcValue
*/
if( "html" === fieldModel.get( 'type' ) ) {
value = value.replace(re, ""
+ calcValue + " ");
} else {
value = calcValue;
}
} );
fieldModel.set( 'value', value );
if ( ! that.init[ calcModel.get( 'name' ) ] ) {
// fieldModel.set( 'reRender', true );
fieldModel.trigger( 'reRender' );
}
that.init[ calcModel.get( 'name' ) ] = false;
} );
}
},
getCalc: function( name, formID ) {
return this.calcs[ formID ].findWhere( { name: name } );
},
changeCalc: function( calcModel, targetCalcModel ) {
var eqValues = this.replaceAllKeys( calcModel );
eqValues = eqValues.replace( '[', '' ).replace( ']', '' );
eqValues = eqValues.replace( /\r?\n|\r/g, '' );
try {
this.debug('Calculation Decoder ' + eqValues + ' -> ' + this.localeDecodeEquation(eqValues) + ' (Change Calc)');
calcModel.set( 'value', Number( mexp.eval( this.localeDecodeEquation( eqValues ) ) ).toFixed( calcModel.get( 'dec' ) ) );
} catch( e ) {
console.log( e );
}
if( calcModel.get( 'value' ) === 'NaN' ) calcModel.set( 'value', '0' );
},
/**
* Function to apply Locale Formatting to Calculations
* @since Version 3.1
* @param Str number
*
* @return Str
*/
applyLocaleFormatting: function( number, calcModel ) {
var localeConverter = new nfLocaleConverter(nfi18n.siteLocale, nfi18n.thousands_sep, nfi18n.decimal_point);
var formattedNumber = localeConverter.numberEncoder(number, calcModel.get('dec'));
// // Split our string on the decimal to preserve context.
// var splitNumber = number.split('.');
// // If we have more than one element (if we had a decimal point)...
// if ( splitNumber.length > 1 ) {
// // Update the thousands and remerge the array.
// splitNumber[ 0 ] = splitNumber[ 0 ].replace( /\B(?=(\d{3})+(?!\d))/g, nfi18n.thousands_sep );
// var formattedNumber = splitNumber.join( nfi18n.decimal_point );
// }
// // Otherwise (we had no decimal point)...
// else {
// // Update the thousands.
// var formattedNumber = number.replace( /\B(?=(\d{3})+(?!\d))/g, nfi18n.thousands_sep );
// }
return formattedNumber;
},
localeDecodeEquation: function( eq ) {
var result = '';
var expression = '';
var pattern = /[0-9.,]/;
var localeConverter = new nfLocaleConverter(nfi18n.siteLocale, nfi18n.thousands_sep, nfi18n.decimal_point);
// This pattern accounts for all whitespace characters (including thin space).
eq = eq.replace( /\s/g, '' );
eq = eq.replace( / /g, '' );
var characters = eq.split('');
// foreach ( characters as character ) {
characters.forEach( function( character ) {
// If the character is numeric or '.' or ','
if (pattern.test(character)) {
expression = expression + character;
} else {
// If we reach an operator char, append the expression to the result
if ( 0 < expression.length ) {
result = result + localeConverter.numberDecoder( expression );
expression = '';
}
result = result + character;
}
});
// The following catches the case of the last character being a digit.
if ( 0 < expression.length ) {
result = result + localeConverter.numberDecoder( expression );
}
return result;
},
debug: function(message) {
if ( window.nfCalculationsDebug || false ) console.log(message);
}
});
return controller;
} );
define('controllers/dateBackwardsCompat',[], function() {
var controller = Marionette.Object.extend({
initialize: function () {
this.listenTo( Backbone.Radio.channel( 'pikaday-bc' ), 'init', this.dateBackwardsCompat );
},
dateBackwardsCompat: function( dateObject, fieldModel ) {
/**
* Start backwards compatibility for old pikaday customisation
*/
// Legacy properties
dateObject.pikaday = {};
dateObject.pikaday._o = {};
//Old hook for Pikaday Custom code
nfRadio.channel( 'pikaday' ).trigger( 'init', dateObject, fieldModel );
// If we've set a disableDayFn property in custom code, hook it up to Flatpickr
if ( typeof dateObject.pikaday._o.disableDayFn !== 'undefined') {
dateObject.set( 'disable', [ dateObject.pikaday._o.disableDayFn ] );
}
//Compatibility for i18n pikaday function
if ( typeof dateObject.pikaday._o.i18n !== 'undefined' || typeof dateObject.pikaday._o.firstDay !== 'undefined') {
let locale = dateObject.config.locale;
if ( typeof dateObject.pikaday._o.firstDay !== 'undefined') {
locale.firstDayOfWeek = dateObject.pikaday._o.firstDay;
}
if ( typeof dateObject.pikaday._o.i18n !== 'undefined') {
if ( typeof dateObject.pikaday._o.i18n.weekdays !== 'undefined') {
locale.weekdays.longhand = dateObject.pikaday._o.i18n.weekdays;
}
if ( typeof dateObject.pikaday._o.i18n.weekdaysShort !== 'undefined') {
locale.weekdays.shorthand = dateObject.pikaday._o.i18n.weekdaysShort;
}
if ( typeof dateObject.pikaday._o.i18n.months !== 'undefined') {
jQuery( '.flatpickr-monthDropdown-months > option' ).each( function() {
this.text = dateObject.pikaday._o.i18n.months[ this.value ];
} );
}
}
dateObject.set( 'locale', locale );
}
if ( Object.keys(dateObject.pikaday._o).length > 0 ) {
console.log("%cDeprecated Ninja Forms Pikaday custom code detected.", "color: Red; font-size: large");
console.log("You are using deprecated Ninja Forms Pikaday custom code. Support for this custom code will be removed in a future version of Ninja Forms. Please contact Ninja Forms support for more details.");
}
}
});
return controller;
});
define('controllers/fieldDate',[], function() {
var controller = Marionette.Object.extend({
initialize: function () {
this.listenTo( nfRadio.channel( 'date' ), 'render:view', this.initDatepicker );
},
initDatepicker: function ( view ) {
var dateFormat = view.model.get( 'date_format' );
// For "default" date format, convert PHP format to JS compatible format.
if( '' == dateFormat || 'default' == dateFormat ){
dateFormat = this.convertDateFormat( nfi18n.dateFormat );
}
var el = jQuery( view.el ).find( '.nf-element' )[0];
var dateSettings = {
classes: jQuery( el ).attr( "class" ),
placeholder: view.model.get( 'placeholder' ),
parseDate: function (datestr, format) {
return moment(datestr, format, true).toDate();
},
formatDate: function (date, format, locale) {
return moment(date).format(format);
},
dateFormat: dateFormat,
altFormat: dateFormat,
altInput: true,
ariaDateFormat: dateFormat,
mode: "single",
disableMobile: "true",
locale: {
months: {
shorthand: nfi18n.monthsShort,
longhand: nfi18n.months
},
weekdays: {
shorthand: nfi18n.weekdaysShort,
longhand: nfi18n.weekdays
},
firstDayOfWeek: nfi18n.startOfWeek,
}
};
var dateObject = flatpickr( el, dateSettings );
if ( 1 == view.model.get( 'date_default' ) ) {
dateObject.setDate( moment().format(dateFormat) );
}
//Trigger Pikaday backwards compatibility
nfRadio.channel( 'pikaday-bc' ).trigger( 'init', dateObject, view.model );
nfRadio.channel( 'flatpickr' ).trigger( 'init', dateObject, view.model );
},
getYearRange: function( fieldModel ) {
var yearRange = 10;
var yearRangeStart = fieldModel.get( 'year_range_start' );
var yearRangeEnd = fieldModel.get( 'year_range_end' );
if( yearRangeStart && yearRangeEnd ){
return [ yearRangeStart, yearRangeEnd ];
} else if( yearRangeStart ) {
yearRangeEnd = yearRangeStart + yearRange;
return [ yearRangeStart, yearRangeEnd ];
} else if( yearRangeEnd ) {
yearRangeStart = yearRangeEnd - yearRange;
return [ yearRangeStart, yearRangeEnd ];
}
return yearRange;
},
getMinDate: function( fieldModel ) {
var minDate = null;
var yearRangeStart = fieldModel.get( 'year_range_start' );
if( yearRangeStart ) {
return new Date( yearRangeStart, 0, 1 );
}
return minDate;
},
getMaxDate: function( fieldModel ) {
var maxDate = null;
var yearRangeEnd = fieldModel.get( 'year_range_end' );
if( yearRangeEnd ) {
return new Date( yearRangeEnd, 11, 31 );
}
return maxDate;
},
convertDateFormat: function( dateFormat ) {
// http://php.net/manual/en/function.date.php
// https://github.com/dbushell/Pikaday/blob/master/README.md#formatting **** Switched to flatpickr ***
// Note: Be careful not to add overriding replacements. Order is important here.
/** Day */
dateFormat = dateFormat.replace( 'D', 'ddd' ); // @todo Ordering issue?
dateFormat = dateFormat.replace( 'd', 'DD' );
dateFormat = dateFormat.replace( 'l', 'dddd' );
dateFormat = dateFormat.replace( 'j', 'D' );
dateFormat = dateFormat.replace( 'N', '' ); // Not Supported
dateFormat = dateFormat.replace( 'S', '' ); // Not Supported
dateFormat = dateFormat.replace( 'w', 'd' );
dateFormat = dateFormat.replace( 'z', '' ); // Not Supported
/** Week */
dateFormat = dateFormat.replace( 'W', 'W' );
/** Month */
dateFormat = dateFormat.replace( 'M', 'MMM' ); // "M" before "F" or "m" to avoid overriding.
dateFormat = dateFormat.replace( 'F', 'MMMM' );
dateFormat = dateFormat.replace( 'm', 'MM' );
dateFormat = dateFormat.replace( 'n', 'M' );
dateFormat = dateFormat.replace( 't', '' ); // Not Supported
// Year
dateFormat = dateFormat.replace( 'L', '' ); // Not Supported
dateFormat = dateFormat.replace( 'o', 'YYYY' );
dateFormat = dateFormat.replace( 'Y', 'YYYY' );
dateFormat = dateFormat.replace( 'y', 'YY' );
// Time - Not supported
dateFormat = dateFormat.replace( 'a', '' );
dateFormat = dateFormat.replace( 'A', '' );
dateFormat = dateFormat.replace( 'B', '' );
dateFormat = dateFormat.replace( 'g', '' );
dateFormat = dateFormat.replace( 'G', '' );
dateFormat = dateFormat.replace( 'h', '' );
dateFormat = dateFormat.replace( 'H', '' );
dateFormat = dateFormat.replace( 'i', '' );
dateFormat = dateFormat.replace( 's', '' );
dateFormat = dateFormat.replace( 'u', '' );
dateFormat = dateFormat.replace( 'v', '' );
// Timezone - Not supported
dateFormat = dateFormat.replace( 'e', '' );
dateFormat = dateFormat.replace( 'I', '' );
dateFormat = dateFormat.replace( 'O', '' );
dateFormat = dateFormat.replace( 'P', '' );
dateFormat = dateFormat.replace( 'T', '' );
dateFormat = dateFormat.replace( 'Z', '' );
// Full Date/Time - Not Supported
dateFormat = dateFormat.replace( 'c', '' );
dateFormat = dateFormat.replace( 'r', '' );
dateFormat = dateFormat.replace( 'u', '' );
return dateFormat;
}
});
return controller;
});
define('controllers/fieldRecaptcha',[], function() {
var controller = Marionette.Object.extend({
initialize: function () {
this.listenTo( nfRadio.channel( 'recaptcha' ), 'init:model', this.initRecaptcha );
this.listenTo( nfRadio.channel( 'forms' ), 'submit:response', this.resetRecaptcha );
},
initRecaptcha: function ( model ) {
nfRadio.channel( 'recaptcha' ).reply( 'update:response', this.updateResponse, this, model.id );
},
updateResponse: function( response, fieldID ) {
var model = nfRadio.channel( 'fields' ).request( 'get:field', fieldID );
model.set( 'value', response );
nfRadio.channel( 'fields' ).request( 'remove:error', model.get( 'id' ), 'required-error' );
},
resetRecaptcha: function() {
var recaptchaID = 0;
jQuery( '.g-recaptcha' ).each( function() {
try {
grecaptcha.reset( recaptchaID );
} catch( e ){
console.log( 'Notice: Error trying to reset grecaptcha.' );
}
recaptchaID++;
} );
}
});
return controller;
} );
define('controllers/fieldHTML',[], function() {
var controller = Marionette.Object.extend({
htmlFields: [],
trackedMergeTags: [],
initialize: function () {
this.listenTo( Backbone.Radio.channel( 'fields-html' ), 'init:model', this.setupFieldMergeTagTracking );
},
setupFieldMergeTagTracking: function( fieldModel ) {
this.htmlFields.push( fieldModel );
var formID = fieldModel.get( 'formID' );
this.listenTo( nfRadio.channel( 'form-' + formID ), 'init:model', function( formModel ){
var mergeTags = fieldModel.get( 'default' ).match( new RegExp( /{field:(.*?)}/g ) );
if ( ! mergeTags ) return;
_.each( mergeTags, function( mergeTag ) {
var fieldKey = mergeTag.replace( '{field:', '' ).replace( '}', '' );
var fieldModel = formModel.get( 'fields' ).findWhere({ key: fieldKey });
if( 'undefined' == typeof fieldModel ) return;
this.trackedMergeTags.push( fieldModel );
this.listenTo( nfRadio.channel( 'field-' + fieldModel.get( 'id' ) ), 'change:modelValue', this.updateFieldMergeTags );
}, this );
// Let's get this party started!
this.updateFieldMergeTags();
}, this );
},
updateFieldMergeTags: function( fieldModel ) {
_.each( this.htmlFields, function( htmlFieldModel ){
var value = htmlFieldModel.get( 'value' );
_.each( this.trackedMergeTags, function( fieldModel ){
/* Search the value for any spans with mergetag data-key
* values
*/
var spans = value.match( new RegExp( /"
+ fieldModel.get( 'value' ) + " " );
}, this ) ;
htmlFieldModel.set( 'value', value );
htmlFieldModel.trigger( 'reRender' );
}, this );
}
});
return controller;
});
/**
* When a form is loaded, enable any help text that appears on the page.
*/
define('controllers/helpText',[], function() {
var controller = Marionette.Object.extend( {
initialize: function() {
this.listenTo( nfRadio.channel( 'form' ), 'render:view', this.initHelpText );
nfRadio.channel( 'form' ).reply( 'init:help', this.initHelpText );
},
initHelpText: function( view ) {
jQuery( view.el ).find( '.nf-help' ).each( function() {
var jBox = jQuery( this ).jBox( 'Tooltip', {
theme: 'TooltipBorder',
content: jQuery( this ).data( 'text' )
});
} );
}
});
return controller;
} );
define('controllers/fieldTextbox',[], function() {
var controller = Marionette.Object.extend( {
initialize: function() {
nfRadio.channel( 'textbox' ).reply( 'get:calcValue', this.getCalcValue, this );
},
getCalcValue: function( fieldModel ) {
if('currency' == fieldModel.get('mask')){
var form = nfRadio.channel( 'app' ).request( 'get:form', fieldModel.get( 'formID' ) );
var currencySymbol = ('undefined' !== typeof form) ? form.get( 'currencySymbol' ) : '';
var currencySymbolDecoded = jQuery(' ').html(currencySymbol).text();
return fieldModel.get( 'value' ).replace(currencySymbolDecoded, '');
}
return fieldModel.get( 'value' );
},
});
return controller;
} );
/**
* When a form is loaded, enable any rtes in textareas.
*/
define('controllers/fieldTextareaRTE',[], function() {
var controller = Marionette.Object.extend( {
initialize: function() {
this.listenTo( nfRadio.channel( 'textarea' ), 'render:view', this.initTextareaRTEs );
this.listenTo( nfRadio.channel( 'textarea' ), 'click:extra', this.clickExtra );
// Instantiates the variable that holds the media library frame.
this.meta_image_frame;
this.currentContext = {};
if( 'undefined' == typeof jQuery.summernote ) return;
jQuery.summernote.options.icons = {
'align': 'dashicons dashicons-editor-alignleft',
'alignCenter': 'dashicons dashicons-editor-aligncenter',
'alignJustify': 'dashicons dashicons-editor-justify',
'alignLeft': 'dashicons dashicons-editor-alignleft',
'alignRight': 'dashicons dashicons-editor-alignright',
'indent': 'dashicons dashicons-editor-indent',
'outdent': 'dashicons dashicons-editor-outdent',
// 'arrowsAlt': 'dashicons fa-arrows-alt',
'bold': 'dashicons dashicons-editor-bold',
'caret': 'dashicons dashicons-arrow-down',
// 'circle': 'dashicons fa-circle',
'close': 'dashicons dashicons-dismiss',
'code': 'dashicons dashicons-editor-code',
'eraser': 'dashicons dashicons-editor-removeformatting',
// 'font': 'dashicons fa-font',
// 'frame': 'dashicons fa-frame',
'italic': 'dashicons dashicons-editor-italic',
'link': 'dashicons dashicons-admin-links',
'unlink': 'dashicons dashicons-editor-unlink',
'magic': 'dashicons dashicons-editor-paragraph',
// 'menuCheck': 'dashicons fa-check',
'minus': 'dashicons dashicons-minus',
'orderedlist': 'dashicons dashicons-editor-ol',
// 'pencil': 'dashicons fa-pencil',
// 'picture': 'dashicons fa-picture-o',
// 'question': 'dashicons fa-question',
'redo': 'dashicons dashicons-redo',
'square': 'dashicons fa-square',
// 'strikethrough': 'dashicons fa-strikethrough',
// 'subscript': 'dashicons fa-subscript',
// 'superscript': 'dashicons fa-superscript',
'table': 'dashicons dashicons-editor-table',
// 'textHeight': 'dashicons fa-text-height',
// 'trash': 'dashicons fa-trash',
'underline': 'dashicons dashicons-editor-underline',
'undo': 'dashicons dashicons-undo',
'unorderedlist': 'dashicons dashicons-editor-ul',
// 'video': 'dashicons fa-youtube-play'
};
},
initTextareaRTEs: function( view ) {
if ( 1 != view.model.get( 'textarea_rte' ) ) {
return false;
}
/*
* Custom Button for links
*/
var that = this;
// var linkButton = this.linkButton();
var linkButton = function( context ) {
return that.linkButton( context );
}
var mediaButton = function( context ) {
return that.mediaButton( context );
}
var toolbar = [
[ 'paragraphStyle', ['style'] ],
[ 'fontStyle', [ 'bold', 'italic', 'underline','clear' ] ],
[ 'lists', [ 'ul', 'ol' ] ],
[ 'paragraph', [ 'paragraph' ] ],
[ 'customGroup', [ 'linkButton', 'unlink' ] ],
[ 'table', [ 'table' ] ],
[ 'actions', [ 'undo', 'redo' ] ],
];
if ( 1 == view.model.get( 'textarea_media' ) && 0 != userSettings.uid ) {
toolbar.push( [ 'tools', [ 'mediaButton' ] ] );
}
jQuery( view.el ).find( '.nf-element' ).summernote( {
toolbar: toolbar,
buttons: {
linkButton: linkButton,
mediaButton: mediaButton
},
height: 150, //set editable area's height
codemirror: { // codemirror options
theme: 'monokai',
lineNumbers: true
},
prettifyHtml: true,
callbacks: {
onChange: function( e ) {
view.model.set( 'value', jQuery( this ).summernote( 'code' ) );
}
}
} );
var linkMenu = jQuery( view.el ).find( '.link-button' ).next( '.dropdown-menu' ).find( 'button' );
linkMenu.replaceWith(function () {
return jQuery( '
', {
class: jQuery( linkMenu ).attr( 'class' ),
html: this.innerHTML
} );
} );
},
linkButton: function( context ) {
var that = this;
var ui = jQuery.summernote.ui;
var linkButton = nfRadio.channel( 'app' ).request( 'get:template', '#tmpl-nf-rte-link-button' );
var linkDropdown = nfRadio.channel( 'app' ).request( 'get:template', '#tmpl-nf-rte-link-dropdown' );
return ui.buttonGroup([
ui.button({
className: 'dropdown-toggle link-button',
contents: linkButton({}),
tooltip: nfi18n.fieldTextareaRTEInsertLink,
click: function( e ) {
that.clickLinkButton( e, context );
},
data: {
toggle: 'dropdown'
}
}),
ui.dropdown([
ui.buttonGroup({
children: [
ui.button({
contents: linkDropdown({}),
tooltip: ''
}),
]
})
])
]).render();
},
mediaButton: function( context ) {
var that = this;
var ui = jQuery.summernote.ui;
var mediaButton = nfRadio.channel( 'app' ).request( 'get:template', '#tmpl-nf-rte-media-button' );
return ui.button({
className: 'dropdown-toggle',
contents: mediaButton({}),
tooltip: nfi18n.fieldTextareaRTEInsertMedia,
click: function( e ) {
that.openMediaManager( e, context );
}
}).render();
},
openMediaManager: function( e, context ) {
context.invoke( 'editor.saveRange' );
// If the frame already exists, re-open it.
if ( this.meta_image_frame ) {
this.meta_image_frame.open();
return;
}
// Sets up the media library frame
this.meta_image_frame = wp.media.frames.meta_image_frame = wp.media({
title: nfi18n.fieldTextareaRTESelectAFile,
button: { text: 'insert' }
});
var that = this;
// Runs when an image is selected.
this.meta_image_frame.on('select', function(){
// Grabs the attachment selection and creates a JSON representation of the model.
var media_attachment = that.meta_image_frame.state().get('selection').first().toJSON();
that.insertMedia( media_attachment, context );
});
// Opens the media library frame.
this.meta_image_frame.open();
},
clickLinkButton: function ( e, context ) {
var range = context.invoke( 'editor.createRange' );
context.invoke( 'editor.saveRange' );
var text = range.toString()
this.currentContext = context;
jQuery( e.target ).closest( '.note-customGroup > .note-btn-group' ).on ('hide.bs.dropdown', function ( e ) {
return false;
});
jQuery( e.target ).closest( '.note-customGroup > .note-btn-group' ).on ('shown.bs.dropdown', function ( e ) {
jQuery( e.target ).parent().parent().find( '.link-text' ).val( text );
jQuery( e.target ).parent().parent().find( '.link-url' ).focus();
});
},
clickExtra: function( e ) {
var textEl = jQuery( e.target ).parent().find( '.link-text' );
var urlEl = jQuery( e.target ).parent().find( '.link-url' );
var isNewWindowEl = jQuery( e.target ).parent().find( '.link-new-window' );
this.currentContext.invoke( 'editor.restoreRange' );
if ( jQuery( e.target ).hasClass( 'insert-link' ) ) {
var text = textEl.val();
var url = urlEl.val();
var isNewWindow = ( isNewWindowEl.prop( 'checked' ) ) ? true: false;
if ( 0 != text.length && 0 != url.length ) {
this.currentContext.invoke( 'editor.createLink', { text:text, url: url, isNewWindow: isNewWindow } );
}
}
textEl.val( '' );
urlEl.val( '' );
isNewWindowEl.prop( 'checked', false );
jQuery( e.target ).closest( 'div.note-btn-group.open' ).removeClass( 'open' );
},
insertMedia: function( media, context ) {
context.invoke( 'editor.restoreRange' );
if ( 'image' == media.type ) {
context.invoke( 'editor.insertImage', media.url );
} else {
context.invoke( 'editor.createLink', { text: media.filename, url: media.url } );
}
}
});
return controller;
} );
define('controllers/fieldStarRating',[], function() {
var controller = Marionette.Object.extend( {
initialize: function() {
this.listenTo( nfRadio.channel( 'starrating' ), 'init:model', this.register );
this.listenTo( nfRadio.channel( 'starrating' ), 'render:view', this.initRating );
},
register: function( model ) {
model.set( 'renderRatings', this.renderRatings );
},
initRating: function( view ){
jQuery( view.el ).find( '.starrating' ).rating();
},
renderRatings: function() {
var html = document.createElement( 'span' );
// changed from 'default' to 'number_of_stars'
for (var i = 0; i <= this.number_of_stars - 1; i++) {
var template = nfRadio.channel( 'app' ).request( 'get:template', '#tmpl-nf-field-starrating-star' );
var num = i + 1;
var checked = '';
// Check to see if current 'star' matches the default value
if ( this.value == num ) {
checked = 'checked';
}
var htmlFragment = template( { id: this.id, classes: this.classes, num: num, checked: checked, required: this.required } );
html.appendChild(
document.createRange().createContextualFragment( htmlFragment )
);
}
return html.innerHTML;
}
});
return controller;
});
define('controllers/fieldTerms',[], function() {
var controller = Marionette.Object.extend( {
initialize: function() {
this.listenTo( nfRadio.channel( 'terms' ), 'init:model', this.register );
},
register: function( model ) {
// nfRadio.channel( 'field-' + this.model.get( 'id' ) ).trigger( 'click:extra', e, this.model );
this.listenTo( nfRadio.channel( 'field-' + model.get( 'id' ) ), 'click:extra', this.clickExtra );
this.listenTo( nfRadio.channel( 'field-' + model.get( 'id' ) ), 'keyup:field', this.keyUpExtra );
},
clickExtra: function( e, model ) {
var el = jQuery( e.currentTarget );
var value = el.parent().find( '.extra-value' ).val();
this.addOption( model, value );
},
keyUpExtra: function( el, model, keyCode ) {
if( 13 != keyCode ) return;
this.addOption( model, el.val() );
},
addOption: function( model, value ) {
if( ! value ) return;
var options = model.get( 'options' );
var new_option = {
label: value,
value: value,
selected: 0,
};
options.push( new_option );
var selected = model.get( 'value' );
selected.push( value );
// model.set( 'reRender', true );
model.trigger( 'reRender' );
}
});
return controller;
} );
/**
* Before we display our form content, ask if anyone wants to give us a different view.
* Before we do anything with the data, pass it through any loading filters.
*
* @package Ninja Forms builder
* @subpackage Main App
* @copyright (c) 2016 WP Ninjas
* @since 3.0
*/
define( 'controllers/formContentFilters',[], function() {
var controller = Marionette.Object.extend( {
initialize: function() {
/*
* Init our fieldContent view and load filter arrays.
*/
this.viewFilters = [];
this.loadFilters = [];
/*
* Listen for requests to add new formContent filters.
*/
nfRadio.channel( 'formContent' ).reply( 'add:viewFilter', this.addViewFilter, this );
nfRadio.channel( 'formContent' ).reply( 'add:loadFilter', this.addLoadFilter, this );
/*
* Listen for requests to get our formContent filters.
*/
nfRadio.channel( 'formContent' ).reply( 'get:viewFilters', this.getViewFilters, this );
nfRadio.channel( 'formContent' ).reply( 'get:loadFilters', this.getLoadFilters, this );
/*
* -- DEPRECATED RADIO REPLIES --
*
* The 'fieldContents' channel has been deprecated as of 3.0 (it was present in the RC) in favour of 'formContent'.
* Listen for requests to add new fieldContent filters.
*
* TODO: These radio listeners on the 'fieldContents' channels are here for backwards compatibility and should be removed eventually.
*/
nfRadio.channel( 'fieldContents' ).reply( 'add:viewFilter', this.addViewFilter, this );
nfRadio.channel( 'fieldContents' ).reply( 'add:loadFilter', this.addLoadFilter, this );
/*
* Listen for requests to get our fieldContent filters.
* TODO: Remove eventually.
*/
nfRadio.channel( 'fieldContents' ).reply( 'get:viewFilters', this.getViewFilters, this );
nfRadio.channel( 'fieldContents' ).reply( 'get:loadFilters', this.getLoadFilters, this );
/*
* -- END DEPRECATED --
*/
},
addViewFilter: function( callback, priority ) {
this.viewFilters[ priority ] = callback;
},
getViewFilters: function() {
return this.viewFilters;
},
addLoadFilter: function( callback, priority ) {
this.loadFilters[ priority ] = callback;
},
getLoadFilters: function() {
return this.loadFilters;
}
});
return controller;
} );
define( 'views/fieldItem',[], function() {
var view = Marionette.ItemView.extend({
tagName: 'div',
initialize: function() {
this.listenTo( this.model, 'reRender', this.render, this );
this.listenTo( this.model, 'change:addWrapperClass', this.addWrapperClass, this );
this.listenTo( this.model, 'change:removeWrapperClass', this.removeWrapperClass, this );
this.listenTo( this.model, 'change:invalid', this.toggleAriaInvalid, this );
this.template = '#tmpl-nf-field-' + this.model.get( 'wrap_template' );
},
test: function( model ) {
console.log( 'firing from trigger 1' );
},
addWrapperClass: function() {
var cl = this.model.get( 'addWrapperClass' );
if ( '' != cl ) {
jQuery( this.el ).addClass( cl );
this.model.set( 'addWrapperClass', '' );
}
},
removeWrapperClass: function() {
var cl = this.model.get( 'removeWrapperClass' );
if ( '' != cl ) {
jQuery( this.el ).removeClass( cl );
this.model.set( 'removeWrapperClass', '' );
}
},
toggleAriaInvalid: function() {
var invalid = this.model.get( 'invalid' );
jQuery( '[aria-invalid]', this.el ).attr( 'aria-invalid', JSON.stringify( invalid ) );
},
onRender: function() {
this.$el = this.$el.children();
this.$el.unwrap();
this.setElement( this.$el );
/*
* If we have an input mask, init that mask.
* TODO: Move this to a controller so that the logic isn't in the view.
*/
if ( 'undefined' != typeof this.model.get( 'mask' ) && '' != jQuery.trim( this.model.get( 'mask' ) ) ) {
if ( 'custom' == this.model.get( 'mask') ) {
var mask = this.model.get( 'custom_mask' );
} else {
var mask = this.model.get( 'mask' );
}
/* POLYFILL */ Number.isInteger = Number.isInteger || function(value) { return typeof value === "number" && isFinite(value) && Math.floor(value) === value; };
if ( Number.isInteger( mask ) ) {
mask = mask.toString();
}
if ( 'currency' == mask ) {
var form = nfRadio.channel( 'app' ).request( 'get:form', this.model.get( 'formID' ) );
var thousands_sep = form.get( 'thousands_sep' );
/*
* TODO: if we have a , replace it with a string with a space.
*/
if ( ' ' == thousands_sep ) {
thousands_sep = ' ';
}
var currencySymbol = jQuery( '
' ).html( form.get( 'currencySymbol' ) ).text();
thousands_sep = jQuery( '
' ).html( thousands_sep ).text();
var decimal_point = jQuery( '
' ).html( form.get( 'decimal_point' ) ).text();
/*
* TODO: Currently, these options use the plugin-wide defaults for locale.
* When per-form locales are implemented, these will need to be revisited.
*/
var autoNumericOptions = {
digitGroupSeparator : thousands_sep,
decimalCharacter : decimal_point,
currencySymbol : currencySymbol
};
// Initialization
var autoN_el = jQuery(jQuery( this.el ).find( '.nf-element' )[ 0 ]);
new AutoNumeric( jQuery( this.el ).find( '.nf-element' )[ 0 ], autoNumericOptions );
// update the value for the model so it gets saved to
// the database properly
var context = this;
autoN_el.on( 'change', function( e ) {
context.model.set( 'value', e.target.value );
})
} else {
jQuery( this.el ).find( '.nf-element' ).mask( mask );
}
}
nfRadio.channel( this.model.get( 'type' ) ).trigger( 'render:view', this );
nfRadio.channel( 'fields' ).trigger( 'render:view', this );
},
templateHelpers: function () {
var that = this;
return {
renderElement: function(){
var tmpl = _.find( this.element_templates, function( tmpl ) {
if ( 0 < jQuery( '#tmpl-nf-field-' + tmpl ).length ) {
return true;
}
} );
var template = nfRadio.channel( 'app' ).request( 'get:template', '#tmpl-nf-field-' + tmpl );
return template( this );
},
renderLabel: function() {
var template = nfRadio.channel( 'app' ).request( 'get:template', '#tmpl-nf-field-label' );
return template( this );
},
renderLabelClasses: function () {
var classes = '';
if ( 'undefined' != typeof this.customLabelClasses ) {
classes = this.customLabelClasses( classes );
}
return classes;
},
renderPlaceholder: function() {
var placeholder = this.placeholder;
if ( 'undefined' != typeof this.customPlaceholder ) {
placeholder = this.customPlaceholder( placeholder );
}
if( '' != jQuery.trim( placeholder ) ) {
return 'placeholder="' + placeholder + '"';
} else {
return '';
}
},
renderWrapClass: function() {
var wrapClass = 'field-wrap ' + this.type + '-wrap';
// Check if type and parentType are different. If, so
// then add appropriate parentType wrap class
if ( this.type !== this.parentType ) {
wrapClass = wrapClass + ' ' + this.parentType + '-wrap';
}
// If we have an old_classname defined, output wrap class for backward compatibility
if ( 'undefined' != typeof this.old_classname && 0 < jQuery.trim( this.old_classname ).length ) {
wrapClass += ' ' + this.old_classname + '-wrap';
}
if ( 'undefined' != typeof customWrapClass ) {
wrapClass = customWrapClass( wrapClass );
}
return wrapClass;
},
renderClasses: function() {
var classes = this.classes;
if ( this.error ) {
classes += ' nf-error';
} else {
classes = classes.replace( 'nf-error', '' );
}
if ( 'undefined' != typeof this.element_class && 0 < jQuery.trim( this.element_class ).length ) {
classes += ' ' + this.element_class;
}
/*
* If we have a function for adding extra classes, add those.
*/
if ( 'undefined' != typeof this.customClasses ) {
classes = this.customClasses( classes );
}
return classes;
},
maybeDisabled: function() {
if ( 1 == this.disable_input ) {
return 'disabled';
} else {
return '';
}
},
maybeRequired: function() {
if ( 1 == this.required ) {
return 'required';
} else {
return '';
}
},
maybeDisableAutocomplete: function() {
if ( 1 == this.disable_browser_autocomplete ) {
return 'autocomplete="off"';
} else {
return '';
}
},
maybeInputLimit: function() {
if ( 'characters' == this.input_limit_type && '' != jQuery.trim( this.input_limit ) ) {
return 'maxlength="' + this.input_limit + '"';
} else {
return '';
}
},
getHelpText: function() {
// this.help_text = jQuery( this.help_text ).html();
// return ( 'undefined' != typeof this.help_text ) ? this.help_text.replace(/"/g, """) : '';
return ( 'undefined' != typeof this.help_text ) ? this.help_text : '';
},
maybeRenderHelp: function() {
// use jQuery().text() to make sure help_text has actual
// text and not just HTML tags.
var check_text_par = document.createElement( 'p' );
check_text_par.innerHTML = this.help_text;
var shouldRenderHelpText = false;
// Check for text or image tags
if ( 0 != jQuery.trim( jQuery( check_text_par ).text() ).length
|| 0 < jQuery( check_text_par ).find('img').length ) {
shouldRenderHelpText = true;
}
if ( 'undefined' != typeof this.help_text && shouldRenderHelpText ) {
var icon = document.createElement( 'span' );
icon.classList.add( 'fa', 'fa-info-circle', 'nf-help' );
icon.setAttribute( 'data-text', this.getHelpText() );
return icon.outerHTML;
} else {
return '';
}
},
renderDescText: function() {
if ( 'undefined' == typeof this.desc_text ) {
return '';
}
// Creates an element so we can check to see if the text is empty.
var text = document.createElement( 'p' );
text.innerHTML = this.desc_text;
if( 0 == jQuery.trim( text.innerText ).length ) return '';
var check, checkText;
checkText = document.createTextNode( this.desc_text );
check = document.createElement( 'p' );
check.appendChild( checkText );
if ( 0 != jQuery.trim( jQuery( check ).text() ).length ) {
var descriptionText, fieldDescription;
descriptionText = document.createRange().createContextualFragment( this.desc_text );
fieldDescription = document.createElement( 'div' );
fieldDescription.classList.add( 'nf-field-description' );
fieldDescription.appendChild( descriptionText );
return fieldDescription.outerHTML;
} else {
return '';
}
},
renderNumberDefault: function() {
// If the field is clean...
if ( this.clean ) {
// If we have a default...
if ( this.default ) {
return this.default;
} // If we do not have a placeholder...
else if ( ! this.placeholder ) {
return this.value;
} // Otherwise...
else {
return '';
}
} // Otherwise... (The field is not clean.)
else {
return this.value;
}
},
renderCurrencyFormatting: function( number ) {
/*
* Our number will have a . as a decimal point. We want to replace that with our locale decimal, nfi18n.decimal_point.
*/
var replacedDecimal = number.toString().replace( '.', '||' );
/*
* Add thousands separator. Our original number var won't have thousands separators.
*/
var replacedThousands = replacedDecimal.replace( /\B(?=(\d{3})+(?!\d))/g, nfi18n.thousands_sep );
var formattedNumber = replacedThousands.replace( '||', nfi18n.decimal_point );
var form = nfRadio.channel( 'app' ).request( 'get:form', that.model.get( 'formID' ) );
var currency_symbol = form.get( 'settings' ).currency_symbol;
return currency_symbol + formattedNumber;
}
};
},
events: {
'change .nf-element': 'fieldChange',
'keyup .nf-element': 'fieldKeyup',
'click .nf-element': 'fieldClick',
'click .extra': 'extraClick',
'blur .nf-element': 'fieldBlur'
},
fieldChange: function( e ) {
var el = jQuery( e.currentTarget );
var response = nfRadio.channel( 'nfAdmin' ).request( 'change:field', el, this.model );
},
fieldKeyup: function( e ) {
var el = jQuery( e.currentTarget );
var keyCode = e.keyCode;
nfRadio.channel( 'field-' + this.model.get( 'id' ) ).trigger( 'keyup:field', el, this.model, keyCode );
nfRadio.channel( this.model.get( 'type' ) ).trigger( 'keyup:field', el, this.model, keyCode );
nfRadio.channel( 'fields' ).trigger( 'keyup:field', el, this.model, keyCode );
},
fieldClick: function( e ) {
var el = jQuery( e.currentTarget );
nfRadio.channel( 'field-' + this.model.get( 'id' ) ).trigger( 'click:field', el, this.model );
nfRadio.channel( this.model.get( 'type' ) ).trigger( 'click:field', el, this.model );
nfRadio.channel( 'fields' ).trigger( 'click:field', el, this.model );
},
extraClick: function( e ) {
nfRadio.channel( 'field-' + this.model.get( 'id' ) ).trigger( 'click:extra', e, this.model );
nfRadio.channel( this.model.get( 'type' ) ).trigger( 'click:extra', e, this.model );
nfRadio.channel( 'fields' ).trigger( 'click:extra', e, this.model );
},
fieldBlur: function( e ) {
var el = jQuery( e.currentTarget );
nfRadio.channel( 'field-' + this.model.get( 'id' ) ).trigger( 'blur:field', el, this.model );
nfRadio.channel( this.model.get( 'type' ) ).trigger( 'blur:field', el, this.model );
nfRadio.channel( 'fields' ).trigger( 'blur:field', el, this.model );
},
onAttach: function() {
nfRadio.channel( this.model.get( 'type' ) ).trigger( 'attach:view', this );
}
});
return view;
} );
define( 'views/beforeField',[], function() {
var view = Marionette.ItemView.extend({
tagName: 'nf-section',
template: '#tmpl-nf-field-before'
});
return view;
} );
define( 'views/fieldErrorItem',[], function() {
var view = Marionette.ItemView.extend({
tagName: 'nf-section',
template: '#tmpl-nf-field-error',
onRender: function() {
this.$el = this.$el.children();
this.$el.unwrap();
this.setElement( this.$el );
},
});
return view;
} );
define( 'views/fieldErrorCollection',['views/fieldErrorItem'], function( fieldErrorItem ) {
var view = Marionette.CollectionView.extend({
tagName: "nf-errors",
childView: fieldErrorItem,
initialize: function( options ) {
this.fieldModel = options.fieldModel;
},
onRender: function() {
if ( 0 == this.fieldModel.get( 'errors' ).models.length ) {
this.fieldModel.removeWrapperClass( 'nf-error' );
this.fieldModel.removeWrapperClass( 'nf-fail' );
this.fieldModel.addWrapperClass( 'nf-pass' );
this.fieldModel.setInvalid( false );
} else {
this.fieldModel.removeWrapperClass( 'nf-pass' );
this.fieldModel.addWrapperClass( 'nf-fail' );
this.fieldModel.addWrapperClass( 'nf-error' );
this.fieldModel.setInvalid( true );
}
}
});
return view;
} );
define( 'views/inputLimit',[], function() {
var view = Marionette.ItemView.extend({
tagName: 'nf-section',
template: '#tmpl-nf-field-input-limit',
initialize: function() {
this.listenTo( nfRadio.channel( 'field-' + this.model.get( 'id' ) ), 'keyup:field', this.updateCount );
this.count = this.model.get( 'input_limit' );
this.render();
},
updateCount: function( el, model ) {
var value = jQuery( el ).val();
var regex = /\s+/gi;
var words = value.trim().replace(regex, ' ').split(' ');
var wordCount = words.length;
var charCount = value.length;
/**
* PHP Config has 'char' instead of 'characters', so I changed it to
* 'characters', but added 'char' here so existing form fields will
* act correctly
**/
if ( 'characters' == this.model.get( 'input_limit_type' )
|| 'char' == this.model.get( 'input_limit_type' ) ) {
jQuery( el ).attr( 'maxlength', this.model.get( 'input_limit' ) );
this.count = this.model.get( 'input_limit' ) - charCount;
} else {
this.count = this.model.get( 'input_limit' ) - wordCount;
var limit = this.model.get( 'input_limit' );
if( wordCount > limit ){
jQuery( el ).val( words.slice( 0, limit).join( ' ' ) );
}
}
this.render();
},
templateHelpers: function() {
var that = this;
return {
currentCount: function() {
return that.count;
}
}
}
});
return view;
} );
define( 'views/afterField',['views/fieldErrorCollection', 'views/inputLimit'], function( fieldErrorCollection, InputLimitView ) {
var view = Marionette.ItemView.extend({
tagName: 'nf-section',
template: '#tmpl-nf-field-after',
initialize: function() {
this.model.on( 'change:errors', this.changeError, this );
},
onRender: function() {
/*
* If we have an error, render our error view.
* TODO: Perhaps move to a controller?
*/
var errorEl = jQuery( this.el ).children( '.nf-error-wrap' );
this.errorCollectionView = new fieldErrorCollection( { el: errorEl, collection: this.model.get( 'errors' ), fieldModel: this.model } );
if ( 0 < this.model.get( 'errors' ).length ) {
this.errorCollectionView.render();
}
/*
* If we have an input limit set, render the view that contains our counter
* TODO: Move this to a controller so that the logic isn't in the view.
*/
if ( 'undefined' != typeof this.model.get( 'input_limit' ) && '' != jQuery.trim( this.model.get( 'input_limit' ) ) ){
var inputLimitEl = jQuery( this.el ).children( '.nf-input-limit');
this.inputLimitView = new InputLimitView( { el: inputLimitEl, model: this.model } );
}
},
changeError: function() {
this.errorCollectionView.render();
},
});
return view;
} );
define( 'views/fieldLayout',['views/fieldItem', 'views/beforeField', 'views/afterField'], function( fieldItem, beforeField, afterField ) {
var view = Marionette.LayoutView.extend({
tagName: 'nf-field',
regions: {
beforeField: '.nf-before-field',
field: '.nf-field',
afterField: '.nf-after-field',
},
initialize: function() {
this.listenTo( this.model, 'change:visible', this.render, this );
},
getTemplate: function() {
if ( this.model.get( 'visible' ) ) {
return '#tmpl-nf-field-layout';
} else {
return '#tmpl-nf-empty';
}
},
onRender: function() {
if ( this.model.get( 'visible' ) ) {
this.beforeField.show( new beforeField( { model: this.model } ) );
this.field.show( new fieldItem( { model: this.model } ) );
this.afterField.show( new afterField( { model: this.model } ) );
}
},
templateHelpers: function() {
return {
renderContainerClass: function() {
var containerClass = ' label-' + this.label_pos + ' ';
// If we have a description position, add that to our container.
if ( 'undefined' != typeof this.desc_pos ) {
containerClass += 'desc-' + this.desc_pos + ' ';
}
// if we have a container_class field setting, add that to our container.
if ( 'undefined' != typeof this.container_class && 0 < jQuery.trim( this.container_class ).length ) {
containerClass += this.container_class + ' ';
}
//check if the parent type and type are different. If
// so, add parent type container styling
if( this.type !== this.parentType ) {
containerClass += ' ' + this.parentType + '-container';
}
return containerClass;
}
}
}
});
return view;
} );
/**
* Return views that might be used in extensions.
* These are un-instantiated views.
*
* @package Ninja Forms builder
* @subpackage Main App
* @copyright (c) 2015 WP Ninjas
* @since 3.0
*/
define( 'controllers/loadViews',['views/fieldItem', 'views/fieldLayout'], function( fieldItemView, fieldLayoutView ) {
var controller = Marionette.Object.extend( {
initialize: function() {
// Reply to requests for our field item view.
nfRadio.channel( 'views' ).reply( 'get:fieldItem', this.getFieldItem );
nfRadio.channel( 'views' ).reply( 'get:fieldLayout', this.getFieldLayout );
},
getFieldItem: function( model ) {
return fieldItemView;
},
getFieldLayout: function() {
return fieldLayoutView;
}
});
return controller;
} );
/**
* If a form has at least one field error, we should disable the submit button and add a form error.
* If a form had errors, but all the field errors have been removed, we should remove the form error.
*
* @since 3.0
*/
define('controllers/formErrors',[], function() {
var controller = Marionette.Object.extend( {
initialize: function() {
/*
* Listen for error messages being added to and removed from fields.
*/
this.listenTo( nfRadio.channel( 'fields' ), 'add:error', this.addError );
this.listenTo( nfRadio.channel( 'fields' ), 'remove:error', this.removeError );
/*
* Respond to requests to get form errors
*/
nfRadio.channel( 'form' ).reply( 'get:errors', this.getFormErrors );
},
addError: function( fieldModel, errorID, errorMsg ) {
var formModel = nfRadio.channel( 'app' ).request( 'get:form', fieldModel.get( 'formID' ) );
/*
* We store our errors in this object by field ID so that we don't have to loop over all our fields when we're testing for errors.
* They are stored as an object within an array, using the field ID as the key.
*
* If we haven't setup an array item for this field, set it as an object.
*/
if ( 'undefined' == typeof formModel.get( 'fieldErrors' )[ fieldModel.get( 'id' ) ] ) {
formModel.get( 'fieldErrors' )[ fieldModel.get( 'id' ) ] = {};
}
// Add an error to our tracking array
formModel.get( 'fieldErrors' )[ fieldModel.get( 'id' ) ][ errorID ] = errorMsg;
/*
* We have at least one field error, so submmission should be prevented.
* Add a form error.
*/
nfRadio.channel( 'form-' + fieldModel.get( 'formID' ) ).request( 'add:error', 'field-errors', formModel.get( 'settings' ).formErrorsCorrectErrors );
},
removeError: function( fieldModel, errorID ) {
var formModel = nfRadio.channel( 'app' ).request( 'get:form', fieldModel.get( 'formID' ) );
// Remove this error ID from our tracking array.
formModel.get( 'fieldErrors' )[ fieldModel.get( 'id' ) ] = _.omit( formModel.get( 'fieldErrors' )[ fieldModel.get( 'id' ) ], errorID );
/*
* If we don't have any more error IDs on this field, then we need to remove this field from the array.
*
* Then, if the fieldErrors tracking array has a length of 0, we remove our form error, because all field errors have been dealt with.
*/
if ( 0 == _.size( formModel.get( 'fieldErrors' )[ fieldModel.get( 'id' ) ] ) ) {
delete formModel.get( 'fieldErrors' )[ fieldModel.get( 'id' ) ];
}
if ( 0 == _.size( formModel.get( 'fieldErrors' ) ) ) {
// Remove our form error.
nfRadio.channel( 'form-' + fieldModel.get( 'formID' ) ).request( 'remove:error', 'field-errors' );
}
},
getFormErrors: function( formID ) {
var formModel = nfRadio.channel( 'app' ).request( 'get:form', formID );
var errors = false;
if ( formModel ) {
/*
* Check to see if we have any errors on our form model.
*/
if ( 0 !== formModel.get( 'errors' ).length ) {
_.each( formModel.get( 'errors' ).models, function( error ) {
errors = errors || {};
errors[ error.get( 'id' ) ] = error.get( 'msg' );
} );
}
}
return errors;
}
});
return controller;
} );
/**
* Handles submission of our form.
*/
define('controllers/submit',[], function() {
var controller = Marionette.Object.extend( {
initialize: function() {
this.listenTo( nfRadio.channel( 'forms' ), 'init:model', this.registerSubmitHandler );
},
/**
* Register the submission handler function.
*
* @since 3.0
* @param Backbone.model formModel
* @return void
*/
registerSubmitHandler: function( formModel ) {
nfRadio.channel( 'form-' + formModel.get( 'id' ) ).reply( 'submit', this.submit );
},
/**
* Handles the actual submission of our form.
* When we submit:
*
* 1) Send out a message saying that we're about to begin form submission.
* 2) Check the form for errors
* 3) Submit the data
* 4) Send out a message with our response
*
* @since 3.0
* @param Backbone.model formModel
* @return void
*/
submit: function( formModel ) {
/*
* Send out a radio message saying that we're about to begin submitting.
* First we send on the generic forms channel, and then on the form-specific channel.
*/
nfRadio.channel( 'forms' ).trigger( 'before:submit', formModel );
nfRadio.channel( 'form-' + formModel.get( 'id' ) ).trigger( 'before:submit', formModel );
/*
* Validate our field models.
*/
var validate = nfRadio.channel( 'forms' ).request( 'maybe:validate', formModel );
if( false !== validate ){
// When validating all fields, set clean to false to force validation.
_.each( formModel.get( 'fields' ).models, function( fieldModel ) {
fieldModel.set( 'clean', false );
} );
/*
* This method is defined in our models/fieldCollection.js file,
* except where overridden by an add-on (ie Layout & Styles).
*/
formModel.get( 'formContentData' ).validateFields();
}
var submit = nfRadio.channel( 'form-' + formModel.get( 'id' ) ).request( 'maybe:submit', formModel );
if ( false == submit ) {
nfRadio.channel( 'forms' ).trigger( 'submit:cancel', formModel );
nfRadio.channel( 'form-' + formModel.get( 'id' ) ).trigger( 'submit:cancel', formModel );
return;
}
if( false !== validate ){
// Ignore non-blocking errors.
var blockingFormErrors = _.filter( formModel.get( 'errors' ).models, function( error ){
// Ignore email action related errors.
if( 'invalid_email' == error.get( 'id' ) || 'email_not_sent' == error.get( 'id' ) ) return false;
return true; // Error is blocking.
});
/*
* Make sure we don't have any form errors before we submit.
* Return false if we do.
*/
if ( 0 != _.size( blockingFormErrors ) ) {
nfRadio.channel( 'forms' ).trigger( 'submit:failed', formModel );
nfRadio.channel( 'form-' + formModel.get( 'id' ) ).trigger( 'submit:failed', formModel );
return false;
}
}
/*
* Send out a radio message saying that we're about to begin submitting.
* First we send on the generic forms channel, and then on the form-specific channel.
*/
nfRadio.channel( 'forms' ).trigger( 'after:submitValidation', formModel );
nfRadio.channel( 'form-' + formModel.get( 'id' ) ).trigger( 'after:submitValidation', formModel );
/*
* Actually submit our form, and send out a message with our response.
*/
var formID = formModel.get( 'id' );
var fields = {};
_.each( formModel.get( 'fields' ).models, function( field ) {
var fieldDataDefaults = { value:field.get( 'value' ), id:field.get( 'id' ) };
// Add field data at the field ID for efficient access.
fields[ field.get( 'id' ) ] = nfRadio.channel( field.get( 'type' ) ).request( 'get:submitData', fieldDataDefaults, field ) || fieldDataDefaults;;
} );
var extra = formModel.get( 'extra' );
var settings = formModel.get( 'settings' );
delete settings.formContentData;
var formData = JSON.stringify( { id: formID, fields: fields, settings: settings, extra: extra } );
var data = {
'action': 'nf_ajax_submit',
'security': nfFrontEnd.ajaxNonce,
'nonce_ts': nfFrontEnd.nonce_ts,
'formData': formData
}
var that = this;
jQuery.ajax({
url: nfFrontEnd.adminAjax,
type: 'POST',
data: data,
cache: false,
success: function( data, textStatus, jqXHR ) {
try {
var response = data;
nfRadio.channel( 'forms' ).trigger( 'submit:response', response, textStatus, jqXHR, formModel.get( 'id' ) );
nfRadio.channel( 'form-' + formModel.get( 'id' ) ).trigger( 'submit:response', response, textStatus, jqXHR );
jQuery( document ).trigger( 'nfFormSubmitResponse', { response: response, id: formModel.get( 'id' ) } );
} catch( e ) {
console.log( e );
console.log( 'Parse Error' );
console.log( e );
}
},
error: function( jqXHR, textStatus, errorThrown ) {
// Handle errors here
console.log('ERRORS: ' + errorThrown);
console.log( jqXHR );
try {
var response = jQuery.parseJSON( jqXHR.responseText );
nfRadio.channel( 'forms' ).trigger( 'submit:response', response, textStatus, jqXHR, formModel.get( 'id' ) );
nfRadio.channel( 'form-' + formModel.get( 'id' ) ).trigger( 'submit:response', response, textStatus, jqXHR );
} catch( e ) {
console.log( 'Parse Error' );
}
// STOP LOADING SPINNER
nfRadio.channel( 'forms' ).trigger( 'submit:response', 'error', textStatus, jqXHR, errorThrown );
}
});
}
});
return controller;
} );
define( 'views/fieldCollection',['views/fieldLayout'], function( fieldLayout ) {
var view = Marionette.CollectionView.extend({
tagName: 'nf-fields-wrap',
childView: fieldLayout
});
return view;
} );
/**
* Default filters
*
* @package Ninja Forms builder
* @subpackage Main App
* @copyright (c) 2015 WP Ninjas
* @since 3.0
*/
define( 'controllers/defaultFilters',[ 'views/fieldCollection', 'models/fieldCollection' ], function( FieldCollectionView, FieldCollection ) {
var controller = Marionette.Object.extend( {
initialize: function() {
this.listenTo( nfRadio.channel( 'form' ), 'before:filterData', this.registerDefaultDataFilter );
},
registerDefaultDataFilter: function( formModel ) {
/*
* Set our default formContent load filter
*/
nfRadio.channel( 'formContent' ).request( 'add:loadFilter', this.defaultFormContentLoad, 10, this );
/*
* Set our default formContentView.
*/
nfRadio.channel( 'formContent' ).request( 'add:viewFilter', this.defaultFormContentView, 10, this );
},
defaultFormContentLoad: function( formContentData, formModel, context ) {
var fieldCollection = formModel.get( 'fields' );
/*
* If we only have one load filter, we can just return the field collection.
*/
var formContentLoadFilters = nfRadio.channel( 'formContent' ).request( 'get:loadFilters' );
var sortedArray = _.without( formContentLoadFilters, undefined );
if ( 1 == sortedArray.length || 'undefined' == typeof formContentData || true === formContentData instanceof Backbone.Collection ) return formModel.get( 'fields' );
var fieldModels = _.map( formContentData, function( key ) {
return formModel.get( 'fields' ).findWhere( { key: key } );
}, this );
var currentFieldCollection = new FieldCollection( fieldModels );
fieldCollection.on( 'reset', function( collection ) {
var resetFields = [];
currentFieldCollection.each( function( fieldModel ) {
if ( 'submit' != fieldModel.get( 'type' ) ) {
resetFields.push( collection.findWhere( { key: fieldModel.get( 'key' ) } ) );
} else {
resetFields.push( fieldModel );
}
} );
currentFieldCollection.options = { formModel: formModel };
currentFieldCollection.reset( resetFields );
} );
return currentFieldCollection;
},
defaultFormContentView: function() {
return FieldCollectionView;
}
});
return controller;
} );
/**
* Controller responsible for removing unique field errors.
*/
define('controllers/uniqueFieldError',[], function() {
var controller = Marionette.Object.extend( {
initialize: function() {
/*
* Listen to keyup and field changes.
*
* If those fields have a unique field error, remove that error.
*/
this.listenTo( nfRadio.channel( 'fields' ), 'change:modelValue', this.removeError );
this.listenTo( nfRadio.channel( 'fields' ), 'keyup:field', this.removeError );
this.listenTo( nfRadio.channel( 'fields' ), 'blur:field', this.removeError );
},
removeError: function( el, model ) {
model = model || el;
/*
* Remove any unique field errors.
*/
nfRadio.channel( 'fields' ).request( 'remove:error', model.get( 'id' ), 'unique_field' );
},
});
return controller;
} );
define(
'controllers/loadControllers',[
'controllers/formData',
'controllers/fieldError',
'controllers/changeField',
'controllers/changeEmail',
'controllers/changeDate',
'controllers/fieldCheckbox',
'controllers/fieldCheckboxList',
'controllers/fieldImageList',
'controllers/fieldRadio',
'controllers/fieldNumber',
'controllers/mirrorField',
'controllers/confirmField',
'controllers/updateFieldModel',
'controllers/submitButton',
'controllers/submitDebug',
'controllers/getFormErrors',
'controllers/validateRequired',
'controllers/submitError',
'controllers/actionRedirect',
'controllers/actionSuccess',
'controllers/fieldSelect',
'controllers/coreSubmitResponse',
'controllers/fieldProduct',
'controllers/fieldTotal',
'controllers/fieldQuantity',
'controllers/calculations',
'controllers/dateBackwardsCompat',
'controllers/fieldDate',
'controllers/fieldRecaptcha',
'controllers/fieldHTML',
'controllers/helpText',
'controllers/fieldTextbox',
'controllers/fieldTextareaRTE',
'controllers/fieldStarRating',
'controllers/fieldTerms',
'controllers/formContentFilters',
'controllers/loadViews',
'controllers/formErrors',
'controllers/submit',
'controllers/defaultFilters',
'controllers/uniqueFieldError'
],
function(
FormData,
FieldError,
ChangeField,
ChangeEmail,
ChangeDate,
FieldCheckbox,
FieldCheckboxList,
FieldImageList,
FieldRadio,
FieldNumber,
MirrorField,
ConfirmField,
UpdateFieldModel,
SubmitButton,
SubmitDebug,
GetFormErrors,
ValidateRequired,
SubmitError,
ActionRedirect,
ActionSuccess,
FieldSelect,
CoreSubmitResponse,
FieldProduct,
FieldTotal,
FieldQuantity,
Calculations,
DateBackwardsCompat,
FieldDate,
FieldRecaptcha,
FieldHTML,
HelpText,
FieldTextbox,
FieldTextareaRTE,
FieldStarRating,
FieldTerms,
FormContentFilters,
LoadViews,
FormErrors,
Submit,
DefaultFilters,
UniqueFieldError
) {
var controller = Marionette.Object.extend( {
initialize: function() {
/**
* App Controllers
*/
new LoadViews();
new FormErrors();
new Submit();
/**
* Field type controllers
*/
new FieldCheckbox();
new FieldCheckboxList();
new FieldImageList();
new FieldRadio();
new FieldNumber();
new FieldSelect();
new FieldProduct();
new FieldTotal();
new FieldQuantity();
new FieldRecaptcha();
new FieldHTML();
new HelpText();
new FieldTextbox();
new FieldTextareaRTE();
new FieldStarRating();
new FieldTerms();
new FormContentFilters();
new UniqueFieldError();
/**
* Misc controllers
*/
new FieldError();
new ChangeField();
new ChangeEmail();
new ChangeDate();
new MirrorField();
new ConfirmField();
new UpdateFieldModel();
new SubmitButton();
new SubmitDebug();
new GetFormErrors();
new ValidateRequired();
new SubmitError();
new ActionRedirect();
new ActionSuccess();
new CoreSubmitResponse();
new Calculations();
new DefaultFilters();
/**
* Data controllers
*/
new DateBackwardsCompat();
new FieldDate();
new FormData();
}
});
return controller;
} );
define( 'views/beforeForm',[], function( ) {
var view = Marionette.ItemView.extend({
tagName: "nf-section",
template: "#tmpl-nf-before-form",
});
return view;
} );
define( 'views/formErrorItem',[], function() {
var view = Marionette.ItemView.extend({
tagName: 'nf-section',
template: '#tmpl-nf-form-error',
onRender: function() {
// this.$el = this.$el.children();
// this.$el.unwrap();
// this.setElement( this.$el );
},
});
return view;
} );
define( 'views/formErrorCollection',['views/formErrorItem'], function( formErrorItem ) {
var view = Marionette.CollectionView.extend({
tagName: "nf-errors",
childView: formErrorItem
});
return view;
} );
define( 'views/honeyPot',[], function() {
var view = Marionette.ItemView.extend({
tagName: 'nf-section',
template: '#tmpl-nf-form-hp',
events: {
'keyup .nf-field-hp': 'maybeError',
'change .nf-field-hp': 'maybeError'
},
maybeError: function( e ) {
/*
* If we have an empty honeyPot field, remove the honeypot form error.
* If we do not have an empty honeyPot field, add the honeypot form error.
*/
if ( 0 == jQuery( e.target ).val().length ) {
nfRadio.channel( 'form-' + this.model.get( 'id' ) ).request( 'remove:error', 'honeyPot' );
} else {
var formModel = nfRadio.channel( 'app' ).request( 'get:form', this.model.get( 'id' ) );
nfRadio.channel( 'form-' + this.model.get( 'id' ) ).request( 'add:error', 'honeyPot', formModel.get( 'settings' ).honeypotHoneypotError );
}
}
});
return view;
} );
define( 'views/afterFormContent',['views/formErrorCollection', 'views/honeyPot'], function( FormErrors, HoneyPot ) {
var view = Marionette.LayoutView.extend({
tagName: "nf-section",
template: "#tmpl-nf-after-fields",
regions: {
errors: ".nf-form-errors",
hp: ".nf-form-hp"
},
onShow: function() {
this.errors.show( new FormErrors( { collection: this.model.get( 'errors' ) } ) );
this.hp.show( new HoneyPot( { model: this.model } ) );
}
});
return view;
} );
define( 'views/beforeFormContent',[], function( ) {
var view = Marionette.ItemView.extend({
tagName: "nf-section",
template: "#tmpl-nf-before-fields",
templateHelpers: function () {
return {
renderFieldsMarkedRequired: function() {
var requiredFields = this.fields.filter( { required: 1 } );
return ( requiredFields.length ) ? this.fieldsMarkedRequired : '';
},
};
},
});
return view;
} );
define( 'views/formLayout',[ 'views/afterFormContent', 'views/beforeFormContent', 'models/fieldCollection' ], function( AfterFormContent, BeforeFormContent, FieldCollection ) {
var view = Marionette.LayoutView.extend({
tagName: "nf-section",
template: "#tmpl-nf-form-layout",
regions: {
beforeFormContent: ".nf-before-form-content",
formContent: ".nf-form-content",
afterFormContent: ".nf-after-form-content"
},
initialize: function() {
nfRadio.channel( 'form-' + this.model.get( 'id' ) ).reply( 'get:el', this.getEl, this );
/*
* If we need to hide a form, set the visibility of this form to hidden.
*/
this.listenTo( this.model, 'hide', this.hide );
},
onRender: function() {
this.$el = this.$el.children();
this.$el.unwrap();
this.setElement( this.$el );
},
onShow: function() {
this.beforeFormContent.show( new BeforeFormContent( { model: this.model } ) );
/*
* Set our formContentData to our form setting 'formContentData'
*/
var formContentData = this.model.get( 'formContentData' );
/*
* Check our fieldContentViewsFilter to see if we have any defined.
* If we do, overwrite our default with the view returned from the filter.
*/
var formContentViewFilters = nfRadio.channel( 'formContent' ).request( 'get:viewFilters' );
/*
* Get our first filter, this will be the one with the highest priority.
*/
var sortedArray = _.without( formContentViewFilters, undefined );
var callback = _.first( sortedArray );
formContentView = callback();
var options = {
data: formContentData,
formModel: this.model
};
/*
* If we have a collection, pass the returned data as the collection.
*
* If we have a model, pass the returned data as the collection.
*/
if ( false !== formContentData instanceof Backbone.Collection ) {
options.collection = formContentData;
} else if ( false !== formContentData instanceof Backbone.Model ) {
options.model = formContentData;
}
this.formContent.show( new formContentView( options ) );
this.afterFormContent.show( new AfterFormContent( { model: this.model } ) );
},
getEl: function() {
return this.el;
},
templateHelpers: function () {
return {
renderClasses: function() {
return '';
}
};
},
hide: function() {
jQuery( this.el ).hide();
}
});
return view;
} );
define( 'views/afterForm',[], function( ) {
var view = Marionette.ItemView.extend({
tagName: "nf-section",
template: "#tmpl-nf-after-form",
});
return view;
} );
define( 'views/mainLayout',['views/beforeForm', 'views/formLayout', 'views/afterForm'], function( BeforeForm, FormLayout, AfterForm ) {
var view = Marionette.LayoutView.extend({
template: '#tmpl-nf-layout',
regions: {
responseMsg: '.nf-response-msg',
beforeForm: '.nf-before-form',
formLayout: '.nf-form-layout',
afterForm: '.nf-after-form'
},
initialize: function() {
this.$el = jQuery( '#nf-form-' + this.model.id + '-cont' );
this.el = '#nf-form-' + this.model.id + '-cont';
this.render();
this.beforeForm.show( new BeforeForm( { model: this.model } ) );
this.formLayout.show( new FormLayout( { model: this.model, fieldCollection: this.options.fieldCollection } ) );
this.afterForm.show( new AfterForm( { model: this.model } ) );
/*
* If we need to hide a form, set the visibility of this form to hidden.
*/
this.listenTo( this.model, 'hide', this.hide );
},
hide: function() {
jQuery( this.el ).find( '.nf-form-title' ).hide();
}
});
return view;
} );
// const Intl = require('intl');
// class nfLocaleConverter {
var nfLocaleConverter = function(newLocale, thousands_sep, decimal_sep) {
// constructor(newLocale = 'en-US', thousands_sep, decimal_sep) {
if ('undefined' !== typeof newLocale && 0 < newLocale.length) {
this.locale = newLocale.split('_').join('-');
} else {
this.locale = 'en-US';
}
this.thousands_sep = thousands_sep || ',';
this.decimal_sep = decimal_sep || '.';
// }
this.uniqueElememts = function( value, index, self ) {
return self.indexOf(value) === index;
}
this.numberDecoder = function(num) {
num = num.toString();
// let thousands_sep = ',';
var formatted = '';
// Account for negative numbers.
var negative = false;
if ('-' === num.charAt(0)) {
negative = true;
num = num.replace( '-', '' );
}
// Account for a space as the thousands separator.
// This pattern accounts for all whitespace characters (including thin space).
num = num.replace( /\s/g, '' );
num = num.replace( / /g, '' );
// Determine what our existing separators are.
var myArr = num.split('');
var separators = myArr.filter(function(el) {
return !el.match(/[0-9]/);
});
var final_separators = separators.filter(this.uniqueElememts);
switch( final_separators.length ) {
case 0:
formatted = num;
break;
case 1:
var replacer = '';
if ( 1 == separators.length ) {
separator = separators.pop();
var sides = num.split(separator);
var last = sides.pop();
if ( 3 == last.length && separator == this.thousands_sep ) {
replacer = '';
} else {
replacer = '.';
}
} else {
separator = final_separators.pop();
}
formatted = num.split(separator).join(replacer);
break;
case 2:
var find_one = final_separators[0];
var re_one;
if('.' === find_one) {
re_one = new RegExp('[.]', 'g');
} else {
re_one = new RegExp(find_one, 'g');
}
formatted = num.replace(re_one, '');
var find_two = final_separators[1];
var re_two;
if('.' === find_two) {
re_two = new RegExp('[.]', 'g');
} else {
re_two = new RegExp(find_two, 'g');
}
formatted = formatted.replace(re_two, '.' );
break;
default:
return 'NaN';
}
if ( negative ) {
formatted = '-' + formatted;
}
this.debug('Number Decoder ' + num + ' -> ' + formatted );
return formatted;
}
this.numberEncoder = function(num, percision) {
num = this.numberDecoder(num);
return Intl.NumberFormat(this.locale, { minimumFractionDigits: percision, maximumFractionDigits: percision }).format(num);
}
this.debug = function(message) {
if ( window.nfLocaleConverterDebug || false ) console.log(message);
}
}
// module.exports = nfLocaleConverter;
define("../nfLocaleConverter", function(){});
/*
* Because our backbone listens to .change() events on elements, changes made using jQuery .val() don't bubble properly.
* This patch overwrites the default behaviour of jQuery .val() so that IF the item has an nf-element class, we fire a change event.
*/
( function( jQuery ) {
/*
* Store our original .val() function.
*/
var originalVal = jQuery.fn.val;
/*
* Create our own .val() function.
*/
jQuery.fn.val = function(){
var prev;
/*
* Store a copy of the results of the original .val() call.
* We use this to make sure that we've actually changed something.
*/
if( arguments.length > 0 ){
prev = originalVal.apply( this,[] );
}
/*
* Get the results of the original .val() call.
*/
var result = originalVal.apply( this, arguments );
/*
* If we have arguments, we have actually made a change, AND this has the nf-element class, trigger .change().
*/
if( arguments.length > 0 && prev != originalVal.apply( this, [] ) && jQuery( this ).hasClass( 'nf-element' ) ) {
jQuery(this).change();
}
return result;
};
} ) ( jQuery );
jQuery( document ).ready( function( $ ) {
require( [ 'models/formCollection', 'models/formModel', 'models/fieldCollection', 'controllers/loadControllers', 'views/mainLayout', '../nfLocaleConverter'], function( formCollection, FormModel, FieldCollection, LoadControllers, mainLayout ) {
if( 'undefined' == typeof nfForms ) {
/*
* nfForms is not defined. This means that something went wrong loading the form data.
* Bail form setup and empty the form containers to remove any loading animations.
*/
jQuery( '.nf-form-cont' ).empty();
return;
}
var NinjaForms = Marionette.Application.extend({
forms: {},
initialize: function( options ) {
var that = this;
Marionette.Renderer.render = function(template, data){
var template = that.template( template );
return template( data );
};
// Underscore one-liner for getting URL Parameters
this.urlParameters = _.object(_.compact(_.map(location.search.slice(1).split('&'), function(item) { if (item) return item.split('='); })));
if( 'undefined' != typeof this.urlParameters.nf_resume ) {
this.listenTo(nfRadio.channel('form-' + this.urlParameters.nf_resume), 'loaded', this.restart);
}
nfRadio.channel( 'app' ).reply( 'locale:decodeNumber', this.decodeNumber);
nfRadio.channel( 'app' ).reply( 'locale:encodeNumber',this.encodeNumber);
var loadControllers = new LoadControllers();
nfRadio.channel( 'app' ).trigger( 'after:loadControllers' );
nfRadio.channel( 'app' ).reply( 'get:template', this.template ); },
onStart: function() {
var formCollection = nfRadio.channel( 'app' ).request( 'get:forms' );
_.each( formCollection.models, function( form, index ) {
var layoutView = new mainLayout( { model: form, fieldCollection: form.get( 'fields' ) } );
nfRadio.channel( 'form' ).trigger( 'render:view', layoutView );
jQuery( document ).trigger( 'nfFormReady', layoutView );
} );
},
restart: function( formModel ) {
if( 'undefined' != typeof this.urlParameters.nf_resume ){
var data = {
'action': 'nf_ajax_submit',
'security': nfFrontEnd.ajaxNonce,
'nf_resume': this.urlParameters
};
nfRadio.channel( 'form-' + formModel.get( 'id' ) ).trigger( 'disable:submit' );
nfRadio.channel( 'form-' + formModel.get( 'id' ) ).trigger( 'processingLabel' );
this.listenTo( nfRadio.channel( 'form' ), 'render:view', function() {
/**
* TODO: This needs to be re-worked for backbone. It's not dynamic enough.
*/
/*
* Hide form fields (but not the submit button).
*/
jQuery( '#nf-form-' + formModel.get( 'id' ) + '-cont .nf-field-container:not(.submit-container)' ).hide();
});
// TODO: Refactor Duplication
jQuery.ajax({
url: nfFrontEnd.adminAjax,
type: 'POST',
data: data,
cache: false,
success: function( data, textStatus, jqXHR ) {
try {
var response = data;
nfRadio.channel( 'forms' ).trigger( 'submit:response', response, textStatus, jqXHR, formModel.get( 'id' ) );
nfRadio.channel( 'form-' + formModel.get( 'id' ) ).trigger( 'submit:response', response, textStatus, jqXHR );
} catch( e ) {
console.log( 'Parse Error' );
}
},
error: function( jqXHR, textStatus, errorThrown ) {
// Handle errors here
console.log('ERRORS: ' + textStatus);
// STOP LOADING SPINNER
nfRadio.channel( 'forms' ).trigger( 'submit:response', 'error', textStatus, jqXHR, errorThrown );
}
});
}
},
template: function( template ) {
return _.template( $( template ).html(), {
evaluate: /<#([\s\S]+?)#>/g,
interpolate: /\{\{\{([\s\S]+?)\}\}\}/g,
escape: /\{\{([^\}]+?)\}\}(?!\})/g,
variable: 'data'
} );
},
encodeNumber: function(num) {
var localeConverter = new nfLocaleConverter(nfi18n.siteLocale, nfi18n.thousands_sep, nfi18n.decimal_point);
return localeConverter.numberEncoder(num);
},
decodeNumber: function(num) {
var localeConverter = new nfLocaleConverter(nfi18n.siteLocale, nfi18n.thousands_sep, nfi18n.decimal_point);
return localeConverter.numberDecoder(num);
}
});
var ninjaForms = new NinjaForms();
ninjaForms.start();
} );
} );
define("main", function(){});
}());
//# sourceMappingURL=front-end.js.map;
// source --> https://totaalonlinemarketing.nl/wp-content/plugins/easy-social-share-buttons3/assets/js/easy-social-share-buttons.js?ver=60.2.9
jQuery(document).ready(function($){
var basic_network_list = "twitter,linkedin,facebook,pinterest,google,stumbleupon,vk,reddit,buffer,love,ok,mwp,xing,pocket,mail,print,comments,yummly";
var extended_network_list = "del,digg,weibo,flattr,tumblr,whatsapp,meneame,blogger,amazon,yahoomail,gmail,aol,newsvine,hackernews,evernote,myspace,mailru,viadeo,line,flipboard,sms,viber,telegram";
var plugin_url = essb_settings.essb3_plugin_url;
var fb_value = essb_settings.essb3_facebook_total;
var counter_admin = essb_settings.essb3_admin_ajax;
var interal_counters_all = essb_settings.essb3_internal_counter;
var button_counter_hidden = essb_settings.essb3_counter_button_min;
var no_print_mail_counter = typeof(essb_settings.essb3_no_counter_mailprint) != "undefined" ? essb_settings.essb3_no_counter_mailprint : false;
var force_single_ajax = typeof(essb_settings.essb3_single_ajax) != "undefined" ? essb_settings.essb3_single_ajax : false;
var twitter_counter = typeof(essb_settings.twitter_counter) != "undefined" ? essb_settings.twitter_counter : "";
var google_counter = typeof(essb_settings.google_counter) != 'undefined' ? essb_settings.google_counter : '';
if (twitter_counter == "") { twitter_counter = "api"; }
if (google_counter == '') google_counter = 'api';
var essb_shorten_number = function(n) {
if ('number' !== typeof n) n = Number(n);
var sgn = n < 0 ? '-' : ''
, suffixes = ['k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y']
, overflow = Math.pow(10, suffixes.length * 3 + 3)
, suffix, digits;
n = Math.abs(Math.round(n));
if (n < 1000) return sgn + n;
if (n >= 1e100) return sgn + 'many';
if (n >= overflow) return (sgn + n).replace(/(\.\d*)?e\+?/i, 'e'); // 1e24
do {
n = Math.floor(n);
suffix = suffixes.shift();
digits = n % 1e6;
n = n / 1000;
if (n >= 1000) continue; // 1M onwards: get them in the next iteration
if (n >= 10 && n < 1000 // 10k ... 999k
|| (n < 10 && (digits % 1000) < 100) // Xk (X000 ... X099)
)
return sgn + Math.floor(n) + suffix;
return (sgn + n).replace(/(\.\d).*/, '$1') + suffix; // #.#k
} while (suffixes.length)
return sgn + 'many';
}
jQuery.fn.essb_get_counters = function(){
return this.each(function(){
// missing plugin settings - code cannot run from here
if (typeof(essb_settings) == "undefined") { return; }
var counter_pos = $(this).attr("data-essb-counter-pos") || "";
var post_self_count_id = $(this).attr("data-essb-postid") || "";
var url = $(this).attr("data-essb-url") || "";
var twitter_url = $(this).attr("data-essb-twitter-url") || "";
var instance_id = $(this).attr("data-essb-instance") || "";
var ajax_url = essb_settings.ajax_url;
if (essb_settings.ajax_type == "light") {
ajax_url = essb_settings.blog_url;
}
// definy the counter API
var nonapi_counts_url = (counter_admin) ? ajax_url+"?action=essb_counts&nonce="+essb_settings.essb3_nonce+"&" : essb_settings.essb3_plugin_url+"/public/get-noapi-counts.php?";
var nonapi_internal_url = ajax_url+"?action=essb_counts&nonce="+essb_settings.essb3_nonce+"&";
//console.log(nonapi_internal_url);
var basic_networks = basic_network_list.split(",");
var extended_networks = extended_network_list.split(",");
var direct_access_networks = [];
var nonapi_count_networks = [];
var nonapi_internal_count_networks = [];
for (var i=0;i 0 && force_single_ajax) {
var network_address = nonapi_internal_url + "nw="+post_network_list.join(",")+"&url="+url+"&instance="+instance_id+"&post="+post_self_count_id;
//console.log(network_address);
$.getJSON(network_address)
.done(function(data){
for (var i=0;i parseInt($cnt)) { $css_hidden_negative = ' style="display: none;"'; }
}
if (counter_pos == "right") {
$element.append('' + essb_shorten_number($cnt) + ' ');
}
else if (counter_pos == "inside") {
$element_inside.html('' + essb_shorten_number($cnt) + ' ');
}
else if (counter_pos == "insidename") {
$element_inside.append('' + essb_shorten_number($cnt) + ' ');
}
else if (counter_pos == "insidehover") {
$element_inside.closest("a").append('' + essb_shorten_number($cnt) + ' ');
// fix width of new element
var current_width = $element_inside.closest("a").find('.essb_network_name').innerWidth();
$element_inside.closest("a").find('.essb_counter_insidehover').width(current_width);
}
else if (counter_pos == "insidebeforename") {
$element_inside.prepend('' + essb_shorten_number($cnt) + ' ');
}
else if (counter_pos == "bottom") {
$element_inside.html('' + essb_shorten_number($cnt) + ' ');
}
else if (counter_pos == "hidden") {
$element.append(' ');
}
else if (counter_pos == "topn") {
$element.find("a").prepend('' + essb_shorten_number($cnt) + ' ');
}
else {
$element.prepend('' + essb_shorten_number($cnt) + ' ');
}
}
});
};
jQuery.fn.essb_update_counters = function(){
return this.each(function(){
var $group = $(this).find(".essb_links_list");
var current_button_counter_pos = $(this).attr("data-essb-counter-pos") || "";
var $total_count = $group.find('.essb_totalcount');
var $total_count_nb = $total_count.find('.essb_t_nb');
var $total_count_item = $group.find('.essb_totalcount_item');
var $total_counter_hidden = $total_count_item.attr('data-essb-hide-till') || "";
var total_text = $total_count.attr('title') || "";
var total_text_after = $total_count.attr('title_after') || "";
var total_inside_text = $total_count.attr('data-shares-text') || "";
if (typeof(total_text) == "undefined") { total_text = ""; }
if (typeof(total_text_after) == "undefined") { total_text_after = ""; }
if (total_text != '')
$total_count.prepend(''+total_text+' ');
function count_total() {
var total = 0;
var counter_pos = current_button_counter_pos;
var exist_data_counter_pos = $total_count_item.attr('data-counter-pos') || "";
// alert(exist_data_counter_pos);
if (exist_data_counter_pos != '') {
counter_pos = exist_data_counter_pos;
}
var counter_element = "";
switch (counter_pos) {
case "rightm":
case "right":
counter_element = ".essb_counter_right";
break;
case "inside":
counter_element = ".essb_counter_inside";
break;
case "bottom":
counter_element = ".essb_counter_bottom";
break;
case "insidename":
counter_element = ".essb_counter_insidename";
break;
case "insidebeforename":
counter_element = ".essb_counter_insidebeforename";
break;
case "insidehover":
counter_element = ".essb_counter_insidehover";
break;
case "hidden":
counter_element = ".essb_counter_hidden";
break;
case "topn":
counter_element = '.essb_counter_topn';
break;
default:
counter_element = ".essb_counter";
break;
}
$group.find(counter_element).each(function(){
total += parseInt($(this).attr('cnt'));
var value = parseInt($(this).attr('cnt'));
if (!$total_count_nb) {
value = essb_shorten_number(value);
$(this).text(value);
}
//alert(shortenNumber(total));
});
if (total_inside_text != '') {
$total_count_nb.html(essb_shorten_number(total) + ''+total_inside_text+' ')
}
else {
$total_count_nb.text(essb_shorten_number(total));
}
// show total counter when value is reached
if ($total_counter_hidden != '') {
//alert(parseInt($total_counter_hidden) + " - " + total);
if (parseInt($total_counter_hidden) <= total) {
$total_count_item.show();
}
}
}
setInterval(count_total, 1200);
});
};
$('.essb_links.essb_counters').essb_get_counters();
$('.essb_links.essb_counters').essb_update_counters();
});