// Function to append Pagesense script function appendPagesenseScript() { var script = document.createElement('script'); script.src = "https://cdn.pagesense.io/js/yuniss/568532b820bf417db0a32c8d197a1969.js"; document.head.appendChild(script); } // Function to append Zoho SalesIQ script function appendZohoSalesIQScript() { var $zoho = $zoho || {}; $zoho.salesiq = $zoho.salesiq || { widgetcode: "siq75d9f86493faf640f98cb4b7e8a00790de9adb537b45e5f56c2d49f4bdc85c74", values: {}, ready: function() {} }; var script = document.createElement('script'); script.type = "text/javascript"; script.id = "zsiqscript"; script.defer = true; script.src = "https://salesiq.zohopublic.com/widget"; var firstScript = document.getElementsByTagName("script")[0]; firstScript.parentNode.insertBefore(script, firstScript); } //Whatsapp (function(global) { function initializeWhatsAppWidget({ phoneNumber, message = '', position = 'bottom-right', mobileBottomOffset, desktopBottomOffset, mobileBreakpoint = 768 }) { // Cache DOM queries and window dimensions const isMobile = () => window.innerWidth <= mobileBreakpoint; let windowWidth = window.innerWidth; let windowHeight = window.innerHeight; const ICON_SIZE = 50; // Icon width/height const EDGE_PADDING = 25; // Padding from window edges const whatsappIcon = document.createElement('a'); whatsappIcon.href = `https://wa.me/${phoneNumber}?text=${encodeURIComponent(message)}`; whatsappIcon.target = '_blank'; whatsappIcon.style.position = 'fixed'; whatsappIcon.style.width = `${ICON_SIZE}px`; whatsappIcon.style.height = `${ICON_SIZE}px`; whatsappIcon.style.backgroundColor = '#25D366'; whatsappIcon.style.borderRadius = '50%'; whatsappIcon.style.boxShadow = '0px 4px 8px rgba(0, 0, 0, 0.2)'; whatsappIcon.style.display = 'flex'; whatsappIcon.style.justifyContent = 'center'; whatsappIcon.style.alignItems = 'center'; whatsappIcon.style.textDecoration = 'none'; whatsappIcon.style.zIndex = '1000'; whatsappIcon.style.transform = 'translate3d(0, 0, 0)'; whatsappIcon.style.willChange = 'transform'; if (isMobile()) { whatsappIcon.style.cursor = 'move'; } const iconImage = document.createElement('img'); iconImage.src = 'https://upload.wikimedia.org/wikipedia/commons/6/6b/WhatsApp.svg'; iconImage.alt = 'WhatsApp'; iconImage.style.width = '60%'; iconImage.style.height = '60%'; iconImage.style.pointerEvents = 'none'; whatsappIcon.appendChild(iconImage); // Dragging state let isDragging = false; let startX, startY; let currentX = 0; let currentY = 0; // Initialize position if (isMobile()) { const savedPosition = localStorage.getItem('whatsappWidgetPosition'); if (savedPosition) { const { x, y } = JSON.parse(savedPosition); currentX = x; currentY = y; updateIconPosition(x, y); } else { setDefaultPosition(); } } else { setDefaultPosition(); } function updateIconPosition(x, y) { requestAnimationFrame(() => { whatsappIcon.style.transform = `translate3d(${x}px, ${y}px, 0)`; }); } function setDefaultPosition() { if (position === 'bottom-right') { currentX = windowWidth - ICON_SIZE - EDGE_PADDING; currentY = windowHeight - ICON_SIZE - EDGE_PADDING; } else if (position === 'bottom-left') { currentX = EDGE_PADDING; currentY = windowHeight - ICON_SIZE - EDGE_PADDING; } else if (position === 'top-right') { currentX = windowWidth - ICON_SIZE - EDGE_PADDING; currentY = EDGE_PADDING; } else if (position === 'top-left') { currentX = EDGE_PADDING; currentY = EDGE_PADDING; } updateIconPosition(currentX, currentY); } // Throttle drag updates let lastDragUpdate = 0; const DRAG_THROTTLE = 16; // ~60fps function handleDragStart(e) { if (!isMobile()) return; const touch = e.type === 'touchstart' ? e.touches[0] : e; startX = touch.clientX - currentX; startY = touch.clientY - currentY; isDragging = true; lastDragUpdate = Date.now(); whatsappIcon.style.transition = 'none'; } function handleDrag(e) { if (!isDragging || !isMobile()) return; e.preventDefault(); // Throttle drag updates const now = Date.now(); if (now - lastDragUpdate < DRAG_THROTTLE) return; lastDragUpdate = now; const touch = e.type === 'touchmove' ? e.touches[0] : e; let newX = touch.clientX - startX; let newY = touch.clientY - startY; // Constrain to viewport with padding newX = Math.min(Math.max(EDGE_PADDING, newX), windowWidth - ICON_SIZE - EDGE_PADDING); newY = Math.min(Math.max(EDGE_PADDING, newY), windowHeight - ICON_SIZE - EDGE_PADDING); currentX = newX; currentY = newY; updateIconPosition(newX, newY); } function handleDragEnd() { if (!isDragging || !isMobile()) return; isDragging = false; localStorage.setItem('whatsappWidgetPosition', JSON.stringify({ x: currentX, y: currentY })); whatsappIcon.style.transition = 'transform 0.3s ease'; } // Debounced resize handler let resizeTimeout; window.addEventListener('resize', () => { if (resizeTimeout) clearTimeout(resizeTimeout); resizeTimeout = setTimeout(() => { windowWidth = window.innerWidth; windowHeight = window.innerHeight; if (!isMobile()) { setDefaultPosition(); } else { // Ensure icon stays within bounds with padding currentX = Math.min(Math.max(EDGE_PADDING, currentX), windowWidth - ICON_SIZE - EDGE_PADDING); currentY = Math.min(Math.max(EDGE_PADDING, currentY), windowHeight - ICON_SIZE - EDGE_PADDING); updateIconPosition(currentX, currentY); } }, 100); }); // Add event listeners with passive option where possible if (isMobile()) { whatsappIcon.addEventListener('mousedown', handleDragStart, { passive: true }); document.addEventListener('mousemove', handleDrag, { passive: false }); document.addEventListener('mouseup', handleDragEnd, { passive: true }); whatsappIcon.addEventListener('touchstart', handleDragStart, { passive: true }); document.addEventListener('touchmove', handleDrag, { passive: false }); document.addEventListener('touchend', handleDragEnd, { passive: true }); } document.body.appendChild(whatsappIcon); } global.initializeWhatsAppWidget = initializeWhatsAppWidget; })(window); initializeWhatsAppWidget({ phoneNumber: '97147160700', message: 'Hello!', position: 'bottom-right', mobileBreakpoint: 768 }); (function(c,l,a,r,i,t,y){ c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)}; t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i; y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y); })(window, document, "clarity", "script", "obd9bxxqh9");