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