window.addEventListener( 'load', () => {
const FRONTEND_SELECTOR = '.wp-block-jetpack-contact-form-container';
const EDITOR_SELECTOR = '[data-type="jetpack/contact-form"]';
const observer = new MutationObserver( () => {
generateStyleVariables( FRONTEND_SELECTOR );
generateStyleVariables( EDITOR_SELECTOR );
} );
observer.observe( document.querySelector( 'body' ), {
childList: true,
subtree: true,
} );
//Make sure to execute at least once if not triggered by the observer
setTimeout( () => {
generateStyleVariables( FRONTEND_SELECTOR );
generateStyleVariables( EDITOR_SELECTOR );
}, 300 );
} );
function generateStyleVariables( selector, outputSelector = 'body' ) {
const STYLE_PROBE_CLASS = 'contact-form__style-probe';
const STYLE_PROBE_STYLE =
'position: absolute; z-index: -1; width: 1px; height: 1px; visibility: hidden';
const HTML = `
`;
const iframeCanvas = document.querySelector( 'iframe[name="editor-canvas"]' );
const doc = iframeCanvas ? iframeCanvas.contentDocument : document;
if (
! doc.querySelectorAll( selector ).length ||
doc.querySelectorAll( `.${ STYLE_PROBE_CLASS }` ).length
) {
return;
}
const styleProbe = doc.createElement( 'div' );
styleProbe.className = STYLE_PROBE_CLASS;
styleProbe.style = STYLE_PROBE_STYLE;
styleProbe.innerHTML = HTML;
const container = doc.querySelector( selector );
container.appendChild( styleProbe );
const bodyNode = doc.querySelector( 'body' );
const buttonNode = styleProbe.querySelector( '.wp-block-button__link' );
const inputNode = styleProbe.querySelector( 'input[type="text"]' );
const backgroundColor = window.getComputedStyle( bodyNode ).backgroundColor;
const primaryColor = window.getComputedStyle( buttonNode ).borderColor;
const {
color: textColor,
padding: inputPadding,
backgroundColor: inputBackground,
border,
borderColor,
borderWidth,
borderStyle,
borderRadius,
fontSize,
fontFamily,
lineHeight,
} = window.getComputedStyle( inputNode );
const outputContainer = doc.querySelector( outputSelector );
outputContainer.style.setProperty( '--jetpack--contact-form--primary-color', primaryColor );
outputContainer.style.setProperty( '--jetpack--contact-form--background-color', backgroundColor );
outputContainer.style.setProperty( '--jetpack--contact-form--text-color', textColor );
outputContainer.style.setProperty( '--jetpack--contact-form--border', border );
outputContainer.style.setProperty( '--jetpack--contact-form--border-color', borderColor );
outputContainer.style.setProperty( '--jetpack--contact-form--border-size', borderWidth );
outputContainer.style.setProperty( '--jetpack--contact-form--border-style', borderStyle );
outputContainer.style.setProperty( '--jetpack--contact-form--border-radius', borderRadius );
outputContainer.style.setProperty( '--jetpack--contact-form--input-background', inputBackground );
outputContainer.style.setProperty( '--jetpack--contact-form--input-padding', inputPadding );
outputContainer.style.setProperty( '--jetpack--contact-form--font-size', fontSize );
outputContainer.style.setProperty( '--jetpack--contact-form--font-family', fontFamily );
outputContainer.style.setProperty( '--jetpack--contact-form--line-height', lineHeight );
}
;
jQuery(document).ready(function(){
scripts = jQuery("head script");
if(scripts.length > 0 && scripts[0].id !== 'cmw_inject_custom_head_js'){
console.log('CMW CUSTOM JS NOT FIRST');
}
if(scripts.length === 0){
console.log('NO SCRIPTS IN HEAD!');
}
});;
(function(factory){if(typeof define==="function"&&define.amd){define(["jquery"],function($){return factory($)})}else if(typeof module==="object"&&typeof module.exports==="object"){exports=factory(require("jquery"))}else{factory(jQuery)}})(function($){$.easing["jswing"]=$.easing["swing"];var pow=Math.pow,sqrt=Math.sqrt,sin=Math.sin,cos=Math.cos,PI=Math.PI,c1=1.70158,c2=c1*1.525,c3=c1+1,c4=2*PI/3,c5=2*PI/4.5;function bounceOut(x){var n1=7.5625,d1=2.75;if(x<1/d1){return n1*x*x}else if(x<2/d1){return n1*(x-=1.5/d1)*x+.75}else if(x<2.5/d1){return n1*(x-=2.25/d1)*x+.9375}else{return n1*(x-=2.625/d1)*x+.984375}}$.extend($.easing,{def:"easeOutQuad",swing:function(x){return $.easing[$.easing.def](x)},easeInQuad:function(x){return x*x},easeOutQuad:function(x){return 1-(1-x)*(1-x)},easeInOutQuad:function(x){return x<.5?2*x*x:1-pow(-2*x+2,2)/2},easeInCubic:function(x){return x*x*x},easeOutCubic:function(x){return 1-pow(1-x,3)},easeInOutCubic:function(x){return x<.5?4*x*x*x:1-pow(-2*x+2,3)/2},easeInQuart:function(x){return x*x*x*x},easeOutQuart:function(x){return 1-pow(1-x,4)},easeInOutQuart:function(x){return x<.5?8*x*x*x*x:1-pow(-2*x+2,4)/2},easeInQuint:function(x){return x*x*x*x*x},easeOutQuint:function(x){return 1-pow(1-x,5)},easeInOutQuint:function(x){return x<.5?16*x*x*x*x*x:1-pow(-2*x+2,5)/2},easeInSine:function(x){return 1-cos(x*PI/2)},easeOutSine:function(x){return sin(x*PI/2)},easeInOutSine:function(x){return-(cos(PI*x)-1)/2},easeInExpo:function(x){return x===0?0:pow(2,10*x-10)},easeOutExpo:function(x){return x===1?1:1-pow(2,-10*x)},easeInOutExpo:function(x){return x===0?0:x===1?1:x<.5?pow(2,20*x-10)/2:(2-pow(2,-20*x+10))/2},easeInCirc:function(x){return 1-sqrt(1-pow(x,2))},easeOutCirc:function(x){return sqrt(1-pow(x-1,2))},easeInOutCirc:function(x){return x<.5?(1-sqrt(1-pow(2*x,2)))/2:(sqrt(1-pow(-2*x+2,2))+1)/2},easeInElastic:function(x){return x===0?0:x===1?1:-pow(2,10*x-10)*sin((x*10-10.75)*c4)},easeOutElastic:function(x){return x===0?0:x===1?1:pow(2,-10*x)*sin((x*10-.75)*c4)+1},easeInOutElastic:function(x){return x===0?0:x===1?1:x<.5?-(pow(2,20*x-10)*sin((20*x-11.125)*c5))/2:pow(2,-20*x+10)*sin((20*x-11.125)*c5)/2+1},easeInBack:function(x){return c3*x*x*x-c1*x*x},easeOutBack:function(x){return 1+c3*pow(x-1,3)+c1*pow(x-1,2)},easeInOutBack:function(x){return x<.5?pow(2*x,2)*((c2+1)*2*x-c2)/2:(pow(2*x-2,2)*((c2+1)*(x*2-2)+c2)+2)/2},easeInBounce:function(x){return 1-bounceOut(1-x)},easeOutBounce:bounceOut,easeInOutBounce:function(x){return x<.5?(1-bounceOut(1-2*x))/2:(1+bounceOut(2*x-1))/2}})});
;
!function(t){"use strict";t.fn.fitVids=function(e){var i={customSelector:null,ignore:null};if(!document.getElementById("fit-vids-style")){var r=document.head||document.getElementsByTagName("head")[0],a=".fluid-width-video-wrapper{width:100%;position:relative;padding:0;}.fluid-width-video-wrapper iframe,.fluid-width-video-wrapper object,.fluid-width-video-wrapper embed {position:absolute;top:0;left:0;width:100%;height:100%;}",d=document.createElement("div");d.innerHTML='x
",r.appendChild(d.childNodes[1])}return e&&t.extend(i,e),this.each(function(){var e=['iframe[src*="player.vimeo.com"]','iframe[src*="youtube.com"]','iframe[src*="youtube-nocookie.com"]','iframe[src*="kickstarter.com"][src*="video.html"]',"object","embed"];i.customSelector&&e.push(i.customSelector);var r=".fitvidsignore";i.ignore&&(r=r+", "+i.ignore);var a=t(this).find(e.join(","));a=a.not("object object"),a=a.not(r),a.each(function(){var e=t(this);if(!(e.parents(r).length>0||"embed"===this.tagName.toLowerCase()&&e.parent("object").length||e.parent(".fluid-width-video-wrapper").length)){e.css("height")||e.css("width")||!isNaN(e.attr("height"))&&!isNaN(e.attr("width"))||(e.attr("height",9),e.attr("width",16));var i="object"===this.tagName.toLowerCase()||e.attr("height")&&!isNaN(parseInt(e.attr("height"),10))?parseInt(e.attr("height"),10):e.height(),a=isNaN(parseInt(e.attr("width"),10))?e.width():parseInt(e.attr("width"),10),d=i/a;if(!e.attr("name")){var o="fitvid"+t.fn.fitVids._count;e.attr("name",o),t.fn.fitVids._count++}e.wrap('').parent(".fluid-width-video-wrapper").css("padding-top",100*d+"%"),e.removeAttr("height").removeAttr("width")}})})},t.fn.fitVids._count=0}(window.jQuery||window.Zepto);
;
!function(R){var Z={mode:"horizontal",slideSelector:"",infiniteLoop:!0,hideControlOnEnd:!1,speed:500,easing:null,slideMargin:0,startSlide:0,randomStart:!1,captions:!1,ticker:!1,tickerHover:!1,adaptiveHeight:!1,adaptiveHeightSpeed:500,video:!1,useCSS:!0,preloadImages:"visible",responsive:!0,slideZIndex:50,wrapperClass:"bx-wrapper",touchEnabled:!0,swipeThreshold:50,oneToOneTouch:!0,preventDefaultSwipeX:!0,preventDefaultSwipeY:!1,ariaLive:!0,ariaHidden:!0,keyboardEnabled:!1,pager:!0,pagerType:"full",pagerShortSeparator:" / ",pagerSelector:null,buildPager:null,pagerCustom:null,controls:!0,nextText:"Next",prevText:"Prev",nextSelector:null,prevSelector:null,autoControls:!1,startText:"Start",stopText:"Stop",autoControlsCombine:!1,autoControlsSelector:null,auto:!1,pause:4e3,autoStart:!0,autoDirection:"next",stopAutoOnClick:!1,autoHover:!1,autoDelay:0,autoSlideForOnePage:!1,minSlides:1,maxSlides:1,moveSlides:0,slideWidth:0,shrinkItems:!1,onSliderLoad:function(){return!0},onSlideBefore:function(){return!0},onSlideAfter:function(){return!0},onSlideNext:function(){return!0},onSlidePrev:function(){return!0},onSliderResize:function(){return!0}};R.fn.bxSlider=function(e){if(0===this.length)return this;if(1'),D.viewport=L.parent(),D.settings.ariaLive&&!D.settings.ticker&&D.viewport.attr("aria-live","polite"),D.loader=R(''),D.viewport.prepend(D.loader),L.css({width:"horizontal"===D.settings.mode?1e3*D.children.length+215+"%":"auto",position:"relative"}),D.usingCSS&&D.settings.easing?L.css("-"+D.cssPrefix+"-transition-timing-function",D.settings.easing):D.settings.easing||(D.settings.easing="swing"),D.viewport.css({width:"100%",overflow:"hidden",position:"relative"}),D.viewport.parent().css({maxWidth:r()}),D.settings.pager||D.settings.controls||D.viewport.parent().css({margin:"0 auto 0px"}),D.children.css({float:"horizontal"===D.settings.mode?"left":"none",listStyle:"none",position:"relative"}),D.children.css("width",l()),"horizontal"===D.settings.mode&&0'),D.settings.captions&&m(),D.active.last=D.settings.startSlide===c()-1,D.settings.video&&L.fitVids(),"all"!==D.settings.preloadImages&&!D.settings.ticker||(t=D.children),D.settings.ticker?D.settings.pager=!1:(D.settings.controls&&f(),D.settings.auto&&D.settings.autoControls&&x(),D.settings.pager&&v(),(D.settings.controls||D.settings.autoControls||D.settings.pager)&&D.viewport.after(D.controls.el)),n(t,o)},n=function(t,e){var i=t.find('img:not([src=""]), iframe').length,s=0;0===i?e():t.find('img:not([src=""]), iframe').each(function(){R(this).one("load error",function(){++s===i&&e()}).each(function(){this.complete&&R(this).trigger("load")})})},o=function(){var t,e;D.settings.infiniteLoop&&"fade"!==D.settings.mode&&!D.settings.ticker&&(e="vertical"===D.settings.mode?D.settings.minSlides:D.settings.maxSlides,t=D.children.slice(0,e).clone(!0).addClass("bx-clone"),e=D.children.slice(-e).clone(!0).addClass("bx-clone"),D.settings.ariaHidden&&(t.attr("aria-hidden",!0),e.attr("aria-hidden",!0)),L.append(t).prepend(e)),D.loader.remove(),h(),"vertical"===D.settings.mode&&(D.settings.adaptiveHeight=!0),D.viewport.height(a()),L.redrawSlider(),D.settings.onSliderLoad.call(L,D.active.index),D.initialized=!0,D.settings.responsive&&R(window).bind("resize",H),D.settings.auto&&D.settings.autoStart&&(1=D.children.length?t.add(D.children.eq(i-1)):t.add(D.children.eq(s+i))}else t=D.children.eq(D.active.index);else t=D.children;return"vertical"===D.settings.mode?(t.each(function(t){e+=R(this).outerHeight()}),0e&&!D.carousel||"vertical"===D.settings.mode)t=e;else if(1D.maxThreshold)return t;eD.maxThreshold?D.settings.maxSlides:(t=D.children.first().width()+D.settings.slideMargin,Math.floor((D.viewport.width()+D.settings.slideMargin)/t)):"vertical"===D.settings.mode&&(e=D.settings.minSlides),e},c=function(){var t=0,e=0,i=0;if(0D.settings.maxSlides&&D.active.last&&!D.settings.infiniteLoop?"horizontal"===D.settings.mode?(t=(e=D.children.last()).position(),p(-(t.left-(D.viewport.width()-e.outerWidth())),"reset",0)):"vertical"===D.settings.mode&&(e=D.children.length-D.settings.minSlides,t=D.children.eq(e).position(),p(-t.top,"reset",0)):(t=D.children.eq(D.active.index*g()).position(),D.active.index===c()-1&&(D.active.last=!0),void 0!==t&&("horizontal"===D.settings.mode?p(-t.left,"reset",0):"vertical"===D.settings.mode&&p(-t.top,"reset",0)))},p=function(t,e,i,s){var n;D.usingCSS?(n="vertical"===D.settings.mode?"translate3d(0, "+t+"px, 0)":"translate3d("+t+"px, 0, 0)",L.css("-"+D.cssPrefix+"-transition-duration",i/1e3+"s"),"slide"===e?(L.css(D.animProp,n),0!==i?L.bind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd",function(t){R(t.target).is(L)&&(L.unbind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd"),k())}):k()):"reset"===e?L.css(D.animProp,n):"ticker"===e&&(L.css("-"+D.cssPrefix+"-transition-timing-function","linear"),L.css(D.animProp,n),0!==i?L.bind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd",function(t){R(t.target).is(L)&&(L.unbind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd"),p(s.resetValue,"reset",0),M())}):(p(s.resetValue,"reset",0),M()))):((n={})[D.animProp]=t,"slide"===e?L.animate(n,i,D.settings.easing,function(){k()}):"reset"===e?L.css(D.animProp,t):"ticker"===e&&L.animate(n,i,"linear",function(){p(s.resetValue,"reset",0),M()}))},u=function(){for(var t="",e="",i=c(),s=0;s