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