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