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