var ASSEMBLY_API_BASE = 'https://src.showbase.app';function getParam(name) { var url = window.location.href; name = name.replace(/[\[\]]/g, '\\$&'); var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'), results = regex.exec(url); if (!results) return null; if (!results[2]) return ''; return decodeURIComponent(results[2].replace(/\+/g, ' ')); } function insertScript({ hostname, pathname, isDebugMode }) { // var script = ` // `; // document.head.insertAdjacentHTML('beforeend', script); var script = document.createElement('script'); script.src = `${ASSEMBLY_API_BASE}/script/${encodeURIComponent( hostname, )}/${encodeURIComponent(pathname)}?showbase_debug=${isDebugMode}`; script.defer = true; document.head.appendChild(script); } window.onload = async function () { try { var href = location.href; const url = new URL(href); var isDebugMode = getParam('showbase_debug'); insertScript({ hostname: url.hostname, pathname: url.pathname, isDebugMode, }); } catch (error) { console.error(error); } };