console.log("prueba");
var principalEl = document.querySelector(".principal"), htmlmenuMobile = ``, htmlfooterMobile = ``, htmlmenuDesk = ``, htmlfooterDesk = ``, iconosprecarga = ``;
function string2html(str) {
var htmlParse = new DOMParser().parseFromString(str, 'text/html'), newHtmlEl = htmlParse.body.firstChild;
return newHtmlEl;
}
function appexUrlAbsoluta(componente) {
var newComp = componente;
if (newComp.indexOf("/myconnect") > -1) {
newComp = newComp.replace(/\/myconnect/g, '/connect');
}
if (newComp.indexOf("href=\"") > -1) {
newComp = newComp.replace(/href="\/wps/g, 'href="https://portal.alemana.cl/wps');
}
if (newComp.indexOf("src=\"") > -1) {
newComp = newComp.replace(/src="\/wps/g, 'src="https://portal.alemana.cl/wps');
}
if (newComp.indexOf("action=\"") > -1) {
newComp = newComp.replace(/action="\/wps/g, 'action="https://portal.alemana.cl/wps');
}
return newComp;
}
principalEl.insertAdjacentHTML('beforebegin', appexUrlAbsoluta(htmlmenuMobile));
principalEl.insertAdjacentHTML('afterend', appexUrlAbsoluta(htmlfooterMobile));
principalEl.insertAdjacentHTML('beforebegin', appexUrlAbsoluta(htmlmenuDesk));
principalEl.insertAdjacentHTML('afterend', appexUrlAbsoluta(htmlfooterDesk));
principalEl.insertAdjacentHTML('beforebegin', appexUrlAbsoluta(iconosprecarga));