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