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