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