0.7-7.2-3.4-17.3-6.5-23.8c-3.1-6.8-8.9-14.7-14.3-19.7c-5.6-5.1-12.3-9.2-17.3-10.5c-4.5-1.2-11.6-1.7-15.9-1.1c-4.2,0.6-15.4,3.3-24.9,6.1c-9.5,2.7-34.2,9.2-54.7,14.4c-20.6,5.2-51.3,12.4-68.2,16.1c-16.9,3.6-43.7,8.8-59.5,11.5c-15.9,2.7-38.3,6.2-50,7.7c-11.6,1.6-34.9,3.9-51.8,5.1c-17.8,1.4-41.2,1.8-55.7,1.1c-13.7-0.7-36.6-2.6-50.9-4.2c-14.2-1.5-37.1-4.6-50.9-6.8c-13.7-2.2-41.8-7.4-62.4-11.6c-20.6-4.2-56-12.3-78.7-18s-49.9-13-60.5-16.2c-10.6-3.3-22.6-5.9-26.9-5.9C545.2,665.7,537.4,667.9,531.6,670.7L531.6,670.7z" style="fill:${settings.widget_innercolor}"/>`},{id: 2,name: "icon-2",svg: ``},{id: 3,name: "icon-3",svg: ``},{id: 4,name: "icon-4",svg: ``},{id: 5,name: "icon-5",svg: ``},{id: 6,name: "icon-6",svg: ``},{id: 7,name: "icon-7",svg: ``},{id: 8,name: "icon-8",svg: ``},{id: 9,name: "icon-9",svg: ``},{id: 10,name: "icon-10",svg: ``}]; const currentIcon = widgetSVGs.find(icon => icon.name === settings.svg) || widgetSVGs[0]; // Create loader loader = document.createElement('a'); loader.href = "javascript:void(0)"; loader.className = `aa-cc-fix-icon-body-loader ${position || ''} ${isMobile ? settings.mobile_position : ''}`; loader.id = "aa-cc-fix-icon-body-loader"; loader.setAttribute("aria-label", "Web Accessibility Initiative"); loader.innerHTML = currentIcon.svg; loader.addEventListener('click', (e) => { e.stopPropagation(); e.preventDefault(); }); document.body.appendChild(loader); // Create styles _ada_style = document.createElement('style'); _ada_style.id = "aa-cc-fix-icon-styles"; _ada_style.textContent = ` @media screen and (min-width:769px) { .aa-cc-top-left { top: 6px; left: 0px; } .aa-cc-top-left:hover { top: 16px; left: 0px;} .aa-cc-top-right { top: 6px; right: 0; } .aa-cc-top-right:hover { top: 16px; } .aa-cc-center-right { top: 45.5%; right: 0; left: auto; } .aa-cc-center-right:hover { top: 44.5%; } .aa-cc-center-left { left: 0; top: 44.5%; } .aa-cc-bottom-left { left: 0; bottom: ${(parseInt(settings.bottom_padding, 10) || 0) + 15}px; } .aa-cc-bottom-right { right: 0; bottom: ${(parseInt(settings.bottom_padding, 10) || 0) + 15}px; } .aa-cc-bottom-right:hover { bottom: ${(parseInt(settings.bottom_padding, 10) || 0) + 15}px; } } @media screen and (max-width:768px) { .aa-mm-cc-top-left { top: 6px; left: 0px;} .aa-mm-cc-top-right { top: 6px; right: 0; left: auto; } .aa-mm-cc-center-left { left: 0; top: 45.5%; } .aa-mm-cc-center-right { top: 45.5%; right: 0; left: auto; } .aa-mm-cc-bottom-left { left: 0; bottom: ${(parseInt(settings.bottom_padding, 10) || 0) + 15}px; } .aa-mm-cc-bottom-right { right: 0; left: auto; bottom: ${(parseInt(settings.bottom_padding, 10) || 0) + 15}px; } } #aa-cc-fix-icon-body-loader { display: inline-block; transition: all 0.5s; height: 65px; position: fixed; padding: 8px; z-index: 9999999; } #aa-cc-fix-icon-body-loader .aa-cc-iconimg { width: ${settings.size || 50}px; height: ${settings.size || 50}px; text-align: center; display: flex; align-items: center; justify-content: center; border-radius: 5px; } #aa-cc-fix-icon-body-loader svg, #aa-cc-fix-icon-body-loader img { width: inherit; height: inherit; } @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } .aa-cc-visually-hidden { position: absolute !important; height: 1px; width: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); white-space: nowrap; } #aa-cc-fix-icon-body-loader .aa-cc-iconimg::before { content: ""; position: absolute; width: calc(${settings.size || 50}px + 10px); height: calc(${settings.size || 50}px + 10px); border-radius: 50%; border: 4px solid transparent; border-top-color: ${settings.widget_outercolor || '#000'}; border-bottom-color: ${settings.widget_outercolor || '#000'}; animation: spin 1s linear infinite; z-index: 9999999; } `; if(settings.hover_text == 0){ let tooltipBefore = ''; let tooltipAfter = ''; let _ada_hovertext_styles = { right: { before: ` left: -11px; top: 50%; border-left: 6px solid ${settings.widget_outercolor}; `, after: ` transform: translateY(-50%) translateX(-100%); left: -11px; top: 50%; ` }, left: { before: ` right: -11px; top: 50%; border-right: 6px solid ${settings.widget_outercolor}; `, after: ` transform: translateY(-50%) translateX(100%); right: -10px; top: 50%; ` } }; // Map positions to style configurations let _adahovertext_positionStyles = { 'aa-cc-center-right': _ada_hovertext_styles.right, 'aa-cc-bottom-right': _ada_hovertext_styles.right, 'aa-cc-top-right': _ada_hovertext_styles.right, 'aa-cc-center-left': _ada_hovertext_styles.left, 'aa-cc-bottom-left': _ada_hovertext_styles.left, 'aa-cc-top-left': _ada_hovertext_styles.left }; // Assign styles based on position, default to left let _adahovertext_selectedStyle = _adahovertext_positionStyles[position] || _ada_hovertext_styles.left; tooltipBefore = _adahovertext_selectedStyle.before; tooltipAfter = _adahovertext_selectedStyle.after; _ada_style.textContent += ` @media (min-width: 768px) { #aa-cc-fix-icon-body-loader::before { content: ""; position: absolute; top: 50%; transform: translateY(-50%); width: 0; height: 0; border-top: 6px solid transparent; border-bottom: 6px solid transparent; opacity: 0; ${tooltipBefore} } #aa-cc-fix-icon-body-loader::after { content: "Accessibility Assistant"; position: absolute; top: 50%; color: ${settings.widget_innercolor}; background-color: ${settings.widget_outercolor}; padding: 6px 10px; border-radius: 6px; font-size: 13px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity 0.25s ease, transform 0.25s ease; width: fit-content; ${tooltipAfter} } #aa-cc-fix-icon-body-loader:hover::after, #aa-cc-fix-icon-body-loader:hover::before{ opacity:1; } } @media (max-width: 767px) { #aa-cc-fix-icon-body-loader::before, #aa-cc-fix-icon-body-loader::after { display: none !important; } } `; }; document.head.appendChild(_ada_style); } // Load the script // Fetch scriptUrl from API let scriptUrl = null; try { const response = await fetch('https://adawix.accessibilityassistant.com/v1/wix/script', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ siteId }), }); const result = await response.json(); if (response.status === 200 && result.scriptUrl) { scriptUrl = result.scriptUrl + '?v=' + Date.now(); } else if (response.status === 404) { console.error(result.message, result.siteId || ''); return; // Exit if shop not found or plan required } else { console.error("Unexpected response:", result); return; } } catch (e) { console.error("Failed to fetch scriptUrl:", e); return; } // Load the script if scriptUrl is valid if (scriptUrl && !document.querySelector(`script[src="${scriptUrl}"]`)) { const script = document.createElement('script'); script.src = scriptUrl; script.type = "text/javascript"; script.async = true; script.onload = () => { console.log("Script loaded:", scriptUrl); if (loader && !settings.show_loader) loader.remove(); if (_ada_style) _ada_style.remove(); }; script.onerror = () => { console.error("Failed to load script:", scriptUrl); if (loader) loader.remove(); if (_ada_style) _ada_style.remove(); }; document.head.appendChild(script); } else if (loader && !settings.show_loader) { loader.remove(); if (_ada_style) _ada_style.remove(); } } catch (err) { console.error("Accessibility Assistant Wix Extension ERROR:", err); if (loader) loader.remove(); if (_ada_style) _ada_style.remove(); } })();