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