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