1'use strict'; 2 3(function($) { 4 $(function() { 5 wooct_init(); 6 }); 7 8 // WPC Smart Quick View 9 $(document).on('woosq_loaded', function() { 10 wooct_init(); 11 }); 12 13 // WPC Smart Compare 14 $(document).on('woosc_table_loaded', function() { 15 wooct_init(); 16 }); 17 18 // WPC Added To Cart Notification 19 $(document).on('wooac_show', function() { 20 wooct_init(); 21 }); 22 23 // WPC Fly Cart 24 $(document).on('woofc_cart_loaded woofc_show_cart', function() { 25 setTimeout(function() { 26 wooct_init(); 27 }, 500); 28 }); 29 30 // WPC Smart Wishlist 31 $(document).on('woosw_wishlist_show', function() { 32 wooct_init(); 33 }); 34 35 // WPC Smart Notifications 36 $(document).on('wpcsn_build_template', function() { 37 wooct_init(); 38 }); 39 40 // WPC AJAX Search 41 $(document).on('wpcas_loaded wpcas_show', function() { 42 wooct_init(); 43 }); 44 45 // All 46 $(document).on('wooct_init', function() { 47 wooct_init(); 48 }); 49 50 $(document).on('found_variation', function(e, t) { 51 var product_id = $(e['target']). 52 closest('.variations_form'). 53 data('product_id'); 54 55 if ((t.wooct != undefined) && (t.wooct !== '')) { 56 if ($('.wooct-wrap-single[data-id="' + product_id + '"]').length) { 57 $('.wooct-wrap-single[data-id="' + product_id + '"]').hide(); 58 59 if ($('.wooct-wrap-single-variation[data-id="' + product_id + 60 '"]').length) { 61 $('.wooct-wrap-single-variation[data-id="' + product_id + '"]'). 62 html(wooct_decode_entities(t.wooct)).show(); 63 } else { 64 $('<div class="wooct-wrap-single-variation" data-id="' + product_id + 65 '"></div>'). 66 insertAfter('.wooct-wrap-single[data-id="' + product_id + '"]'); 67 $('.wooct-wrap-single-variation[data-id="' + product_id + '"]'). 68 html(wooct_decode_entities(t.wooct)).show(); 69 } 70 } else if ($( 71 '.wooct-wrap-variation[data-id="' + product_id + '"]').length) { 72 $('.wooct-wrap-variation[data-id="' + product_id + '"]'). 73 html(wooct_decode_entities(t.wooct)).show(); 74 } 75 76 wooct_init(); 77 } else { 78 $('.wooct-wrap-single-variation[data-id="' + product_id + '"]'). 79 html(''). 80 hide(); 81 $('.wooct-wrap-variation[data-id="' + product_id + '"]').html('').show(); 82 $('.wooct-wrap-single[data-id="' + product_id + '"]').show(); 83 } 84 }); 85 86 $(document).on('reset_data', function(e) { 87 var product_id = $(e['target']). 88 closest('.variations_form'). 89 data('product_id'); 90 91 $('.wooct-wrap-single-variation[data-id="' + product_id + '"]'). 92 html(''). 93 hide(); 94 $('.wooct-wrap-variation[data-id="' + product_id + '"]').html('').show(); 95 $('.wooct-wrap-single[data-id="' + product_id + '"]').show(); 96 }); 97})(jQuery); 98 99function wooct_init() { 100 jQuery(document).find('.wooct-countdown').each(function() { 101 wooct_init_e(jQuery(this)); 102 }); 103 104 jQuery(document.body).trigger('wooct_initialized'); 105} 106 107function wooct_init_e($el) { 108 if (!$el.hasClass('wooct-initialized')) { 109 // don't init twice 110 $el.addClass('wooct-initialized'); 111 112 var timer = $el.attr('data-timer'); 113 var style = $el.attr('data-style'); 114 var text_ended = $el.attr('data-ended'); 115 //var timer_tz = moment.tz(timer, 'MM/DD/YYYY hh:mm a', wooct_vars.timezone); 116 var timer_tz = moment.utc(timer, 'MM/DD/YYYY hh:mm a'). 117 utcOffset(wooct_vars.gmt_offset * 60, true); 118 119 if ($el.hasClass('wooct-flipper')) { 120 var timestamp = Date.parse(timer_tz.toDate()); 121 var timer_str = moment(timestamp).format('YYYY-MM-DD HH:mm:ss'); 122 123 $el.find('.flipper'). 124 attr('data-datetime', timer_str). 125 flipper('init'); 126 127 var interval = setInterval(function() { 128 if (Date.now() > timestamp) { 129 if (text_ended !== '') { 130 $el.removeClass('wooct-running'). 131 addClass('wooct-ended'). 132 html('<div class="wooct-text-ended">' + text_ended + '</div>'); 133 } else { 134 $el.remove(); 135 } 136 clearInterval(interval); 137 } 138 }, 1000); 139 } else if (!$el.hasClass('wooct-ended')) { 140 var timer_format = wooct_vars.timer_format; 141 142 if (wooct_vars.hasOwnProperty('timer_format_' + style)) { 143 timer_format = wooct_vars['timer_format_' + style]; 144 } 145 146 $el.find('.wooct-timer'). 147 countdown(timer_tz.toDate(), function(event) { 148 jQuery(this).html(event.strftime(timer_format)); 149 }). 150 on('update.countdown', function(e) { 151 // style 07 152 if ($el.hasClass('wooct-style-07')) { 153 // second 154 $el.find('.s'). 155 removeClass(). 156 addClass( 157 's c100 p' + Math.round((e.offset.seconds / 60) * 100)); 158 // minute 159 $el.find('.m'). 160 removeClass(). 161 addClass( 162 'm c100 p' + Math.round((e.offset.minutes / 60) * 100)); 163 // hour 164 $el.find('.h'). 165 removeClass(). 166 addClass( 167 'h c100 p' + Math.round((e.offset.hours / 24) * 100)); 168 // day 169 $el.find('.d'). 170 removeClass(). 171 addClass( 172 'd c100 p' + Math.round((e.offset.days / 365) * 100)); 173 } 174 }). 175 on('finish.countdown', function() { 176 if (text_ended !== '') { 177 $el.removeClass('wooct-running'). 178 addClass('wooct-ended'). 179 html( 180 '<div class="wooct-text-ended">' + text_ended + '</div>'); 181 } else { 182 $el.remove(); 183 } 184 }); 185 } 186 187 // init css 188 if ($el.find('.wooct-css').length) { 189 if (!$el.find('.wooct-css style').length) { 190 $el.find('.wooct-css').wrapInner('<style></style>'); 191 } 192 } 193 } 194} 195 196function wooct_decode_entities(encodedString) { 197 var textArea = document.createElement('textarea'); 198 textArea.innerHTML = encodedString; 199 200 return textArea.value; 201}
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.