'); $('#form-upload input[name=\'file\']').trigger('click'); if (typeof timer != 'undefined') { clearInterval(timer); } timer = setInterval(function () { if ($('#form-upload input[name=\'file\']').val() != '') { clearInterval(timer); $.ajax({ url: 'index.php?route=tool/upload', type: 'post', dataType: 'json', data: new FormData($('#form-upload')[0]), cache: false, contentType: false, processData: false, beforeSend: function () { $(node).button('loading'); }, complete: function () { $(node).button('reset'); }, success: function (json) { $('.text-danger').remove(); if (json['error']) { $(node).parent().find('input').after('
' + json['error'] + '
'); } if (json['success']) { alert(json['success']); $(node).parent().find('input').val(json['code']); } }, error: function (xhr, ajaxOptions, thrownError) { alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText); } }); } }, 500); }); $('#review').delegate('.pagination a', 'click', function (e) { e.preventDefault(); $('#review').fadeOut('slow'); $('#review').load(this.href); $('#review').fadeIn('slow'); }); $('#review').load('index.php?route=product/product/review&product_id=787'); $('#button-review').on('click', function () { $.ajax({ url: 'index.php?route=product/product/write&product_id=787', type: 'post', dataType: 'json', data: $("#form-review").serialize(), beforeSend: function () { $('#button-review').button('loading'); }, complete: function () { $('#button-review').button('reset'); }, success: function (json) { $('.alert-success, .alert-danger').remove(); if (json['error']) { $('#review').after(' ' + json['error'] + '
'); } if (json['success']) { $('#review').after(' ' + json['success'] + '
'); $('input[name=\'name\']').val(''); $('textarea[name=\'text\']').val(''); $('input[name=\'rating\']:checked').prop('checked', false); } } }); }); if ($(window).width() > 767) { $("#czzoom").elevateZoom({ gallery: 'additional-carousel', zoomType: "inner", cursor: "zoom-in" }); var z_index = 0; $(document).on('click', '.thumbnail', function () { $('.thumbnails').magnificPopup('open', z_index); return false; }); $('.additional-carousel a').click(function () { $(this).closest('.additional-carousel').find('.product-block.active').removeClass('active'); $(this).closest('.product-block').addClass('active'); var smallImage = $(this).attr('data-image'); var largeImage = $(this).attr('data-zoom-image'); var ez = $('#czzoom').data('elevateZoom'); $('.thumbnail').attr('href', largeImage); ez.swaptheimage(smallImage, largeImage); z_index = $(this).index('.additional-carousel a'); return false; }); } else { $(document).on('click', '.thumbnail', function () { $('.thumbnails').magnificPopup('open', 0); return false; }); } $('.thumbnails').magnificPopup({ delegate: 'a.elevatezoom-gallery', type: 'image', tLoading: 'Loading image #%curr%...', mainClass: 'mfp-with-zoom', gallery: { enabled: true, navigateByImgClick: true, preload: [0, 1] // Will preload 0 - before current, and 1 after the current image }, image: { tError: 'The image #%curr% could not be loaded.', titleSrc: function (item) { return item.el.attr('title'); } } }); });