loadCms_102b9d3b32e84503b9e126bc352af15b(); function loadCms_102b9d3b32e84503b9e126bc352af15b() { let xhr_param_102b9d3b32e84503b9e126bc352af15b = "mode=view_cms_ajax&cms=text&vk=102b9d3b32e84503b9e126bc352af15b&tk=ab9d7fe161074e0c93ef357ff47c1296"; let url_param_102b9d3b32e84503b9e126bc352af15b = new URLSearchParams(window.location.search); let tk_102b9d3b32e84503b9e126bc352af15b = url_param_102b9d3b32e84503b9e126bc352af15b.get("tk"); if (null !== tk_102b9d3b32e84503b9e126bc352af15b && "" !== tk_102b9d3b32e84503b9e126bc352af15b) { xhr_param_102b9d3b32e84503b9e126bc352af15b += "&tk="+tk_102b9d3b32e84503b9e126bc352af15b; } let xhr_102b9d3b32e84503b9e126bc352af15b = new XMLHttpRequest(); xhr_102b9d3b32e84503b9e126bc352af15b.open("POST", "https://cms.a-pollo.jp/user/output/"); xhr_102b9d3b32e84503b9e126bc352af15b.setRequestHeader("content-type", "application/x-www-form-urlencoded;charset=UTF-8"); xhr_102b9d3b32e84503b9e126bc352af15b.send(xhr_param_102b9d3b32e84503b9e126bc352af15b); xhr_102b9d3b32e84503b9e126bc352af15b.onreadystatechange = function() { if(xhr_102b9d3b32e84503b9e126bc352af15b.readyState === 4) { if(xhr_102b9d3b32e84503b9e126bc352af15b.status === 200) { if (!xhr_102b9d3b32e84503b9e126bc352af15b.responseText) { alert("誤ったURLが設定されている可能性があります。ご確認ください。"); return; } let data = JSON.parse(xhr_102b9d3b32e84503b9e126bc352af15b.responseText); let elm = document.getElementById('cms-text-102b9d3b32e84503b9e126bc352af15b-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_102b9d3b32e84503b9e126bc352af15b.readyState); } } } }