loadCms_a87fe9297cfc4936ac250c0c09653bfc(); function loadCms_a87fe9297cfc4936ac250c0c09653bfc() { let xhr_param_a87fe9297cfc4936ac250c0c09653bfc = "mode=view_cms_ajax&cms=custom&vk=a87fe9297cfc4936ac250c0c09653bfc&cstacsttrk=6df1bd030bdd4095b31d04c8ee8477a2"; let url_param_a87fe9297cfc4936ac250c0c09653bfc = new URLSearchParams(window.location.search); let slug_a87fe9297cfc4936ac250c0c09653bfc = url_param_a87fe9297cfc4936ac250c0c09653bfc.get("slug"); if (null !== slug_a87fe9297cfc4936ac250c0c09653bfc && "" !== slug_a87fe9297cfc4936ac250c0c09653bfc) { xhr_param_a87fe9297cfc4936ac250c0c09653bfc += "&slug="+slug_a87fe9297cfc4936ac250c0c09653bfc; } let cstck_a87fe9297cfc4936ac250c0c09653bfc = url_param_a87fe9297cfc4936ac250c0c09653bfc.get("cstck"); if (null !== cstck_a87fe9297cfc4936ac250c0c09653bfc && "" !== cstck_a87fe9297cfc4936ac250c0c09653bfc) { xhr_param_a87fe9297cfc4936ac250c0c09653bfc += "&cstck="+cstck_a87fe9297cfc4936ac250c0c09653bfc; } let cstp_a87fe9297cfc4936ac250c0c09653bfc = url_param_a87fe9297cfc4936ac250c0c09653bfc.get("cstp[a87fe9297cfc4936ac250c0c09653bfc]"); if (null !== cstp_a87fe9297cfc4936ac250c0c09653bfc && "" !== cstp_a87fe9297cfc4936ac250c0c09653bfc) { xhr_param_a87fe9297cfc4936ac250c0c09653bfc += "&cstp="+cstp_a87fe9297cfc4936ac250c0c09653bfc; } let xhr_a87fe9297cfc4936ac250c0c09653bfc = new XMLHttpRequest(); xhr_a87fe9297cfc4936ac250c0c09653bfc.open("POST", "https://cms.a-pollo.jp/user/output/"); xhr_a87fe9297cfc4936ac250c0c09653bfc.setRequestHeader("content-type", "application/x-www-form-urlencoded;charset=UTF-8"); xhr_a87fe9297cfc4936ac250c0c09653bfc.send(xhr_param_a87fe9297cfc4936ac250c0c09653bfc); xhr_a87fe9297cfc4936ac250c0c09653bfc.onreadystatechange = function() { if(xhr_a87fe9297cfc4936ac250c0c09653bfc.readyState === 4) { if(xhr_a87fe9297cfc4936ac250c0c09653bfc.status === 200) { if (!xhr_a87fe9297cfc4936ac250c0c09653bfc.responseText) { alert("誤ったURLが設定されている可能性があります。ご確認ください。"); return; } let data = JSON.parse(xhr_a87fe9297cfc4936ac250c0c09653bfc.responseText); let elm = document.getElementById('cms-custom-a87fe9297cfc4936ac250c0c09653bfc-area'); elm.innerHTML = data.html; Array.from(elm.querySelectorAll("script")).forEach(oldScript => { const newScript = document.createElement("script"); Array.from(oldScript.attributes) .forEach( attr => newScript.setAttribute(attr.name, attr.value) ); newScript.appendChild(document.createTextNode(oldScript.innerHTML)); oldScript.parentNode.replaceChild(newScript, oldScript); }); } else { console.log("status:"+xhr_a87fe9297cfc4936ac250c0c09653bfc.readyState); } } } } function onCmsCustomPageChange_a87fe9297cfc4936ac250c0c09653bfc(page) { const url = new URL(window.location.href); url.searchParams.set('cstp[a87fe9297cfc4936ac250c0c09653bfc]', page); window.history.pushState(null, '', url.toString()); loadCms_a87fe9297cfc4936ac250c0c09653bfc(); }