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