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