1! function( $ ) { 2 "use strict"; 3 4 Codevz_Plus.popup = function( wpb ) { 5 6 var body = $( document.body ), 7 hash = window.location.hash; 8 9 body.off( 'click.popupe' ).on( 'click.popupe', '.xtra-popup', function() { 10 11 var $this = $( this ).parent().find( '.cz_popup_modal' ); 12 13 $( 'html, body' ).addClass( 'no-scroll' ); 14 15 $this.fadeIn( 'fast' ).delay( 1000 ).addClass( 'cz_show_popup' ); 16 17 $this.find( '.cz_overlay' ).fadeIn().css( 'background', $this.data( 'overlay-bg' ) || '' ); 18 19 if ( $this.find( '.slick' ).length && typeof Codevz_Plus.slick != 'undefined' ) { 20 Codevz_Plus.slick(); 21 } 22 23 }); 24 25 // Close popup. 26 body.off( 'click.popup_close' ).on( 'click.popup_close', ".cz_close_popup, #cz_close_popup, .cz_overlay, a[href*='#cz_close_popup']", function( e ) { 27 28 var $this = $( this ), 29 popup = $this.closest( '.cz_popup_modal' ); 30 31 $( '.vc_cz_popup, .vc_cz_popup, .cz_popup_modal' ).hide().removeClass( 'cz_show_popup' ); 32 33 $( '.cz_overlay' ).fadeOut( 'fast' ).css( 'background', '' ); 34 35 $( 'html, body' ).removeClass( 'no-scroll' ); 36 37 if ( popup.hasClass( 'cz_popup_show_once' ) ) { 38 localStorage.setItem( popup.attr( 'id' ), 1 ); 39 } 40 41 e.preventDefault(); 42 43 }); 44 45 // Popup. 46 $( '.cz_popup_modal' ).codevzPlus( 'popup', function( x ) { 47 48 var $this = x, 49 popup = $this.parent(), 50 popupID = $this.attr( 'id' ), 51 parentX = $this.closest( '.vc_cz_popup' ), 52 showPopup = function() { 53 54 // Elementor classes. 55 if ( $this.closest( '.elementor-element' ).length ) { 56 57 var eID = $this.closest( '[data-elementor-id]' ).attr( 'data-elementor-id' ); 58 59 if ( eID ) { 60 popup.addClass( 'elementor-' + eID ); 61 } 62 63 popup.find( '> div' ).addClass( $this.closest( '.elementor-element' ).attr( 'class' ) ); 64 65 } 66 67 // Append to body. 68 if ( ! body.find( '> #' + popupID ).length && ! wpb && ! $( '.vc_editor' ).length && ! $( '.elementor-element-edit-mode' ).length && ! popup.hasClass( 'xyz' ) ) { 69 70 popup.addClass( 'xyz' ).appendTo( 'body' ); 71 72 } 73 74 $( 'html, body' ).addClass( 'no-scroll' ); 75 76 parentX.fadeIn( 'fast' ); 77 78 $( '.vc_cz_popup, #' + popupID ).fadeIn( 'fast' ).delay( 1000 ).addClass( 'cz_show_popup' ); 79 80 popup.find( '.cz_overlay' ).fadeIn().css( 'background', $this.data( 'overlay-bg' ) || '' ); 81 82 if ( $this.find( '.slick' ).length && typeof Codevz_Plus.slick != 'undefined' ) { 83 Codevz_Plus.slick(); 84 } 85 86 }; 87 88 // Frontend. 89 if ( wpb ) { 90 91 // Set popup styling 92 parentX.attr( 'style', $this.attr( 'style' ) ); 93 94 // Delete popup 95 $( "#" + popupID + " .cz_close_popup, #cz_close_popup, a[href*='#cz_close_popup']" ).off(); 96 97 $( '> .vc_controls .vc_control-btn-delete', parentX ).on('click', function() { 98 99 $( '.cz_overlay' ).fadeOut( 'fast' ).css( 'background', '' ); 100 101 }); 102 103 } 104 105 // Check popup link. 106 if ( popup.length ) { 107 $( "a[href*='#" + popupID + "']" ).attr( 'href', "#" + popupID + "" ); 108 } 109 110 // Open popup. 111 body.off( 'click.popup' + popupID ).on( 'click.popup' + popupID, "a[href*='#" + popupID + "']", function( e ) { 112 113 // Move popup to footer. 114 if ( popup.length ) { 115 116 showPopup(); 117 118 // Fix CF7 Pro inside Popup 119 if ( ! parentX.length && typeof wpcf7 != 'undefined' && $this.find( '.wpcf7' ).length ) { 120
121 $this.find( 'form.wpcf7-form' ).each( function( i, form ) { 122 if ( wpcf7 ) { 123 wpcf7.init( form ); 124 } 125 }); 126 127 } 128 129 // Update lightbox. 130 Codevz_Plus.lightGallery( $( '#' + popupID ) ); 131 132 // Fix multiple same popup 133 $this.attr( 'data-popup', popupID ); 134 135 e.preventDefault(); 136 137 } 138 139 }); 140 141 // If popup is always show, then remove session 142 if ( $this.hasClass( 'cz_popup_show_always' ) && localStorage.getItem( popupID ) ) { 143 localStorage.removeItem( popupID ); 144 } 145 146 // Check visibility mode on page load 147 if ( $this.hasClass( 'cz_popup_page_start' ) && ! localStorage.getItem( popupID ) ) { 148 showPopup(); 149 } else if ( $this.hasClass( 'cz_popup_page_loaded' ) && ! localStorage.getItem( popupID ) ) { 150 $( window ).on( 'load', function() { 151 showPopup(); 152 }); 153 } 154 155 // Open popup if address bar have popup ID. 156 if ( hash && hash.substring( 1 ) == popupID ) { 157 showPopup(); 158 } 159 160 var dly = $this.data( 'settimeout' ), 161 scr = $this.data( 'after-scroll' ); 162 163 // Auto open after delay. 164 if ( dly ) { 165 setTimeout(function() { 166 showPopup(); 167 }, dly ); 168 } 169 170 // Auto open after specific scroll position. 171 if ( scr ) { 172 173 $( window ).on( 'scroll.popup_scroll', function() { 174 175 var $this = $( this ); 176 177 var scrollPercent = 100 * $this.scrollTop() / ( $( document ).height() - $this.height() ); 178 179 if ( scrollPercent >= scr ) { 180 181 showPopup(); 182 183 $this.off( 'scroll.popup_scroll' ); 184 185 } 186 187 }); 188 189 } 190 191 }); 192 193 }; 194 195 Codevz_Plus.popup(); 196 197}( jQuery );
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.