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