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