(function(){
window.tampilkanSocialProof = function(data, position = "bottom") {
let index = 0;
const box = document.createElement("div");
box.style.position = "fixed";
box.style[`${position}`] = "40px";
box.style.left = "20px";
box.style.background = "#fff";
box.style.border = "1px solid #ddd";
box.style.padding = "10px";
box.style.borderRadius = "8px";
box.style.boxShadow = "0 2px 8px rgba(0,0,0,0.2)";
box.style.fontFamily = "Arial, sans-serif";
box.style.fontSize = "14px";
box.style.zIndex = "9999";
box.style.display = "flex";
box.style.alignItems = "center";
box.style.maxWidth = "280px";
box.style.transition = "opacity 0.5s ease";
document.body.appendChild(box);
function tampilkanBerikutnya() {
if (index >= data.length) index = 0;
const item = data[index++];
const waktu = formatTimeAgo(item.timestamp);
box.innerHTML = `
${item.text}
${waktu}
`;
box.style.opacity = "1";
setTimeout(() => box.style.opacity = "0", 6000);
setTimeout(tampilkanBerikutnya, 8000);
}
function maskNama(nama) {
return nama.length > 3 ? nama.substring(0, 3) + '****' : nama;
}
function formatTimeAgo(timestamp) {
const now = Math.floor(Date.now() / 1000);
const diff = now - timestamp;
if (diff < 60) return "baru saja";
if (diff < 3600) return `${Math.floor(diff / 60)} menit lalu`;
if (diff < 86400) return `${Math.floor(diff / 3600)} jam lalu`;
return `${Math.floor(diff / 86400)} hari lalu`;
}
tampilkanBerikutnya();
};
window.tampilkanSocialProof([{"nama":"Mokhamad Fajar","produk":"NgitungCuan - Tools ngitung profit bersih shopee","foto":"https:\/\/client.larisinagency.com\/uploads\/1760085501_69dc00450e3e5945a096.jpg","text":"Mokhamad Fajar<\/b> telah order produk NgitungCuan - Tools ngitung profit bersih shopee<\/em>","timestamp":1764320139},{"nama":"Fuziq Anggara","produk":"NgitungCuan - Tools ngitung profit bersih shopee","foto":"https:\/\/client.larisinagency.com\/uploads\/1760085501_69dc00450e3e5945a096.jpg","text":"Fuziq Anggara<\/b> telah order produk NgitungCuan - Tools ngitung profit bersih shopee<\/em>","timestamp":1761973478},{"nama":"Fuziq Anggara","produk":"NgitungCuan - Tools ngitung profit bersih shopee","foto":"https:\/\/client.larisinagency.com\/uploads\/1760085501_69dc00450e3e5945a096.jpg","text":"Fuziq Anggara<\/b> telah order produk NgitungCuan - Tools ngitung profit bersih shopee<\/em>","timestamp":1761973419},{"nama":"Fuziq Anggara","produk":"NgitungCuan - Tools ngitung profit bersih shopee","foto":"https:\/\/client.larisinagency.com\/uploads\/1760085501_69dc00450e3e5945a096.jpg","text":"Fuziq Anggara<\/b> telah order produk NgitungCuan - Tools ngitung profit bersih shopee<\/em>","timestamp":1761923855},{"nama":"Fuziq Anggara","produk":"NgitungCuan - Tools ngitung profit bersih shopee","foto":"https:\/\/client.larisinagency.com\/uploads\/1760085501_69dc00450e3e5945a096.jpg","text":"Fuziq Anggara<\/b> telah order produk NgitungCuan - Tools ngitung profit bersih shopee<\/em>","timestamp":1761923718},{"nama":"CKL Looks","produk":"NgitungCuan - Tools ngitung profit bersih shopee","foto":"https:\/\/client.larisinagency.com\/uploads\/1760085501_69dc00450e3e5945a096.jpg","text":"CKL Looks<\/b> telah order produk NgitungCuan - Tools ngitung profit bersih shopee<\/em>","timestamp":1761544164},{"nama":"Ahmad jamaludin","produk":"NgitungCuan - Tools ngitung profit bersih shopee","foto":"https:\/\/client.larisinagency.com\/uploads\/1760085501_69dc00450e3e5945a096.jpg","text":"Ahmad jamaludin<\/b> telah order produk NgitungCuan - Tools ngitung profit bersih shopee<\/em>","timestamp":1760103614}], 'bottom');
})();