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