1(function () { 2 if (typeof jagif_pg_params === 'undefined') { 3 return false; 4 } 5 jQuery(document).ready(function () { 6 'use strict'; 7 if ( ! jQuery('.jagif-popup-gift-wrap').length ) { 8 jQuery('.jagif-popup-gift-icon-wrap.jagif-popup-is-product-gift').remove(); 9 } 10 if (jQuery('.jagif-popup-gift-wrap:not(.jagif-popup-gift-wrap-init)').length) { 11 jQuery('.jagif-popup-gift-wrap:not(.jagif-popup-gift-wrap-init)').addClass('jagif-popup-gift-wrap-init'); 12 jagif_popup_gift_init(); 13 } 14 }); 15 jQuery(window).on('load', function () { 16 'use strict'; 17 if ( ! jQuery('.jagif-popup-gift-wrap').length ) { 18 jQuery('.jagif-popup-gift-icon-wrap.jagif-popup-is-product-gift').remove(); 19 } 20 if (jQuery('.jagif-popup-gift-wrap:not(.jagif-popup-gift-wrap-init)').length) { 21 jQuery('.jagif-popup-gift-wrap:not(.jagif-popup-gift-wrap-init)').addClass('jagif-popup-gift-wrap-init'); 22 jagif_popup_gift_init(); 23 } 24 }); 25 jQuery(window).on('resize', function () { 26 'use strict'; 27 jagif_pg_design(jQuery('.jagif-popup-gift-content-wrap')); 28 }); 29 30 31})(); 32 33function jagif_popup_gift_init() { 34 let icon_popup = jQuery('.jagif-popup-gift-icon-wrap'); 35 if (icon_popup.hasClass('jagif-popup-auto-show-enable') && icon_popup.hasClass('jagif-popup-is-product-gift')) { 36 jagif_pg_toggle('show'); 37 }
38 jQuery(document).on('mouseenter', '.jagif-popup-gift-icon-wrap', function () { 39 if (jQuery(this).hasClass('jagif-popup-gift-icon-wrap-click')) { 40 jQuery(this).removeClass('jagif-popup-gift-icon-wrap-mouseleave').addClass('jagif-popup-gift-icon-wrap-mouseenter'); 41 } else { 42 jagif_pg_toggle('show'); 43 } 44 }).on('mouseleave', '.jagif-popup-gift-icon-wrap', function () { 45 if (jQuery(this).hasClass('jagif-popup-gift-icon-wrap-mouseenter')) { 46 jQuery(this).removeClass('jagif-popup-gift-icon-wrap-mouseenter').addClass('jagif-popup-gift-icon-wrap-mouseleave'); 47 } 48 }).on('click', '.jagif-popup-gift-icon-wrap', function () { 49 if (jQuery(this).hasClass('jagif-popup-gift-icon-wrap-click')) { 50 jagif_pg_toggle('show'); 51 } 52 }); 53 54 jQuery(document).on('click', '.jagif-popup-gift-overlay, .jagif-popup-gift-close-wrap, .jagif-free-gift-popup-close', function () { 55 if (!jQuery(this).hasClass('jagif-not-hidden')) { 56 jagif_pg_toggle('hide'); 57 } 58 }); 59 jQuery(document).on('click', '.jagif-gift_icon-clear-button', function () { 60 if (!jQuery(this).hasClass('jagif-not-hidden')) { 61 jagif_pg_toggle('hide'); 62 } 63 }); 64 jQuery(document).on('click', '.jagif-slide-left', function () { 65 let items = jQuery('.jagif-popup-slide_wrap #jagif-free_gift_wrap'); 66 if (items.length) { 67 let number = items.length, 68 slide = parseInt(jQuery(this).closest('.jagif-popup-slide_wrap').data('slide')); 69 if (slide !== '' && slide > 0) { 70 jQuery(this).closest('.jagif-popup-slide_wrap').data('slide', slide - 1); 71 jQuery.each(items, function (index, value) { 72 if (index != slide - 1) { 73 jagifSlideLeft(jQuery(this), 400, 0, parseFloat(jQuery(this).width()) * (slide - 1)); 74 } else { 75 jagifSlideLeft(jQuery(this), 400, 1, parseFloat(jQuery(this).width()) * (slide - 1)); 76 } 77 }) 78 } 79 } 80 }); 81 jQuery(document).on('click', '.jagif-slide-right', function () { 82 let items = jQuery('.jagif-popup-slide_wrap #jagif-free_gift_wrap'); 83 if (items.length) { 84 let number = items.length, 85 slide = parseInt(jQuery(this).closest('.jagif-popup-slide_wrap').data('slide')); 86 if (slide !== '' && slide < number-1) { 87 jQuery(this).closest('.jagif-popup-slide_wrap').data('slide', slide + 1); 88 jQuery.each(items, function (index, value) { 89 if (index != slide + 1) { 90 jagifSlideRight(jQuery(this), 400, 0, parseFloat(jQuery(this).width()) * (slide + 1)); 91 } else { 92 jagifSlideRight(jQuery(this), 400, 1, parseFloat(jQuery(this).width()) * (slide + 1)); 93 } 94 }) 95 } 96 } 97 }); 98 99} 100 101jQuery(document.body).on('jagif-popup-gift-toggle', function (e, action, new_effect = '') { 102 let wrap = jQuery('.jagif-popup-gift-content-wrap'), 103 position = jQuery('.jagif-popup-gift').data('position'), 104 effect = jQuery('.jagif-popup-gift').data('effect'); 105 if (action === 'hide' && wrap.hasClass('jagif-popup-gift-content-close')) { 106 return false; 107 } 108 if (action === 'show' && wrap.hasClass('jagif-popup-gift-content-open')) { 109 return false; 110 } 111 jagif_pg_design(wrap); 112 let type = (position === 'top_left' || position === 'bottom_left') ? 'left' : 'right'; 113 if (action === 'start' && new_effect) { 114 if (wrap.hasClass('jagif-popup-gift-content-close')) { 115 wrap.removeClass('jagif-popup-gift-content-open jagif-popup-gift-content-open-' + effect + '-' + type); 116 wrap.addClass('jagif-popup-gift-content-close jagif-popup-gift-content-close-' + new_effect + '-' + type); 117 } else { 118 wrap.addClass('jagif-popup-gift-content-open jagif-popup-gift-content-open-' + new_effect + '-' + type); 119 wrap.removeClass('jagif-popup-gift-content-close jagif-popup-gift-content-close-' + effect + '-' + type); 120 } 121 jQuery('.jagif-popup-gift').data('effect', new_effect); 122 return false; 123 } 124 new_effect = new_effect ? new_effect : effect; 125 let old_position = jQuery('.jagif-popup-gift').data('old_position') || ''; 126 let old_type = old_position ? ((old_position === 'top_left' || old_position === 'bottom_left') ? 'left' : 'right') : type;
127 let class_open = 'jagif-popup-gift-content-open jagif-popup-gift-content-open-' + new_effect + '-' + type, 128 class_close = 'jagif-popup-gift-content-close jagif-popup-gift-content-close-' + new_effect + '-' + type, 129 class_open_old = 'jagif-popup-gift-content-open jagif-popup-gift-content-open-' + effect + '-' + old_type, 130 class_close_old = 'jagif-popup-gift-content-close jagif-popup-gift-content-close-' + effect + '-' + old_type + ' jagif-popup-gift-content-close-' + effect + '-' + type; 131 if (wrap.hasClass('jagif-popup-gift-content-close')) { 132 wrap.addClass(class_open).removeClass(class_close).removeClass(class_close_old); 133 jQuery('html').addClass('jagif-html-non-scroll'); 134 jQuery('.jagif-popup-gift-overlay').removeClass('jagif-disabled'); 135 jQuery('.jagif-popup-gift').data('effect', new_effect); 136 jagif_pg_icon_toggle(); 137 } else { 138 wrap.addClass(class_close).removeClass(class_open).removeClass(class_open_old); 139 jQuery('.jagif-popup-gift-overlay').addClass('jagif-disabled'); 140 jQuery('html').removeClass('jagif-html-non-scroll'); 141 jagif_pg_icon_toggle(true); 142 } 143 jQuery('.jagif-popup-gift').data('effect', new_effect); 144}); 145 146function jagif_pg_toggle(action = '', new_effect = '') { 147 let wrap = jQuery('.jagif-popup-gift-content-wrap'), 148 position = jQuery('.jagif-popup-gift').data('position'), 149 effect = jQuery('.jagif-popup-gift').data('effect'); 150 if (action === 'hide' && wrap.hasClass('jagif-popup-gift-content-close')) { 151 return false; 152 } 153 if (action === 'show' && wrap.hasClass('jagif-popup-gift-content-open')) { 154 return false; 155 } 156 jagif_pg_design(wrap); 157 let type = (position === 'top_left' || position === 'bottom_left') ? 'left' : 'right'; 158 if (action === 'start' && new_effect) { 159 if (wrap.hasClass('jagif-popup-gift-content-close')) { 160 wrap.removeClass('jagif-popup-gift-content-open jagif-popup-gift-content-open-' + effect + '-' + type); 161 wrap.addClass('jagif-popup-gift-content-close jagif-popup-gift-content-close-' + new_effect + '-' + type); 162 } else { 163 wrap.addClass('jagif-popup-gift-content-open jagif-popup-gift-content-open-' + new_effect + '-' + type); 164 wrap.removeClass('jagif-popup-gift-content-close jagif-popup-gift-content-close-' + effect + '-' + type); 165 } 166 jQuery('.jagif-popup-gift').data('effect', new_effect); 167 return false; 168 } 169 new_effect = new_effect ? new_effect : effect; 170 let old_position = jQuery('.jagif-popup-gift').data('old_position') || ''; 171 let old_type = old_position ? ((old_position === 'top_left' || old_position === 'bottom_left') ? 'left' : 'right') : type;
172 let class_open = 'jagif-popup-gift-content-open jagif-popup-gift-content-open-' + new_effect + '-' + type, 173 class_close = 'jagif-popup-gift-content-close jagif-popup-gift-content-close-' + new_effect + '-' + type, 174 class_open_old = 'jagif-popup-gift-content-open jagif-popup-gift-content-open-' + effect + '-' + old_type, 175 class_close_old = 'jagif-popup-gift-content-close jagif-popup-gift-content-close-' + effect + '-' + old_type + ' jagif-popup-gift-content-close-' + effect + '-' + type; 176 if (wrap.hasClass('jagif-popup-gift-content-close')) { 177 wrap.addClass(class_open).removeClass(class_close).removeClass(class_close_old); 178 jQuery('html').addClass('jagif-html-non-scroll'); 179 jQuery('.jagif-popup-gift-overlay').removeClass('jagif-disabled'); 180 jQuery('.jagif-popup-gift').data('effect', new_effect); 181 jagif_pg_icon_toggle(); 182 } else { 183 wrap.addClass(class_close).removeClass(class_open).removeClass(class_open_old); 184 jQuery('.jagif-popup-gift-overlay').addClass('jagif-disabled'); 185 jQuery('html').removeClass('jagif-html-non-scroll'); 186 jagif_pg_icon_toggle(true); 187 } 188 jQuery('.jagif-popup-gift').data('effect', new_effect); 189} 190 191function jagif_pg_icon_toggle(show = false, added_to_cart = false) { 192 if (show) { 193 if (!added_to_cart && !jQuery('.jagif-popup-gift-wrap').data('empty_enable') && !jQuery('.jagif-popup-gift-wrap').find('.jagif-popup-gift-pd-wrap').length) { 194 return false; 195 } 196 jQuery('.jagif-popup-gift-icon-wrap').removeClass('jagif-disabled jagif-popup-gift-icon-wrap-close jagif-popup-gift-icon-wrap-mouseenter jagif-popup-gift-icon-wrap-mouseleave'); 197 jQuery('.jagif-popup-gift-icon-wrap').addClass('jagif-popup-gift-icon-wrap-open'); 198 } else { 199 jQuery('.jagif-popup-gift-icon-wrap').addClass('jagif-popup-gift-icon-wrap-close'); 200 jQuery('.jagif-popup-gift-icon-wrap').removeClass('jagif-popup-gift-icon-wrap-open jagif-popup-gift-icon-wrap-mouseenter jagif-popup-gift-icon-wrap-mouseleave'); 201 } 202} 203 204function jagif_pg_design(wrap) { 205 wrap = jQuery(wrap); 206 if (window.innerWidth < 782) { 207 wrap.css({maxHeight: window.innerHeight}); 208 } 209} 210 211function jagifSlideLeft(item, speed, opacity, right) { 212 if (opacity === 0) jQuery(item).css('visibility', 'hidden'); else jQuery(item).css('visibility', 'visible'); 213 jQuery(item).animate({ 214 'opacity': opacity, 215 'left': -right + 'px' 216 }, speed || 400); 217} 218 219function jagifSlideRight(item, speed, opacity, right) { 220 if (opacity === 0) jQuery(item).css('visibility', 'hidden'); else jQuery(item).css('visibility', 'visible'); 221 jQuery(item).animate({ 222 'opacity': opacity, 223 'left': -right + 'px' 224 }, speed || 400); 225}
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.