(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 = "300px"; 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 = ` produk
${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":"Macan Sadis","produk":"EDU MASTERY","foto":"https:\/\/ruangpikiredukasi.com\/uploads\/edu%20Mastery%20%282%29.png","text":"Macan Sadis<\/b> telah order program EDU MASTERY","timestamp":1761808556},{"nama":"zastri amri","produk":"EDU MASTERY","foto":"https:\/\/ruangpikiredukasi.com\/uploads\/edu%20Mastery%20%282%29.png","text":"zastri amri<\/b> telah order program EDU MASTERY","timestamp":1760922145},{"nama":"Ersada","produk":"EDU MASTERY","foto":"https:\/\/ruangpikiredukasi.com\/uploads\/edu%20Mastery%20%282%29.png","text":"Ersada<\/b> telah order program EDU MASTERY","timestamp":1759990743},{"nama":"dekajj","produk":"EDU MASTERY","foto":"https:\/\/ruangpikiredukasi.com\/uploads\/edu%20Mastery%20%282%29.png","text":"dekajj<\/b> telah order program EDU MASTERY","timestamp":1759988505},{"nama":"Kennan","produk":"EDU MASTERY","foto":"https:\/\/ruangpikiredukasi.com\/uploads\/edu%20Mastery%20%282%29.png","text":"Kennan<\/b> telah order program EDU MASTERY","timestamp":1759987670},{"nama":"Komeng","produk":"EDU MASTERY","foto":"https:\/\/ruangpikiredukasi.com\/uploads\/edu%20Mastery%20%282%29.png","text":"Komeng<\/b> telah order program EDU MASTERY","timestamp":1759897391}], 'bottom'); })();