');
txt = txt[0];
return (txt);
};
*/
document.performAJAX = true;
function initSv_spinner ()
{
$('.digit').each(function()
{
$('.more, .less', this).unbind();
$(this).sv_spinner(
{
count: $(this).children('input').val(), // Какое число будет при загрузке
});
});
document.performAJAX = true;
};
$(document).ready(function()
{
BX.addCustomEvent('onAjaxSuccess', initSv_spinner);
setTimeout(function()
{
$.ajax(
{
type: "GET",
url: '/',
dataType: "html",
success: function(out)
{
$('.h-cart').load('/ .h-cart span');
$('.v-card p').on('mouseenter', '.cart', function()
{
$('.modal-small-basket-container').show();
});
$('.v-card p').one('mouseenter', '.cart', function()
{
$(".modal-small-basket-item-container").mCustomScrollbar(
{
set_width: false, //optional element width: boolean, pixels, percentage
set_height: false, //optional element height: boolean, pixels, percentage
horizontalScroll: false, //scroll horizontally: boolean
scrollInertia: 950, //scrolling inertia: integer (milliseconds)
mouseWheel: true, //mousewheel support: boolean
mouseWheelPixels: "auto", //mousewheel pixels amount: integer, "auto"
autoDraggerLength: true, //auto-adjust scrollbar dragger length: boolean
autoHideScrollbar: false, //auto-hide scrollbar when idle
scrollButtons: //scroll buttons
{
enable: false, //scroll buttons support: boolean
scrollType: "continuous", //scroll buttons scrolling type: "continuous", "pixels"
scrollSpeed: "auto", //scroll buttons continuous scrolling speed: integer, "auto"
scrollAmount: 40 //scroll buttons pixels scroll amount: integer (pixels)
},
advanced:
{
updateOnBrowserResize: true, //update scrollbars on browser resize (for layouts based on percentages): boolean
updateOnContentResize: false, //auto-update scrollbars on content resize (for dynamic content): boolean
autoExpandHorizontalScroll: false, //auto-expand width for horizontal scrolling: boolean
autoScrollOnFocus: true, //auto-scroll on focused elements: boolean
normalizeMouseWheelDelta: false //normalize mouse-wheel delta (-1/1)
},
contentTouchScroll: true, //scrolling by touch-swipe content: boolean
theme: "dark" //"light", "dark", "light-2", "dark-2", "light-thick", "dark-thick", "light-thin", "dark-thin"
});
});
$('.small-basket').on('mouseleave', function()
{
$('.modal-small-basket-container').hide();
});
$('.modal-small-basket-item .digit').each(function()
{
$('.more, .less', this).unbind();
$(this).sv_spinner({
count: $(this).children('input').val() // Какое число будет при загрузке
});
});
}
});
}, 100);
// Обновление без каких-либо действий
document.BasketActionRefresh = function ()
{
if ( document.performAJAX )
{
document.performAJAX = false;
clearTimeout(document.RegisterTimerID);
$('.action-basket-refresh').trigger('click');
}
};
document.BasketRefresh = function ()
{
if ( document.performAJAX )
{
document.performAJAX = false;
clearTimeout(document.RegisterTimerID);
$('#BasketRefresh').trigger('click');
}
};
// Добавлена задержка чтобы можно было успеть ввести 2х значеное число
DigitInputTimeOut = 0;
$('.digit input').on('keyup', function ()
{
var sVal = $(this).val();
if ( sVal != "" && !isNaN(sVal) && parseInt(sVal) > 0 )
{
clearTimeout(DigitInputTimeOut);
DigitInputTimeOut = setTimeout(function () { document.BasketRefresh(); }, 500);
}
});
$('.basket-table .more, .basket-table .less, #next1, .js-use-discount-card').on('click', document.BasketRefresh);
});