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