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