(function(a){a.fn.extend({actual:function(b,k){var c,d,h,g,f,j,e,i;if(!this[b]){throw'$.actual => The jQuery method "'+b+'" you called does not exist';}h=a.extend({absolute:false,clone:false,includeMargin:undefined},k);d=this;if(h.clone===true){e=function(){d=d.filter(":first").clone().css({position:"absolute",top:-1000}).appendTo("body");};i=function(){d.remove();};}else{e=function(){c=d.parents().andSelf().filter(":hidden");g=h.absolute===true?{position:"absolute",visibility:"hidden",display:"block"}:{visibility:"hidden",display:"block"};f=[];c.each(function(){var m={},l;for(l in g){m[l]=this.style[l];this.style[l]=g[l];}f.push(m);});};i=function(){c.each(function(m){var n=f[m],l;for(l in g){this.style[l]=n[l];}});};}e();j=d[b](h.includeMargin);i();return j;}});})(jQuery);
jQuery.fn.inputHints=function(){$(this).each(function(a){$(this).val($(this).attr("title")).addClass("tagged")});return $(this).focus(function(){if($(this).val()==$(this).attr("title"))$(this).val("").removeClass("tagged")}).blur(function(){if($(this).val()=="")$(this).val($(this).attr("title")).addClass("tagged")})}
jQuery.cookie=function(d,e,b){if(arguments.length>1&&String(e)!=="[object Object]"){b=jQuery.extend({},b);if(e===null||e===undefined){b.expires=-1}if(typeof b.expires==="number"){var g=b.expires,c=b.expires=new Date();c.setDate(c.getDate()+g)}e=String(e);return(document.cookie=[encodeURIComponent(d),"=",b.raw?e:encodeURIComponent(e),b.expires?"; expires="+b.expires.toUTCString():"",b.path?"; path="+b.path:"",b.domain?"; domain="+b.domain:"",b.secure?"; secure":""].join(""))}b=e||{};var a,f=b.raw?function(h){return h}:decodeURIComponent;return(a=new RegExp("(?:^|; )"+encodeURIComponent(d)+"=([^;]*)").exec(document.cookie))?f(a[1]):null};
// jQuery Noty Plugin v1.1.1 Licensed under the MIT licenses: https://www.opensource.org/licenses/mit-license.php
(function(b){b.noty=function(d,e){var a=this,c=null,g=!1;a.init=function(c){a.options=b.extend({},b.noty.defaultOptions,c);a.options.type=a.options.cssPrefix+a.options.type;a.options.id=a.options.type+"_"+(new Date).getTime();a.options.layout=a.options.cssPrefix+"layout_"+a.options.layout;a.options.custom.container&&(e=a.options.custom.container);g="object"===b.type(e)?!0:!1;return a.addQueue()};a.addQueue=function(){var c=-1==b.inArray(a.options.layout,b.noty.growls)?!1:!0;c||(a.options.force?b.noty.queue.unshift({options:a.options}): b.noty.queue.push({options:a.options}));return a.render(c)};a.render=function(d){var f=g?e.addClass(a.options.theme+" "+a.options.layout+" noty_custom_container"):b("body");if(d)0==b("ul.noty_cont."+a.options.layout).length&&f.prepend(b("
").addClass("noty_cont "+a.options.layout)),f=b("ul.noty_cont."+a.options.layout);else if(b.noty.available){var h=b.noty.queue.shift();if("object"===b.type(h))b.noty.available=!1,a.options=h.options;else return b.noty.available=!0,a.options.id}else return a.options.id; a.container=f;a.bar=b('').attr("id",a.options.id).addClass(a.options.theme+" "+a.options.layout+" "+a.options.type);c=a.bar;c.append(a.options.template).find(".noty_text").html(a.options.text);c.data("noty_options",a.options);a.options.closeButton?c.addClass("noty_closable").find(".noty_close").show():c.find(".noty_close").remove();c.find(".noty_close").bind("click",function(){c.trigger("noty.close")});a.options.buttons&&(a.options.closeOnSelfClick=a.options.closeOnSelfOver= !1);a.options.closeOnSelfClick&&c.bind("click",function(){c.trigger("noty.close")}).css("cursor","pointer");a.options.closeOnSelfOver&&c.bind("mouseover",function(){c.trigger("noty.close")}).css("cursor","pointer");a.options.buttons&&($buttons=b("").addClass("noty_buttons"),c.find(".noty_message").append($buttons),b.each(a.options.buttons,function(a,d){bclass=d.type?d.type:"gray";$button=b("").addClass(bclass).html(d.text).appendTo(c.find(".noty_buttons")).bind("click",function(){b.isFunction(d.click)&& d.click.call($button,c)})}));return a.show(d)};a.show=function(d){a.options.modal&&b("").addClass("noty_modal").addClass(a.options.theme).prependTo(b("body")).fadeIn("fast");c.close=function(){return this.trigger("noty.close")};d?a.container.prepend(b("").append(c)):a.container.prepend(c);("noty_layout_topCenter"==a.options.layout||"noty_layout_center"==a.options.layout)&&b.noty.reCenter(c);c.bind("noty.setText",function(a,d){c.find(".noty_text").html(d);b.noty.reCenter(c)});c.bind("noty.getId", function(){return c.data("noty_options").id});c.one("noty.close",function(){c.data("noty_options").modal&&b(".noty_modal").fadeOut("fast",function(){b(this).remove()});c.clearQueue().stop().animate(c.data("noty_options").animateClose,c.data("noty_options").speed,c.data("noty_options").easing,c.data("noty_options").onClose).promise().done(function(){-1',cssPrefix:"noty_",custom:{container:null}};b.fn.noty=function(d){return this.each(function(){new b.noty(d,b(this))})}})(jQuery);function noty(b){return jQuery.noty(b)};
// Hover effect for the header menu
$("#categories > ul > li").not("#menu_home").hover( function() { if ($(this).find("div.s_submenu").length) { var offset = $(this).offset(); var position = $(this).find("div.s_submenu").width() + offset.left; var window_width = $(window).width(); if (position > window_width) { $(this).find("div.s_submenu").css({ 'left' : 'auto', 'right' : 0 }) } } $(this).find("a:first").stop().animate({ color: '#ffffff', backgroundColor: '#' + $sReg.get('/tb/schemer_config/colors/secondary') },300 ); } , function() { $(this).find("a:first").stop().animate({ color: '#' + $sReg.get('/tb/schemer_config/colors/secondary'), backgroundColor: '#ffffff' },300 ); }
);
$('div.s_grid_view > div.s_item').each(function() { $(this).hover( function() { var hh = 0; $(this).find(".s_item_info > :hidden").addClass('to_hide'); var h1 = $(this).find(".s_item_info").height(); $(this).find(".s_item_info > .to_hide").show(); var h2 = $(this).find(".s_item_info").height(); var h3 = h2 - h1; var mb = '-' + h3 + 'px'; $(this).css('margin-bottom', mb); }, function() { $(this).find(".s_item_info > .to_hide").hide(); $(this).find(".s_item_info > :hidden").removeClass('to_hide'); $(this).css('margin-bottom', ''); } )
});
/*var onMouseOutOpacity = 1;
$('div.s_listing > div.s_item').css('opacity', onMouseOutOpacity)
.hover ( function () { $(this).prevAll().stop().fadeTo('slow', 0.60); $(this).nextAll().stop().fadeTo('slow', 0.60); }, function () { $(this).prevAll().stop().fadeTo('slow', onMouseOutOpacity); $(this).nextAll().stop().fadeTo('slow', onMouseOutOpacity); }
);*/
// Hover effect for the cart
$("#cart_menu").hover( function() { $(this).find(".s_grand_total").stop().animate({ color: '#ffffff', backgroundColor: '#' + $sReg.get('/tb/schemer_config/colors/main') },300); } , function() { $(this).find(".s_grand_total").stop().animate({ color: '#' + $sReg.get('/tb/schemer_config/colors/main'), backgroundColor: '#ffffff' },300); }
);
function addToCompare(product_id) { $.ajax({ url: 'index.php?route=tb/compareCallback', type: 'post', data: 'product_id=' + product_id, dataType: 'json', success: function(json) { if (json['success']) { productNotice(json['title'], json['thumb'], json['success'], 'success'); $('#compare_total').html(json['total']); } } });
}
if ($.browser.msie && parseInt($.browser.version, 10) < 9) { if ($("body").hasClass("s_single_col")) { $("#content .s_grid_view.size_1 .s_item:nth-child(4n)").after(''); $("#content .s_grid_view.size_2 .s_item:nth-child(6n)").after(''); $("#content .s_subcategory:nth-child(8n)").after(''); } else { $("#content .s_grid_view.size_1 .s_item:nth-child(3n)").after(''); $("#content .s_grid_view.size_2 .s_item:nth-child(4n)").after(''); $("#content .s_subcategory:nth-child(6n)").after(''); }
}
// Animation for the languages and currency dropdown
$('.s_switcher').hover(function() { $(this).find('.s_options').stop(true, true).slideDown('fast');
},function() { $(this).find('.s_options').stop(true, true).slideUp('fast');
});
$(".s_server_msg").live("click", function() { $(this).fadeOut(200, function(){ $(this).remove(); });
});
var search_visibility = 0;
// Animation for the search button
$("#show_search").bind("click", function(){ if (search_visibility == 0) { $("#search_bar").fadeIn(); search_visibility = 1; } else { $("#search_bar").fadeOut(); search_visibility = 0; }
});
/* Search */
function moduleSearch() { var filter_name = $('#filter_keyword').val(); if (filter_name) { url = 'index.php?route=product/search&search=' + encodeURIComponent(filter_name); location = url; }
}
$('#search_button').bind('click', function() { moduleSearch();
});
$('#filter_keyword').keydown(function(e) { if (e.keyCode == 13) { moduleSearch(); }
});
function addToCart(product_id) { $.ajax({ url: 'index.php?route=tb/cartCallback', type: 'post', data: 'product_id=' + product_id, success: function(data) { try { var json = $.parseJSON(data); } catch(e) { var json = 'json_parse_error'; } if (json['redirect']) { location = json['redirect']; } else { if (json['error'] && json['error']['warning']) { productNotice(json['title'], json['thumb'], json['error']['warning'], 'failure'); } if (json['success'] || json == 'json_parse_error') { productNotice(json['title'], json['thumb'], json['success'], 'success', 'center', product_id); } } } });
}
function removeCart(key) { $.ajax({ url: 'index.php?route=tb/cartCallback', type: 'post', data: 'removeKey=' + key, dataType: 'json', success: function(json) { if (json['html']) { if($('input[type="hidden"][name="product_id"][value="' + key + '"]').size()) { $('#add_to_cart').html('Купить'); } if($('.s_item.product_' + key + ' .s_button_1.s_main_color_bgr.orange').size()) { $('.s_item.product_' + key + ' .s_button_1.s_main_color_bgr.orange').html('Купить'); } productNotice(json['title'], json['thumb'], json['success'], 'success'); $('#cart_menu span.s_grand_total').html(json['total_sum']); $('#cart_menu div.s_cart_holder').html(json['html']); } } });
}
function removeVoucher(key) { $.ajax({ url: 'index.php?route=tb/cartCallback', type: 'post', data: 'removeVoucher=' + key, dataType: 'json', success: function(json) { if (json['html']) { simpleNotice(json['title'], json['success'], 'success'); $('#cart_menu span.s_grand_total').html(json['total_sum']); $('#cart_menu div.s_cart_holder').html(json['html']); } } });
}
function addToWishList(product_id) { $.ajax({ url: 'index.php?route=tb/wishlistCallback', type: 'post', data: 'product_id=' + product_id, dataType: 'json', success: function(json) { if (json['success']) { wishListNotice(json['title'], json['thumb'], json['success'], 'success'); $('#wishlist_total').html(json['total']); } if (json['failure']) { wishListNotice(json['title'], json['thumb'], json['failure'], 'failure'); $('#wishlist_total').html(json['total']); } } });
}
function productNotice(title, thumb, text, type, layout, product_id) { if (type == 'failure') { var buttons_config = [ { type: 's_main_color_bgr', text: $sReg.get('/lang/text_continue'), click: function() { $.noty.closeAll(); } } ]; } else { var buttons_config = [{ type: 's_main_color_bgr', text: $sReg.get('/lang/text_continue_shopping'), click: function() { $.noty.closeAll(); } },{ type: 's_secondary_color_bgr', text: $sReg.get('/lang/text_shopping_cart'), click: function() { window.location = $sReg.get('/tb/shopping_cart_url'); } } ]; } complexNotice(title, thumb, text, type, buttons_config, layout, product_id)
}
function wishListNotice(title, thumb, text, type) { if (type == 'failure') { var buttons_config = [ { type: 's_main_color_bgr', text: $sReg.get('/lang/text_continue'), click: function() { $.noty.closeAll(); } } ]; } else { var buttons_config = [ { type: 's_main_color_bgr', text: $sReg.get('/lang/text_continue'), click: function() { $.noty.closeAll(); } }, { type: 's_secondary_color_bgr', text: $sReg.get('/lang/text_wishlist'), click: function() { window.location = $sReg.get('/tb/wishlist_url'); } } ]; } complexNotice(title, thumb, text, type, buttons_config)
}
function complexNotice(title, thumb, text, type, buttons_config, layout, product_id) { if(layout == 'center') { var tpl = ''; } else { var tpl = '' + title + '
\ \
\
' + text + '
\
'; } noty({ text: tpl, layout: layout || 'topRight', theme: 's_notify', closeOnSelfClick: false, closeButton: true, timeout: layout == 'center' ? false : 8000, modal: layout == 'center' ? true : false, animateOpen: {opacity: 'toggle'}, animateClose: {opacity: 'toggle'} }); if(layout == 'center') { $('#noty_cart_content').load('index.php?route=checkout/cart #content', function(){ $('#noty_cart_content .s_button_1').addClass('orange'); $('#noty_cart_content #shopping_cart').removeClass('s_main_col'); $('#noty_cart_content .s_button_1.s_ddd_bgr.left.orange').on('click', function() { $.noty.closeAll(); }); var in_cart_text = 'В корзине'; console.log(product_id); if ($('#noty_cart_content #shopping_cart input[name="quantity[' + product_id + ']"]').size()) { in_cart_text = '' + ($('#product_add_to_cart_form').length ? 'В корзине ' : '= ') + $('#noty_cart_content #shopping_cart input[name="quantity[' + product_id + ']"]').val() + ' шт.'; } $('.s_item.product_' + product_id + ' .s_button_1.s_main_color_bgr.orange').html(in_cart_text); $('#add_to_cart').html(in_cart_text); $('#add_to_cart_once').html(in_cart_text); $('#noty_cart_content #shopping_cart p.s_total.s_secondary_color.last strong').remove(); $('#cart_menu .s_grand_total').html($('#noty_cart_content #shopping_cart p.s_total.s_secondary_color.last').remove('strong').html()); }); $('body, html').animate({ scrollTop: 0 }, 800); }
}
function simpleNotice(title, text, type) { var tpl = '' + title + '
\ ' + text + '
'; noty({ text: tpl, layout: 'topRight', theme: 's_notify', closeOnSelfClick: false, closeButton: true, timeout: 8000, animateOpen: {opacity: 'toggle'}, animateClose: {opacity: 'toggle'} });
}
function getUrlParam(name) { var name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); var regexS = "[\\?&]"+name+"=([^]*)"; var regex = new RegExp(regexS); var results = regex.exec(window.location.href); if (results == null) { return ""; } else { return results[1]; }
}
function empty (mixed_var) { var key; var undefined; if (mixed_var === "" || mixed_var === 0 || mixed_var === "0" || mixed_var === null || mixed_var === false || mixed_var === undefined ){ return true; } if (typeof mixed_var == 'object') { for (key in mixed_var) { return false; } return true; } return false;
}
$("#filter_keyword").inputHints();
$(document).ready(function() { if ($(window).width() > 600) { $(window).scroll(function () { if ($(this).scrollTop() > 100) { $('#to_top').fadeIn(); } else { $('#to_top').fadeOut(); } }); if ($(window).scrollTop() > 100) { $('#to_top').show(); } $('#to_top').click(function () { $('body, html').animate({ scrollTop: 0 }, 800); return false; }); } if ($("#main_navigation #cart_menu").is("div")) { function categories_resize() { $("#categories").width('auto'); var w_menu = $("#main_navigation .s_col_12").width(); var w_cats = $("#categories").width(); var w_cart = $("#main_navigation #cart_menu").width(); var w_empty = w_menu - w_cats - 10; if (w_empty < w_cart) { $("#categories").width(w_menu - w_cart - 30) } } categories_resize(); var previousOrientation = 0; var checkOrientation = function(){ if(window.orientation !== previousOrientation){ previousOrientation = window.orientation; } }; if (!$.browser.msie || parseInt($.browser.version, 10) > 8) { $(window).resize(categories_resize); $(window).bind('orientationchange', categories_resize); } } $(document).on('click', '#noty_cart_content .s_submit.clearfix .s_button_1.s_ddd_bgr.left', function(){ $('.noty_close').trigger('click'); return false; }); /*$shippning = $('input[name="shipping_method"]:first').parent().parent(); $shippning.parent().parent().parent().prev().on('click', function() { $(this).next().find('tr').toggle(); }); $shippning_not_hide = $('input[name="shipping_method"]:checked').parent().parent(); $shippning.parent().find('tr').hide(); $shippning_not_hide.show(); $payment = $('input[name="payment_method"]:first').parent().parent(); $payment.parent().parent().parent().prev().on('click', function() { $(this).next().find('tr').toggle(); }); $payment_not_hide = $('input[name="payment_method"]:checked').parent().parent(); $payment.parent().find('tr').hide(); $payment_not_hide.show();*/
}); $('select[name=\'category_id\']').bind('change', function() { if (this.value == '0') { $('input[name=\'sub_category\']').attr('disabled', 'disabled'); $('input[name=\'sub_category\']').removeAttr('checked'); } else { $('input[name=\'sub_category\']').removeAttr('disabled'); } }).trigger('change'); $('#content input[name=\'search\']').keydown(function(e) { if (e.keyCode == 13) { $('#adv_search_box a.search_button').trigger('click'); } }); $('#adv_search_box a.search_button').bind('click', function() { url = 'index.php?route=product/search'; var filter_name = $('#adv_search_box input.filter_keyword').attr('value'); if (filter_name) { url += '&search=' + encodeURIComponent(filter_name); } var filter_category_id = $('#filter_category_id').attr('value'); if (filter_category_id > 0) { url += '&category_id=' + encodeURIComponent(filter_category_id); } var filter_sub_category = $('#filter_sub_category:checked').attr('value'); if (filter_sub_category) { url += '&sub_category=true'; } var filter_description = $('#filter_description:checked').attr('value'); if (filter_description) { url += '&description=true'; } location = url; });