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