1(function(){ 2 $(document).ready(function(){ 3 var hpm_config = window['hpm_config'] || {}; 4 var dropBlock = false; var activeOpt = false; 5 $(document).on('mouseenter', '.hpm-cat-item', function(){ 6 var $t = $(this); var $c = $t.closest(hpm_config.cat_item ? hpm_config.cat_item : '.product-thumb, .product'); 7 if (hpm_config.event && hpm_config.event.mouseenter && !hpm_config.event.mouseenter($c, $t)) return; 8 if ($t.data('thumb')) { 9 $c.find('.image img').attr('src', $t.data('thumb')); 10 } 11 }).on('mouseleave', '.hpm-cat-box', function(){ 12 var $c = $(this).closest(hpm_config.cat_item ? hpm_config.cat_item : '.product-thumb, .product'); 13 if ($c.find('.hpm-cat-item').length == 0) return; 14 if (hpm_config.event && hpm_config.event.mouseleave && !hpm_config.event.mouseleave($c)) return; 15 var $a = $c.find('.hpm-cat-item.active'); 16 var $hc = $c.find('.hpm-cat-box'); 17 if ($a.length && $a.data('thumb')) { 18 $c.find('.image img').attr('srcset', '').attr('src', $a.data('thumb')); 19 } else if ($hc.length && $hc.data('thumb')) { 20 $c.find('.image img').attr('srcset', '').attr('src', $hc.data('thumb')); 21 } 22 }).on('click', '.hpm-cat-item', function(){ 23 if (!$(this).data('id')) return; 24 hpm_select($(this)); 25 }).on('change', '.hpm-cat-box select', function(){ 26 hpm_select($(this).find('option:selected')); 27 }).on('click', function(e){ 28 var $t = $(e.target).closest('.hpm-select .selected'); var $si = $(e.target).closest('.hpm-select-item') 29 if ($t.length) { 30 var $p = $t.parent(); var $drop = $p.parent().find('.drop-down'); 31 if($drop.is(':hidden')) { 32 $drop.slideDown(); 33 $p.addClass('open'); 34 } else { 35 $drop.slideUp(); 36 $p.removeClass('open'); 37 } 38 return false; 39 } else if ($si.length) { 40 var $p = $si.closest('.hpm-select'); 41 if ($p.find('.selected .hpm-select-item').length) { 42 $p.find('.selected .hpm-select-item').html($si.html()); 43 } else { 44 $p.find('.selected').html('<div class="hpm-select-item">'+$si.html()+'</div>'); 45 } 46 $p.find('.drop-down').slideUp(); 47 $p.removeClass('open'); 48 } else if ($('.hpm-select.open').length) { 49 $('.hpm-select.open .drop-down').slideUp(); 50 $('.hpm-select.open').removeClass('open'); 51 } 52 }); 53 function hpm_select($t) { 54 var $c = $t.closest(hpm_config.cat_item ? hpm_config.cat_item : '.product-thumb, .product'); 55 $c.find('.hpm-cat-item').removeClass('active'); 56 $t.addClass('active'); 57 if (hpm_config.event && hpm_config.event.select && !hpm_config.event.select($c, $t)) return; 58 $c.find('[onclick*="cart.add("]').attr('onclick', 'cart.add('+$t.data('id')+',1)'); 59 $c.find('[onclick*="wishlist.add("]').attr('onclick', 'wishlist.add('+$t.data('id')+')'); 60 $c.find('[onclick*="compare.add"]').attr('onclick', 'compare.add('+$t.data('id')+')'); 61 if ($t.data('price')) { 62 var ph = $t.data('price'); 63 if ($t.data('special')) ph = '<span class="price-new">'+$t.data('special')+'</span> <span class="price-old">'+ph+'</span>'; 64 $c.find('.price').html(ph); 65 } 66 $c.find('a[data-hpm-href="1"]').attr('href', $t.data('href')); 67 if ($t.data('name')) { 68 $c.find('.caption a[data-hpm-href="1"]').text($t.data('name')); 69 $c.find('a[data-hpm-href="1"] img').attr('alt', $t.data('name')).attr('title', $t.data('name')); 70 } 71 if ($t.data('thumb')) { 72 $c.find('.image img').attr('srcset', '').attr('src', $t.data('thumb')); 73 } 74 } 75 function hpm_onload() { 76 //$('.hpm-cat-box').each(function(){if (!$(this).find('.hpm-cat-item.active').length)$(this).find('.hpm-cat-item').first().trigger('click');}); 77 hpm_config.event && hpm_config.event.load && !hpm_config.event.load(); 78 } 79 hpm_onload(); 80 $(document).ajaxComplete(function(){hpm_onload();}); 81 }); 82})();
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.