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