Here, you can find the latest information about company updates, industry trends, LED product releases, and event coverage, providing you with comprehensive insights and references.
document.addEventListener("DOMContentLoaded", function() {
function updateWhatsAppLinks() {
var path = window.location.pathname;
var defaultText = "Hello Sostron, I am interested in quoting an LED display from your website (Web EN).";
var customText = defaultText;
if (path.startsWith('/es/')) {
customText = "Hola Sostron, me interesa cotizar una pantalla LED desde la web en español (Web ES).";
} else if (path.startsWith('/fr/')) {
customText = "Bonjour Sostron, je souhaite un devis pour un écran LED depuis le site français (Web FR).";
} else if (path.startsWith('/it/')) {
customText = "Buongiorno Sostron, vorrei un preventivo per un ledwall dal sito italiano (Web IT).";
} else if (path.startsWith('/pt/')) {
customText = "Olá Sostron, gostaria de um orçamento de painel LED pelo site em português (Web PT).";
}
var waLinks = document.querySelectorAll('a[href*="wa.me"], a[href*="api.whatsapp.com"]');
waLinks.forEach(function(link) {
var rawHref = link.href;
if (rawHref.includes("wa.me/")) {
var phonePart = rawHref.split("wa.me/")[1].split("?")[0];
var newHref = "https://wa.me/" + phonePart + "?text=" + encodeURIComponent(customText);
if (link.href !== newHref) link.href = newHref;
} else if (rawHref.includes("api.whatsapp.com/send")) {
var match = rawHref.match(/phone=([^&]+)/);
if (match) {
var phoneNum = match[1];
var newHref = "https://api.whatsapp.com/send?phone=" + phoneNum + "&text=" + encodeURIComponent(customText);
if (link.href !== newHref) link.href = newHref;
}
}
});
}
// 1. 页面加载完立即执行一次
updateWhatsAppLinks();
// 2. 开启全局监视:防止悬浮按钮是后续异步加载出来的
var observer = new MutationObserver(function(mutations) {
updateWhatsAppLinks();
});
observer.observe(document.body, { childList: true, subtree: true });
});