1(function($) { 2 "use strict"; 3 4 function get_cart() { 5 if (window.wc_add_to_cart_params != undefined) { 6 $.post({ 7 url: wc_add_to_cart_params.ajax_url, 8 dataType: 'JSON', 9 data: { 10 action: 'woomenucart_ajax' 11 }, 12 success: function(data, textStatus, XMLHttpRequest) { 13 $('.uncode-cart-dropdown').html(data.cart); 14 if (data != '') { 15 if ($('.uncode-cart .badge, .mobile-shopping-cart .badge').length) { 16 if (data.articles > 0) { 17 $('.uncode-cart .badge, .mobile-shopping-cart .badge').html(data.articles); 18 $('.uncode-cart .badge, .mobile-shopping-cart .badge').show(); 19 } else { 20 $('.uncode-cart .badge, .mobile-shopping-cart .badge').hide(); 21 } 22 } else $('.uncode-cart .cart-icon-container').append('<span class="badge">' + data.articles + '</span>'); //$('.uncode-cart .badge').html(data.articles); 23 } 24 } 25 }); 26 } 27 28 } 29 30 function remove_from_cart() { 31 $(document).on('click', '.uncode-cart-dropdown a.remove', function(e){ 32 33 var $remove = $(this), 34 product_id = $remove.attr("data-product_id"), 35 item_key = $remove.attr("data-item_key"), 36 $li = $remove.parents('.cart-item-list').eq(0).addClass('removing-item').animate({ 37 opacity: .5 38 },150); 39 40 $.post({ 41 dataType: 'json', 42 url: wc_add_to_cart_params.ajax_url, 43 data: { 44 action: "woomenucart_remove_ajax", 45 item_key: item_key 46 }, 47 success: function(html){ 48 $li.slideUp(200, function(){ 49 get_cart(); 50 }); 51 } 52 }); 53 54 return false; 55 }); 56 } 57 58 function change_images(event, variation) { 59 if (variation.image_src !== '') { 60 var get_href = $('a.woocommerce-main-image'), 61 image_variable = $('> img', get_href), 62 getLightbox = UNCODE.lightboxArray[get_href.data('lbox')]; 63 get_href.data('options', "thumbnail: '" + variation.image_src + "'"); 64 image_variable.attr('src', variation.image_src); 65 if (image_variable.hasClass('async-done')) { 66 image_variable.attr('data-path', variation.uncode_image_path); 67 image_variable.attr('data-guid', variation.uncode_image_guid); 68 image_variable.removeClass('async-done').addClass('adaptive-async'); 69 UNCODE.adaptive(); 70 } 71 if (getLightbox != undefined) getLightbox.refresh(); 72 $(window).trigger('focus'); 73 } 74 } 75 $(document).ready(function() { 76 remove_from_cart(); 77 $('body').bind("added_to_cart", get_cart); 78 $('body').bind("wc_fragments_refreshed", get_cart); 79 $('.variations_form').bind("show_variation", change_images); 80 }); 81 82 $( 'body' ).on( 'init', '#rating', function() { 83 setTimeout(function(){ 84 $('.comment-form-rating').each(function(){ 85 var $wrap = $(this), 86 $stars = $('p.stars', $wrap).remove(); 87 $( 'select[name="rating"]', $wrap ).hide().before( '<p class="stars"><span><a class="star-1" href="#">1</a><a class="star-2" href="#">2</a><a class="star-3" href="#">3</a><a class="star-4" href="#">4</a><a class="star-5" href="#">5</a></span></p>' ); 88 }); 89 }, 10); 90 } ); 91 92 $( '.woocommerce-product-gallery' ).each( function() { 93 94 var $slider = $(this); 95 96 if ($.fn.flexslider) { 97 var $plcholder = $('#woocommerce-product-single-plchold'); 98 $slider.flexslider({ 99 start: function(){ 100 $('img[data-large_image]', $slider).each(function(){ 101 var $img = $(this), 102 url = $img.attr('data-large_image'); 103 }); 104 setTimeout(function(){ 105 $plcholder.remove(); 106 },600); 107 } 108 }); 109 $(window).on('load', function(){ 110 $('.woocommerce-product-gallery__wrapper', $slider).css({'max-width': 'none'}) 111 }); 112 } 113 114 if ($.fn.zoom && $('body').hasClass('wc-zoom-enabled') ) { 115 var $zoomTrgt = $('.woocommerce-product-gallery__image', $slider); 116 117 if ( $('.thumbnails', $slider).length ) 118 $zoomTrgt = $zoomTrgt.first(); 119 120 $zoomTrgt.trigger( 'zoom.destroy' ); 121 $zoomTrgt.zoom(); 122 123 var checkForZoom = function(){ 124 var galleryWidth = $zoomTrgt.width(), 125 zoom_options = { 126 touch: false, 127 callback: function(){ 128 $('.woocommerce-product-gallery__image').each(function(){ 129 var $wrap = $(this), 130 $zoom = $('a.zoom', $wrap), 131 $zoomImg = $('.zoomImg', $wrap); 132 133 $wrap.prepend($zoomImg); 134 }); 135 } 136 }; 137 138 if ( 'ontouchstart' in window ) { 139 zoom_options.on = 'click'; 140 } 141 142 $zoomTrgt.trigger( 'zoom.destroy' ); 143 $zoomTrgt.each(function(){ 144 var $thisTrgt = $(this), 145 $img = $('img', $thisTrgt); 146 147 148 if ( $img.data( 'large_image_width' ) > galleryWidth ) 149 $thisTrgt.zoom(zoom_options); 150 151 }); 152 }; 153 checkForZoom(); 154 155 var setCheckForZoom; 156 $(window).on( 'resize', function(){ 157 clearTimeout(setCheckForZoom); 158 setCheckForZoom = setTimeout( checkForZoom, 150 ); 159 }); 160 } 161 162 } ); 163})(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.