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