1// var widgetId = document.getElementById("propInfo"); 2// var staahPropertyId = widgetId && widgetId.getAttribute("propertyid"); 3// var staahIframeOption = widgetId && widgetId.getAttribute("redirect"); 4// var staahLocationOption = widgetId && widgetId.getAttribute("location"); 5// var staahGroupId = widgetId && widgetId.getAttribute("groupid"); 6// var staahTokenId = widgetId && widgetId.getAttribute("token"); 7// var staahSrc = widgetId && widgetId.getAttribute("src"); 8// var staahDefaultProperty = widgetId && widgetId.getAttribute("dpid"); 9// var staahFixPromoCode = widgetId && widgetId.getAttribute("fixp"); 10// var staahCurrencyDropdown = widgetId && widgetId.getAttribute("currency"); 11// var staahNationalityDropdown = widgetId && widgetId.getAttribute("nationality"); 12// var staahWidgetInIframeKey = widgetId && widgetId.getAttribute("redirect-be"); 13// var domain = (new URL(staahSrc)); 14// var staahDomain = domain?.hostname; 15 16// function loadScript() { 17// var script = document.createElement("script"); 18// script.type = "text/javascript"; 19// script.src = `https://${staahDomain || `www.mybookingsite.io`}/widget/static/js/main.5791b615.js` 20// document.head.append(script); 21 22// var link2 = document.createElement('link') 23// link2.href = `https://${staahDomain || `www.mybookingsite.io`}/widget/static/css/main.ac6d4874.css` 24// link2.type = "text/css"; 25// link2.rel = "stylesheet"; 26// document.head.appendChild(link2); 27// } 28 29// if (document.readyState === 'loading') { 30// window.addEventListener('DOMContentLoaded', loadScript, false); 31// } else { 32// loadScript(); 33// } 34 35 36var widgetElement = document.getElementById('propInfo'); 37 38// Extract attributes 39var staahPropertyId = widgetElement.getAttribute('propertyid'); 40var scriptId = staahPropertyId; 41var staahGroupId = widgetElement.getAttribute('groupid'); 42var staahLocationOption = widgetElement.getAttribute('location'); 43var staahTokenId = widgetElement.getAttribute('token'); 44var staahSrc = widgetElement.getAttribute('src'); 45var staahDefaultProperty = widgetElement.getAttribute('dpid'); 46var staahFixPromoCode = widgetElement.getAttribute('fixp'); 47var staahCurrencyDropdown = widgetElement.getAttribute('currency'); 48var staahNationalityDropdown = widgetElement.getAttribute('nationality'); 49var staahWidgetInIframeKey = widgetElement.getAttribute('redirect-be'); 50 51 52function initializeWidget() { 53 // If groupId exists, load default group widget 54 if (staahGroupId && staahGroupId.length > 0) { 55 var staahDomain = staahSrc ? new URL(staahSrc).hostname : 'www.mybookingsite.io'; 56 57 function loadGroupWidgetScripts() { 58 var script = document.createElement('script'); 59 script.type = 'text/javascript'; 60 script.src = `https://${staahDomain}/widget/static/js/main.a0b002b6.js`; 61 document.head.appendChild(script); 62 63 var link = document.createElement('link'); 64 link.href = `https://${staahDomain}/widget/static/css/main.de05fe61.css`; 65 link.rel = 'stylesheet'; 66 link.type = 'text/css'; 67 document.head.appendChild(link); 68 }; 69 70 // Load scripts based on DOM readiness 71 if (document.readyState === 'loading') { 72 window.addEventListener('DOMContentLoaded', loadGroupWidgetScripts); 73 } else { 74 loadGroupWidgetScripts(); 75 } 76 } 77 // Else load individual property widget 78 else if (staahPropertyId && scriptId) { 79 var widgetId = `quickbook-widget-${staahPropertyId}-${scriptId}`; 80 var newDiv = document.createElement('div'); 81 newDiv.id = widgetId; 82 newDiv.className = 'Configure-quickBook-Widget'; 83 84 85 const checkDivLoaded = setInterval(() => { 86 var existingDiv = document.getElementById('quickbook-widget'); 87 var existingDivSU = document.getElementById('quikbook-widget'); 88 89 if (existingDiv || existingDivSU) { 90 if (existingDiv) { 91 existingDiv.replaceWith(newDiv); 92 } else if (existingDivSU) { 93 existingDivSU.replaceWith(newDiv); 94 } 95 96 // Build script URL
97 let scriptBaseURL = `https://settings.swiftbook.io/displaywidget/preview/booking-service.min.js?propertyId=${staahPropertyId}&scriptId=${scriptId}`; 98 if (staahWidgetInIframeKey) { 99 scriptBaseURL += `&redirect-be=${encodeURIComponent(staahWidgetInIframeKey)}`; 100 } 101 102 // Create and append script 103 var newScript = document.createElement('script'); 104 newScript.type = 'text/javascript'; 105 newScript.src = scriptBaseURL; 106 newScript.id = 'propInfo'; 107 108 if (widgetElement) { 109 widgetElement.replaceWith(newScript); 110 } 111 112 clearInterval(checkDivLoaded); 113 } 114 }, 100); 115 } 116} 117 118// Run initialization on DOM ready 119if (document.readyState === 'loading') { 120 window.addEventListener('DOMContentLoaded', initializeWidget); 121} else { 122 initializeWidget(); 123}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.