'use strict'; (function($) { $(function() { wooct_init(); }); // WPC Smart Quick View $(document).on('woosq_loaded', function() { wooct_init(); }); // WPC Smart Compare $(document).on('woosc_table_loaded', function() { wooct_init(); }); // WPC Added To Cart Notification $(document).on('wooac_show', function() { wooct_init(); }); // WPC Fly Cart $(document).on('woofc_cart_loaded woofc_show_cart', function() { setTimeout(function() { wooct_init(); }, 500); }); // WPC Smart Wishlist $(document).on('woosw_wishlist_show', function() { wooct_init(); }); // WPC Smart Notifications $(document).on('wpcsn_build_template', function() { wooct_init(); }); // WPC AJAX Search $(document).on('wpcas_loaded wpcas_show', function() { wooct_init(); }); // All $(document).on('wooct_init', function() { wooct_init(); }); $(document).on('found_variation', function(e, t) { var product_id = $(e['target']). closest('.variations_form'). data('product_id'); if ((t.wooct != undefined) && (t.wooct !== '')) { if ($('.wooct-wrap-single[data-id="' + product_id + '"]').length) { $('.wooct-wrap-single[data-id="' + product_id + '"]').hide(); if ($('.wooct-wrap-single-variation[data-id="' + product_id + '"]').length) { $('.wooct-wrap-single-variation[data-id="' + product_id + '"]'). html(wooct_decode_entities(t.wooct)).show(); } else { $('
'). insertAfter('.wooct-wrap-single[data-id="' + product_id + '"]'); $('.wooct-wrap-single-variation[data-id="' + product_id + '"]'). html(wooct_decode_entities(t.wooct)).show(); } } else if ($( '.wooct-wrap-variation[data-id="' + product_id + '"]').length) { $('.wooct-wrap-variation[data-id="' + product_id + '"]'). html(wooct_decode_entities(t.wooct)).show(); } wooct_init(); } else { $('.wooct-wrap-single-variation[data-id="' + product_id + '"]'). html(''). hide(); $('.wooct-wrap-variation[data-id="' + product_id + '"]').html('').show(); $('.wooct-wrap-single[data-id="' + product_id + '"]').show(); } }); $(document).on('reset_data', function(e) { var product_id = $(e['target']). closest('.variations_form'). data('product_id'); $('.wooct-wrap-single-variation[data-id="' + product_id + '"]'). html(''). hide(); $('.wooct-wrap-variation[data-id="' + product_id + '"]').html('').show(); $('.wooct-wrap-single[data-id="' + product_id + '"]').show(); }); })(jQuery); function wooct_init() { jQuery(document).find('.wooct-countdown').each(function() { wooct_init_e(jQuery(this)); }); jQuery(document.body).trigger('wooct_initialized'); } function wooct_init_e($el) { if (!$el.hasClass('wooct-initialized')) { // don't init twice $el.addClass('wooct-initialized'); var timer = $el.attr('data-timer'); var style = $el.attr('data-style'); var text_ended = $el.attr('data-ended'); //var timer_tz = moment.tz(timer, 'MM/DD/YYYY hh:mm a', wooct_vars.timezone); var timer_tz = moment.utc(timer, 'MM/DD/YYYY hh:mm a'). utcOffset(wooct_vars.gmt_offset * 60, true); if ($el.hasClass('wooct-flipper')) { var timestamp = Date.parse(timer_tz.toDate()); var timer_str = moment(timestamp).format('YYYY-MM-DD HH:mm:ss'); $el.find('.flipper'). attr('data-datetime', timer_str). flipper('init'); var interval = setInterval(function() { if (Date.now() > timestamp) { if (text_ended !== '') { $el.removeClass('wooct-running'). addClass('wooct-ended'). html('