window['wishlist'] || {}; window['wishlist'].add = function (product_id) { $.ajax({ url: 'index.php?route=account/wishlist/add', type: 'post', data: 'product_id=' + product_id, dataType: 'json', success: function (json) { $('.alert').remove(); if (json['redirect']) { location = json['redirect']; } if (json['success']) { $('[data-toggle="tooltip"]').tooltip('hide'); if (json['notification']) { show_notification(json['notification']); } else { $('header').after('
' + json['success'] + '
'); } } $('#wishlist-total span').html(json['total']); $('#wishlist-total').attr('title', json['total']); $('.wishlist-badge').text(json['count']); if (json['count']) { $('.wishlist-badge').removeClass('count-zero'); } else { $('.wishlist-badge').addClass('count-zero'); } if (Journal['scrollToTop']) { $('html, body').animate({ scrollTop: 0 }, 'slow'); } }, error: function (xhr, ajaxOptions, thrownError) { alert(thrownError + '\r\n' + xhr.statusText + '\r\n' + xhr.responseText); } }); }; window['compare'] = window['compare'] || {}; window['compare'].add = function (product_id) { $.ajax({ url: 'index.php?route=product/compare/add', type: 'post', data: 'product_id=' + product_id, dataType: 'json', success: function (json) { $('.alert').remove(); if (json['success']) { $('[data-toggle="tooltip"]').tooltip('hide'); if (json['notification']) { show_notification(json['notification']); } else { $('header').after('
' + json['success'] + '
'); } $('#compare-total').html(json['total']); $('.compare-badge').text(json['count']); if (json['count']) { $('.compare-badge').removeClass('count-zero'); } else { $('.compare-badge').addClass('count-zero'); } if (Journal['scrollToTop']) { $('html, body').animate({ scrollTop: 0 }, 'slow'); } } }, error: function (xhr, ajaxOptions, thrownError) { alert(thrownError + '\r\n' + xhr.statusText + '\r\n' + xhr.responseText); } }); }; window['quickview'] = function (product_id) { product_id = parseInt(product_id, 10); // hide tooltip $('[data-toggle="tooltip"]').tooltip('hide'); var html = ''; html += ''; // show modal $('.popup-wrapper').remove(); $('body').append(html); setTimeout(function () { $('html').addClass('popup-open popup-center'); }, 10); }; window['open_popup'] = function (module_id) { if ($('html').hasClass('iphone') || $('html').hasClass('ipad')) { iNoBounce.enable(); } module_id = parseInt(module_id, 10); var html = ''; html += ''; // show modal $('.popup-wrapper').remove(); $('body').append(html); setTimeout(function () { $('html').addClass('popup-open popup-center'); }, 10); $('.popup-container').css('visibility', 'hidden'); $.ajax({ url: 'index.php?route=journal3/popup/get&module_id=' + module_id + '&popup=module', success: function (html) { var $html = $(html); var $popup = $html.siblings('.module-popup'); var $style = $html.siblings('style'); var $content = $popup.find('.popup-container'); $('#popup-style-' + module_id).remove(); $('head').append($style.attr('id', 'popup-style-' + module_id)); $('.popup-wrapper').attr('class', $popup.attr('class')); $('.popup-container').html($content.html()); $('.popup-container').css('visibility', 'visible'); }, error: function (xhr, ajaxOptions, thrownError) { alert(thrownError + '\r\n' + xhr.statusText + '\r\n' + xhr.responseText); } }); }; window['open_login_popup'] = function () { if ($('html').hasClass('iphone') || $('html').hasClass('ipad')) { iNoBounce.enable(); } var html = ''; html += ''; // show modal $('.popup-wrapper').remove(); $('body').append(html); setTimeout(function () { $('html').addClass('popup-open popup-center'); }, 10); }; window['open_register_popup'] = function () { if ($('html').hasClass('iphone') || $('html').hasClass('ipad')) { iNoBounce.enable(); } var html = ''; html += ''; // show modal $('.popup-wrapper').remove(); $('body').append(html); setTimeout(function () { $('html').addClass('popup-open popup-center'); }, 10); }; window['show_notification'] = function (opts) { opts = $.extend({ position: 'center', className: '', title: '', image: '', message: '', buttons: [], timeout: Journal.notificationHideAfter }, opts); if ($('.notification-wrapper-' + opts.position).length === 0) { $('body').append('
'); } var html = ''; var buttons = $.map(opts.buttons, function (button) { return '' + button.name + ''; }); html += '
'; html += ' '; html += '
'; if (opts.image) { html += ' '; } html += '
'; html += '
' + opts.title + '
'; html += '
' + opts.message + '
'; html += '
'; html += '
'; if (buttons && buttons.length) { html += '
' + buttons.join('\n') + '
'; } html += '
'; var $notification = $(html); $('.notification-wrapper-' + opts.position).append($notification); if (opts.timeout) { setTimeout(function () { $notification.find('.notification-close').trigger('click'); }, opts.timeout); } return $notification; }; window['loader'] = function (el, status) { var $el = $(el); if (status) { $el.attr('style', 'position: relative'); $el.append('
'); } else { $el.attr('style', ''); $el.find('.journal-loading-overlay').remove(); } }; window['resize_iframe'] = function (module_id, height) { $('.module-popup-' + module_id + ' iframe').height(height); }; Ә