Software: Apache/2.4.68 (Linux) PHP/7.4.33. PHP/7.4.33 uname -a: Linux bjb2293782.nichost.ru 6.6.151-1.el8.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Aug 10 uid=12584(bjb2293782) gid=12584(bjb2293782) groups=12584(bjb2293782) Safe-mode: OFF (not secure) /home/bjb2293782/xn--80abaeoqbbrbgf8aea5a2a2z.xn--p1ai/docs/ drwxr-x--- | |
| Viewing file: Select action/file-type: cartItemCount = 0;
cartBtn = null;
function cartAnim()
{
var info = {t:0,stage:0};
info.timer = setInterval(
function(info)
{
var animTime = 200;
info.t+=20;
if (info.stage == 0)
{
var progress = info.t / animTime;
if (progress>1) progress = 1;
var scale = 1.0 + (0.01 - 1.0) * progress;
cartBtn.style.transform = "scale("+scale+")";
if (info.t>=animTime)
{
info.stage = 1;
if (cartItemCount > 0)
cartBtn.label.innerHTML = "<b>"+cartItemCount + " шт.</b>";
else
cartBtn.label.innerHTML = 'Корзина';
}
}
else
if (info.stage == 1)
{
var progress = (info.t - animTime) / animTime;
if (progress>1) progress = 1;
var scale=0.01 + (1.2 - 0.01) * progress;
cartBtn.style.transform = "scale("+scale+")";
if (info.t>=animTime*2)
{
info.stage = 2;
}
}
else
if (info.stage == 2)
{
var progress = (info.t - animTime*2) / animTime;
if (progress>1) progress = 1;
var scale=1.2 + (1.0 - 1.2) * progress;
cartBtn.style.transform = "scale("+scale+")";
if (info.t>=animTime*3)
{
clearTimeout(info.timer);
}
}
}, 20, info);
}
function updateCartBtnPosition()
{
if (!cartBtn) return;
cartBtn.style.left = window.innerWidth - 150;
cartBtn.style.top = 150;
}
___imgPreload = new Image();
___imgPreload.src="cart.png";
function createCartBtn(n)
{
if (cartBtn) return;
if (!n) n = 0;
cartBtn = document.createElement('BUTTON');
document.body.appendChild(cartBtn);
cartBtn.style.position = "fixed";
updateCartBtnPosition();
cartBtn.className = "dlgBtn";
var center = cartBtn.appendChild(document.createElement('CENTER'));
var img = center.appendChild(document.createElement('img'));
img.src='cart16x16.png';
img.width=16;
img.height=16;
center = cartBtn.appendChild(document.createElement('CENTER'));
cartBtn.style.width = 100;
cartBtn.style.height = 50;
cartBtn.label = center;
cartBtn.title="Перейти в корзину";
if (n==0)
center.innerHTML = "Корзина";
else
center.innerHTML = "<b>"+ n + " шт.</b>";
cartBtn.onclick = function()
{
location = "basket.php";
};
}
function buyAnim(elm)
{
createCartBtn();
if (elm)
{
var flyImg = new Image();
document.body.appendChild(flyImg);
flyImg.src = "cart.png";
flyImg.style.position="fixed";
flyImg.style.zIndex=100;
flyImg.from = elm.getBoundingClientRect();
flyImg.to = cartBtn.getBoundingClientRect();
flyImg.t = 0;
flyImg.style.left = flyImg.from.left;
flyImg.style.top = flyImg.from.top;
flyImg.style.width = flyImg.from.width;
flyImg.style.height = flyImg.from.height;
flyImg.timer = setInterval(
function(flyImg)
{
var flyTime = 500;
flyImg.t+=20;
var progress = flyImg.t / flyTime;
if (progress>1) progress=1;
flyImg.style.left = flyImg.from.left + (flyImg.to.left - flyImg.from.left)*progress;
flyImg.style.top = flyImg.from.top + (flyImg.to.top - flyImg.from.top) * progress;
flyImg.style.width = flyImg.from.width + (flyImg.to.width - flyImg.from.width) * progress;
flyImg.style.height = flyImg.from.height + (flyImg.to.height - flyImg.from.height) * progress;
flyImg.style.opacity = 1.0 - 0.3 * progress;
if (flyImg.t>=flyTime)
{
document.body.removeChild(flyImg);
clearInterval(flyImg.timer);
cartAnim();
}
},20, flyImg);
}
else
cartAnim();
}
function doBuy(elm, id, itemType)
{
//cartItemCount = 1;
//buyAnim(elm);
//return;
sendXHR("api.php","action=shop:buy&id="+id+"&itemType="+itemType,
function(response)
{
console.log(response);
cartItemCount = parseInt(response);
buyAnim(elm);
},
function(error)
{
errorBox("Не удалось добавить товар в корзину! "+error);
});
}
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.004 ]-- |