/** * Config Function * @desc Función para crear el módulo/controlador/accion * @author myance */ var fn = { sinaction: 5, sinparametro: 6, conparametro: 7, module: function(path){ var module = path.split('/') return module[3] }, controller: function(path){ var controller = path.split('/') return controller[4] }, action: function(path){ var action = path.split('/') if(action.length == fn.sinaction) return "Index" if(action.length == fn.sinparametro) return action[5] if(action.length == fn.conparametro) return action[5] }, detectarPagina: function(menu){ for(var i in menu){ var data = menu[i].data var MOD = fn.convertirLetra(PATH__.MODULE) var CON = fn.convertirLetra(PATH__.CONTROLLER) var ACT = fn.convertirLetra(PATH__.ACTION) var url = "/"+MOD+"/"+CON+"/"+ACT for(var j in data){ if(data[j].url === url){ window.pageTitle = data[j].action break } } } }, convertirLetra: function(text){ var textoFinal = ''; if(text){ textoFinal = text.charAt(0).toUpperCase() + text.slice(1); } return textoFinal; } } /** * PATH * @context Global * @desc Rutas Generales del Proyecto * @author myance */ var action = ("" != "") ? "" : "Index" window.SIJE__ = { USERNAME : "", IDUSER : "", IDPROFILE : "", ENVIROMENT : "PRO", MODULE : "", CONTROLLER : "", ACTION : action, DETAIL : "", PAGEPATH : "///"+action, SERVER : "https://plataformaelectoral.jne.gob.pe", SERVERSIJE : "https://sije.jne.gob.pe", SERVERDECLARA: "https://declara.jne.gob.pe/", CSS : "https://plataformaelectoral.jne.gob.pe/Content/css", JS : "https://plataformaelectoral.jne.gob.pe/Content/js/controllers", IMG : "https://plataformaelectoral.jne.gob.pe/Content/images", LIBS : "https://plataformaelectoral.jne.gob.pe/Content/libs", PROFILE : "", SIGLAJE : "" } /** * log * @context Global * @type Function * @desc Permite consolear solo cuando esté en ámbito desarrollo * @author myance */ window.log = function(){} if(SIJE__.ENVIROMENT === "LOCAL" || SIJE__.ENVIROMENT === "DESA" || SIJE__.ENVIROMENT === "TEST"){ var count = 0; var bg = ["#ffa549","#e20e0e","#525252","#aa0000", "#0AC191"] window.log = function(msj){ var obj = typeof msj; if (obj == "object") console.log(msj) else{ if(count==bg.length) count = 0 console.log("%c"+msj+"", "background:"+bg[count]+"; color: #fff; padding:1px 3px; font-size:16px"); count++ } } }