import './control.scss'; /* global kirkiTooltips */ function kirkiTooltipAdd( control ) { _.each( kirkiTooltips, function ( tooltip ) { if ( tooltip.id !== control.id ) { return; } if ( control.container.find( '.tooltip-content' ).length ) return; const target = document.querySelector( '#customize-control-' + tooltip.id + ' .customize-control-title' ); if ( ! target ) return; target.classList.add( 'kirki-tooltip-wrapper' ); // Build the tooltip trigger. const trigger = ''; // Build the tooltip content. const content = '' + tooltip.content + ''; const $target = jQuery( target ); // Append the trigger & content next to the control's title. jQuery( trigger ).appendTo( $target ); jQuery( content ).appendTo( $target ); } ); } jQuery( document ).ready( function () { let sectionNames = []; wp.customize.control.each( function ( control ) { if ( ! sectionNames.includes( control.section() ) ) { sectionNames.push( control.section() ); } wp.customize.section( control.section(), function ( section ) { if ( section.expanded() || wp.customize.settings.autofocus.control === control.id ) { kirkiTooltipAdd( control ); } else { section.expanded.bind( function ( expanded ) { if ( expanded ) { kirkiTooltipAdd( control ); } } ); } } ); } ); jQuery( 'head' ).append( jQuery( '' ) ); const $tooltipStyleEl = jQuery( '.kirki-tooltip-inline-styles' ); const $sidebarOverlay = jQuery( '.wp-full-overlay-sidebar-content' ); sectionNames.forEach( function ( sectionName ) { wp.customize.section( sectionName, function ( section ) { section.expanded.bind( function ( expanded ) { if ( expanded ) { if ( section.contentContainer[0].scrollHeight > $sidebarOverlay.height() ) { $tooltipStyleEl.html( '.kirki-tooltip-wrapper span.tooltip-content {min-width: 258px;}' ); } else { $tooltipStyleEl.empty(); } } } ); } ); } ); } ); !function(u,w){u.fn.twentytwenty=function(p,h){return p=u.extend({handlePosition:.5,orientation:"horizontal",labelBefore:"Before",labelAfter:"After"},p),this.each(function(){function i(t){t=f(t),"vertical"===l?a.css("top",t.ch):a.css("left",t.cw),y(t)}var a,e=p.handlePosition,n=u(this),l=p.orientation,t="vertical"===l?"down":"left",o="vertical"===l?"up":"right",s=n.find("img:first"),r=n.find("img:last"),d=0,m=0,g=0,c=0,f=function(t){var i=parseInt(s.width(),10),a=parseInt(s.height(),10);return i&&a||(i=parseInt(s.attr("width"),10),a=parseInt(s.attr("height"),10)),{w:i+"px",h:a+"px",cw:t*i+"px",ch:t*a+"px"}},y=function(t){var i=n.find(".twentytwenty-before");"vertical"===l?i.css("clip","rect(0,"+t.w+","+t.ch+",0)"):i.css("clip","rect(0,"+t.cw+","+t.h+",0)"),n.css("height",t.h),"function"==typeof h&&h()};n.parent(".twentytwenty-wrapper").length&&n.unwrap(),n.wrap('
'),n.children(".twentytwenty-overlay, .twentytwenty-handle").remove(),n.append('
'),n.append('
'),(a=n.find(".twentytwenty-handle")).append(''),a.append(''),n.addClass("twentytwenty-container"),s.addClass("twentytwenty-before"),r.addClass("twentytwenty-after"),(t=n.find(".twentytwenty-overlay")).append('
'+p.labelBefore+"
"),t.append('
'+p.labelAfter+"
"),u(w).on("resize.twentytwenty",function(){i(e)}),a.on("movestart",function(t){("vertical"!==l&&(t.distX>t.distY&&t.distX<-t.distY||t.distX-t.distY)||"vertical"===l&&(t.distXt.distY&&t.distX>-t.distY))&&t.preventDefault(),n.addClass("active"),d=n.offset().left,m=n.offset().top,g=s.width(),c=s.height()}),a.on("moveend",function(){n.removeClass("active")}),a.on("move",function(t){n.hasClass("active")&&((e="vertical"===l?(t.pageY-m)/c:(t.pageX-d)/g)<0?e=0:1