1jQuery(document).ready(function($) { 2 gt3_animate_cart (); 3 gt3_spinner_up_down (); 4 gt3_size_guide (); 5 gt3_comment_label(); 6 gt3_category_accordion(); 7 woocommerce_triger_lightbox(); 8}); 9 10jQuery(window).load(function($) { 11 var $anim_prod = jQuery(".gt3-animation-wrapper.gt3-anim-product"); 12 if ($anim_prod.length) { 13 gt3_scroll_animation($anim_prod, false); 14 } 15}); 16 17jQuery(window).resize(function($){ 18 19}); 20 21jQuery( document ).ajaxComplete(function() { 22 var select = jQuery('#yith-quick-view-modal').find('.variations select'); 23 if (select.length) { 24 select.on('change', function(){ 25 var thumbnails = jQuery('#yith-quick-view-modal').find('.gt3-thumbnails-control'); 26 var selectEmpty = true; 27 28 select.each(function(){ 29 var easyzoom = jQuery("#yith-quick-view-content").find(".woocommerce-product-gallery__image").easyZoom(); 30 var api = easyzoom.data('easyZoom'); 31 api.teardown(); 32 api._init(); 33 34 if ( this.value !== '') { 35 selectEmpty = false; 36 } 37 }); 38 39 if ( selectEmpty ) { 40 thumbnails.css({'height':'auto'}); 41 } else { 42 thumbnails.find('.gt3-thumb-control-item:first').trigger( "click" ); 43 thumbnails.css({'height':'0'}); 44 } 45 }) 46 } 47}); 48 49function gt3_scroll_animation($el, newItem) { 50 var order = 0, 51 lastOffsetTop = 0; 52 jQuery.each($el, function(index, value) { 53 var el = jQuery(this); 54 el.imagesLoaded(function() { 55 var elOffset = el.offset(), 56 windowHeight = jQuery(window).outerHeight(), 57 delay = 0, 58 offset = 20; 59 if (elOffset.top > (windowHeight + offset)) { 60 if (order === 0) { 61 lastOffsetTop = elOffset.top; 62 } else { 63 if (lastOffsetTop !== elOffset.top) { 64 order = 0; 65 lastOffsetTop = elOffset.top; 66 } 67 } 68 order++; 69 index = order; 70 } 71 delay = index * 0.20; 72 el.css({'transition-delay': delay + 's'}).attr('data-delay', delay).attr('data-delay', delay); 73 }); 74 }); 75 $el.appear(function() { 76 var el = jQuery(this) 77 , windowScrollTop = jQuery(window).scrollTop(); 78 if (newItem) { 79 el.addClass('loaded'); 80 } else { 81 var addLoaded = setTimeout(function() { 82 el.addClass('loaded'); 83 }, 300); 84 if (windowScrollTop > 100) { 85 clearTimeout(addLoaded); 86 el.addClass('loaded'); 87 } 88 } 89 var elDur = el.css('transition-duration') 90 , elDelay = el.css('transition-delay') 91 , timeRemove = elDur.split('s')[0] * 1000 + elDelay.split('s')[0] * 1000 + 4000 92 , notRemove = '.wil-progress'; 93 el.not(notRemove).delay(timeRemove).queue(function() { 94 el.removeClass('loaded gt3-anim-product').dequeue(); 95 }); 96 el.delay(timeRemove).queue(function() { 97 el.css('transition-delay', ''); 98 }); 99 }, { 100 accX: 0, 101 accY: 30 102 }); 103} 104 105// Cart Count Icon Animation 106function gt3_animate_cart () { 107 jQuery.fn.shake = function(intShakes, intDistance, intDuration) { 108 this.each(function() { 109 for (var x=1; x<=intShakes; x++) { 110 jQuery(this).animate({left:(intDistance*-1)}, (((intDuration/intShakes)/4))) 111 .animate({left:intDistance}, ((intDuration/intShakes)/2)) 112 .animate({left:0}, (((intDuration/intShakes)/4))); 113 } 114 }); 115 return this; 116 }; 117 jQuery(document.body).live('added_to_cart', function(el, data, params){ 118 setTimeout(function(){ 119 jQuery(".gt3_header_builder_cart_component").addClass("show_cart"); 120 jQuery(".woo_mini-count").shake(3,1.2,300); 121 jQuery(".gt3-loading-overlay, .gt3-loading").remove(); 122 }, 300); 123 setTimeout(function(){ 124 jQuery(".gt3_header_builder_cart_component").removeClass("show_cart"); 125 }, 2800); 126 }); 127} 128 129// Input spinner 130function gt3_spinner_up_down () { 131 var rtime; 132 var timeout = false; 133 var delta = 400; 134 135 jQuery('body').on('tap click', '.gt3_qty_spinner .quantity-up', function() { 136 var input = jQuery(this).parent().find('input[type="number"]'), 137 max = input.attr('max'), 138 oldValue = parseFloat(input.val()), 139 newVal; 140 if (oldValue >= max && '' !== max) { 141 newVal = oldValue; 142 } else { 143 newVal = oldValue + 1; 144 } 145 input.val(newVal).addClass('allotted'); 146 input.trigger("change"); 147 148 gt3_timeout(input); 149 }); 150 151 jQuery('body').on('tap click', '.gt3_qty_spinner .quantity-down', function() { 152 var input = jQuery(this).parent().find('input[type="number"]'), 153 min = input.attr('min'), 154 oldValue = parseFloat(input.val()), 155 newVal; 156 if (oldValue <= min && '' !== min) { 157 newVal = oldValue; 158 } else { 159 newVal = oldValue - 1; 160 } 161 input.val(newVal).addClass('allotted'); 162 input.trigger("change"); 163 164 gt3_timeout(input); 165 }); 166 167 function gt3_timeout(input){ 168 rtime = new Date(); 169 if (timeout === false) { 170 timeout = true; 171 setTimeout(clickend, delta); 172 } 173 function clickend() { 174 if (new Date() - rtime < delta) { 175 setTimeout(clickend, delta); 176 } else { 177 timeout = false; 178 input.removeClass('allotted'); 179 } 180 } 181 } 182} 183 184function gt3_size_guide() { 185 var size_popup = jQuery('.gt3_block_size_popup'); 186 if (size_popup.length) { 187 size_popup.on('tap click', function(){ 188 image_size_popup = jQuery('.image_size_popup'); 189 image_size_popup.addClass('active'); 190 if (image_size_popup.hasClass('active')) { 191 jQuery(document).keyup(function(e) { 192 if (e.keyCode === 27) image_size_popup.removeClass('active'); 193 }); 194 jQuery('.image_size_popup .layer, .image_size_popup .close').on('tap click', function(){ 195 image_size_popup.removeClass('active'); 196 }); 197 } 198 }); 199 } 200} 201 202function gt3_comment_label() { 203 var $label = jQuery('#respond').find('#commentform p[class*="comment-form-"] > label'); 204 if ($label.length) { 205 $label.each(function () { 206 var _this_label = jQuery(this); 207 _this_label.parent().find('input, textarea').on('focus', function () { 208 _this_label.addClass('gt3_onfocus'); 209 }).on('blur', function () { 210 if (jQuery(this).val() === "") { 211 _this_label.removeClass('gt3_onfocus'); 212 } else { 213 _this_label.addClass('gt3_onfocus'); 214 } 215 }); 216 }) 217 } 218} 219 220function gt3_search_label() { 221 var $form = jQuery('.gt3_search_form, .gt3_form, #mc_signup .mc_merge_var'); 222 if ($form.length) { 223 $form.each(function () { 224 var _elem = jQuery(this).find('input, textarea'); 225 if (_elem.val() !== "") { 226 _elem.prev('label').addClass('gt3_onfocus'); 227 } 228 _elem.on('focus', function () { 229 jQuery(this).prev('label').addClass('gt3_onfocus'); 230 }).on('blur', function () { 231 if (jQuery(this).val() === "") { 232 jQuery(this).prev('label').removeClass('gt3_onfocus'); 233 } 234 }); 235 }) 236 } 237} 238 239function gt3_category_accordion () { 240 var widget_product_categories = jQuery('.widget_product_categories'); 241 if (widget_product_categories.length) { 242 widget_product_categories.each(function(){ 243 var $this = jQuery(this); 244 var elements = $this.find('.product-categories>li.cat-parent'); 245 246 for (var i = 0; i < elements.length; i++) { 247 if ( jQuery(elements[i]).hasClass('current-cat-parent') ) { 248 jQuery(elements[i]).addClass('open').find('.current-cat').parent().slideDown(); 249 } 250 jQuery(elements[i]).append("<span class=\"gt3-button-cat-open\"></span>"); 251 } 252 }); 253 jQuery(".gt3-button-cat-open").on("click", function () { 254 jQuery(this).parent().toggleClass('open'); 255 if (jQuery(this).parent().hasClass('open')) { 256 jQuery(this).parent().children('.children').slideDown(); 257 } else {
258 jQuery(this).parent().children('.children').slideUp(); 259 } 260 }) 261 } 262} 263 264// func called from frontend 265function gt3_clear_recently_products(el){ 266 document.cookie = 'gt3_product_recently_viewed=;path=/'; 267 jQuery(el).parent().fadeOut(400); 268} 269 270function woocommerce_triger_lightbox() { 271 jQuery('.woocommerce-product-gallery .woocommerce-product-gallery__wrapper').on('click', function (e) { 272 jQuery('.woocommerce-product-gallery .woocommerce-product-gallery__trigger').trigger( "click" ); 273 // e.preventDefault(); 274 }); 275}
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.