1/* global jQuery, FRANK_JEWELRY_STORE_STORAGE */ 2 3jQuery( document ).on( 'action.ready_frank_jewelry_store', function() { 4 5 "use strict"; 6 7 var $window = jQuery( window ), 8 $document = jQuery( document ), 9 $body = jQuery( 'body' ); 10 11 12 // Gallery Fullwidth 13 //------------------------------------------- 14 15 // Make gallery fullwidth 16 if ( $body.hasClass('single-product') ) { 17 var $product = jQuery( '.single_product_gallery_style_fullwidth:not(.single_product_gallery_style_fullwidth_inited)' ).eq(0); 18 if ( $product.length ) { 19 var $gallery = $product.find( '.woocommerce-product-gallery' ); 20 if ( $gallery.length ) { 21 $document.on( 'action.resize_frank_jewelry_store', function() { 22 frank_jewelry_store_woocommerce_stretch_fullwidth(); 23 } ); 24 frank_jewelry_store_woocommerce_stretch_fullwidth(); 25 $product.addClass( 'single_product_gallery_style_fullwidth_inited' ); 26 } 27 } 28 } 29 30 31 // Stretch area to full window width 32 function frank_jewelry_store_woocommerce_stretch_fullwidth() { 33 var $page_wrap = $gallery.closest( '.page_wrap' ), 34 page_wrap_offset = $page_wrap.length === 0 ? 0 : $page_wrap.offset().left; 35 if ($page_wrap.length === 0) { 36 $page_wrap = $body; 37 } 38 var offset = -1 * ( page_wrap_offset - $product.offset().left ); 39 document.querySelector('html').style.setProperty( '--theme-var-single-product-gallery-shift', offset+'px' ); 40 } 41 42 43 // Gallery 'Grid' - make it masonry 44 //--------------------------------------------- 45 if ( $body.hasClass('single-product') ) { 46 var product_wrap = jQuery( '.single_product_gallery_style_grid:not(.single_product_gallery_style_grid_inited)' ); 47 if ( product_wrap.length ) { 48 product_wrap.addClass( 'single_product_gallery_style_grid_inited' ); 49 // Add gallery wrapper to the masonry selector 50 frank_jewelry_store_add_filter('frank_jewelry_store_filter_masonry_wrap', function( selector ) { 51 selector += ( selector ? ',' : '' ) + '.woocommerce-product-gallery__wrapper'; 52 return selector; 53 }); 54 // Add gallery image to the masonry item selector 55 frank_jewelry_store_add_filter('frank_jewelry_store_filter_masonry_item', function( selector ) { 56 selector += ( selector ? ',' : '' ) + '.woocommerce-product-gallery__image,.woocommerce-product-gallery__video'; 57 return selector; 58 }); 59 } 60 } 61 62 63 // Disable lightbox on click 'video_hover' 64 //--------------------------------------------- 65 if ( $body.hasClass('single-product') ) { 66 jQuery( '.woocommerce-product-gallery__image--with_video .trx_addons_popup_link:not(.single_product_gallery_video_inited)' ).each( function() { 67 jQuery(this) 68 .addClass( 'single_product_gallery_video_inited' ) 69 .on( 'click', function( e ) { 70 e.stopPropagation(); 71 } ); 72 } ); 73 } 74 75 76 // Bottom bar (sticky) 77 //--------------------------------------------- 78 79 if ( FRANK_JEWELRY_STORE_STORAGE['add_to_cart_sticky'] ) { 80 81 // Show sticky bar on form is out of the window viewport 82 var $form = jQuery( '.summary form.cart' ); 83 if ( $form.length ) { 84 frank_jewelry_store_intersection_observer_add( $form, function( item, enter, data ) { 85 if ( ! enter ) { 86 if ( ! $body.hasClass( 'single_product_bottom_bar_sticky_on' ) ) { 87 $body.addClass( 'single_product_bottom_bar_sticky_on' ); 88 } 89 } else { 90 if ( $body.hasClass( 'single_product_bottom_bar_sticky_on' ) ) { 91 $body.removeClass( 'single_product_bottom_bar_sticky_on' ); 92 } 93 } 94 } ); 95 } 96 97 // Hide sticky bar on footer is in to the window viewport 98 var $footer = jQuery( '.single_product_bottom_bar_sticky_holder' ); // use '.single_product_bottom_bar_sticky_holder' to hide sticky after whole footer is appear 99 // or '.footer_wrap' to hide sticky before footer is appear 100 if ( $footer.length ) { 101 frank_jewelry_store_intersection_observer_add( $footer, function( item, enter, data ) { 102 if ( ! enter ) { 103 if ( ! $body.hasClass( 'single_product_bottom_bar_sticky_on' ) ) { 104 $body.addClass( 'single_product_bottom_bar_sticky_on' ); 105 } 106 } else { 107 if ( $body.hasClass( 'single_product_bottom_bar_sticky_on' ) ) { 108 $body.removeClass( 'single_product_bottom_bar_sticky_on' ); 109 } 110 } 111 } ); 112 } 113 114 // Scroll to top on click button 'Select options' (for variable products only) 115 jQuery( '.single_product_bottom_bar_button_select_options' ).on( 'click', function(e) { 116 frank_jewelry_store_document_animate_to( '.variations_form' ); 117 e.preventDefault(); 118 return false;
119 } ); 120 } 121 122 123 // Sidebar as filters 124 //--------------------------------------------- 125 jQuery( document ).on( 'action.init_hidden_elements', function( e, $cont ) { 126 $cont.find( '.frank_jewelry_store_woocommerce_filters_button:not(.inited),.sidebar > .sidebar_close:not(.inited),.sidebar_overlay:not(.inited)' ) 127 .addClass( 'inited' ) 128 .on( 'click', function(e) { 129 jQuery( '.sidebar > .sidebar_control' ).trigger( 'click' ); 130 e.preventDefault(); 131 return false; 132 } ); 133 } ); 134 135} );
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.