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