1(function($){ 2"use strict"; 3 4 function u(e) { 5 return typeof e == 'undefined' ? false : e; 6 } 7 8 $(document).ajaxComplete( function() { 9 isb_register(); 10 }); 11 12 function _switch_badge(e,v) { 13 var f = e.closest('.type-product'); 14 15 f.find('.isb_variable').hide(); 16 17 if ( v == '' ) { 18 f.find('.isb_variable[data-id=0]').show(); 19 } 20 else { 21 f.find('.isb_variable[data-id='+v+']').show(); 22 } 23 } 24 25 $(document).on( 'change', 'input[name=variation_id]', function() { 26 _switch_badge($(this),$(this).val()); 27 _do_badges(); 28 }); 29 30 var domInterval = null; 31 $('body').on('DOMSubtreeModified', '.ivpa-content', function() { 32 clearInterval(domInterval); 33 var v = $(this); 34 domInterval = setInterval( function() { 35 __check_for_badges_ipa(v); 36 }, 500); 37 }); 38 39 40 function __check_for_badges_ipa(v) { 41 _switch_badge(v,v.attr('data-selected')); 42 _do_badges(); 43 44 clearInterval(domInterval); 45 } 46 47 function _do_badges() { 48 $('.isb_badges').each( function() { 49 __check_badge_margins($(this)); 50 } ); 51 } 52 53 function isb_register() { 54 55 $('.isb_variable_group:not(.isb_registered)').each( function() { 56 57 $(this).addClass('isb_registered'); 58 59 var curr = $(this).closest('.type-product').find('input[name=variation_id]').val(); 60 61 if ( u(curr) === false ) { 62 curr = $(this).closest('.type-product').find('.ivpa-content').attr('data-selected'); 63 } 64 65 if ( u(curr) === false ) { 66 curr = 0; 67 } 68 69 $(this).find('.isb_variable[data-id='+curr+']').show(); 70 71 }); 72 73 $('.isb_scheduled_sale:not(.isb_registered)').each( function() { 74 75 $(this).addClass('isb_registered'); 76 77 var curr = $(this).find('span.isb_scheduled_time'); 78 79 if ( curr.text() == '' ) { 80 return; 81 } 82 83 var timestamp = curr.text() - isb.time; 84 85 function component(x, v) { 86 return Math.floor(x / v); 87 } 88 89 var $div = curr; 90 91 function do_it() { 92 timestamp--; 93 94 var days = component(timestamp, 24 * 60 * 60), 95 hours = component(timestamp, 60 * 60) % 24, 96 minutes = component(timestamp, 60) % 60, 97 seconds = component(timestamp, 1) % 60; 98 99 if ( curr.hasClass('isb_scheduled_compact') ) { 100 $div.html( ( days !== 0 ? days + '<span>'+isb.localization.d+'</span>' : '' ) + hours + ':' + minutes + ':' + seconds); 101 } 102 else { 103 $div.html( ( days !== 0 ? days + ' '+isb.localization.days+', ' : '' ) + hours + ':' + minutes + ':' + seconds); 104 } 105 if ( days == 0 ) { 106 curr.addClass('isb_no_date'); 107 } 108 109 } 110 do_it(); 111 setInterval(function() { 112 do_it(); 113 }, 1000); 114 115 } ); 116 117 _do_badges(); 118 119 } 120 121 function _get_heights(e,i) { 122 var d = $(e[(i-1)]); 123 var dSale = d.find('.isb_scheduled_sale:visible').length>0?d.find('.isb_scheduled_sale:visible').outerHeight()+7:0, 124 dMargin = parseInt(d.css('margin-top'),10)+3; 125 return d.is('.isb_variable_group') ? d.find(':first').outerHeight()+dSale+dMargin : d.outerHeight()+dSale+dMargin; 126 } 127 128 function __check_badge_margins(c) { 129 130 var lefts = c.find('> .isb_left'); 131 lefts.each( function(i,o) { 132 if ( i>0 ) { 133 $(o).css('margin-top', _get_heights(lefts,i)); 134 } 135 } ); 136 137 var rights = c.find('> .isb_right'); 138 rights.each( function(i,o) { 139 if ( i>0 ) { 140 $(o).css('margin-top', _get_heights(rights,i)); 141 } 142 } ); 143 144 } 145 146 isb_register(); 147 148})(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.