top of page
bottom of page
if (typeof is_hours_script_loaded === 'undefined') {
var is_hours_script_loaded = true;
function getBusinessHoursDataMylsScript(scriptElement) {
const hours_script = { BASE_URL: "https://api.myls.ch/api" };
const script_url = scriptElement.getAttribute("src");
const urlObj = new URL(script_url);
const params = new URLSearchParams(urlObj.search);
const entityId = params.get('entity_id');
const locale = params.get('locale');
const text_color = params.get('text_color');
const mode = params.get('mode');
const day_name = params.get('day_name') || 'full';
if (entityId && locale) {
fetch(`${hours_script.BASE_URL}/script/get-business-hours`, {
method: 'POST',
headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' },
body: JSON.stringify({ entity_id: entityId, locale, text_color, mode,day_name })
}).then(res => res.text()).then(data => {
const container = document.createElement('div');
container.innerHTML = data;
scriptElement.parentElement.appendChild(container);
}).catch(err => {
console.log(err, "this is error");
});
}
}
setTimeout(function () {
document.querySelectorAll('script[id="business-hours-script"]').forEach(scriptElement => {
getBusinessHoursDataMylsScript(scriptElement);
});
}, 300);
}