function routeNodesPrivEvent(nodeid,attr,attr2){ return function (e){ var input = e.which || e.keyCode; if (input === 13) { // 13 is enter if(internal.aliases[nodeid] == undefined){ internal.aliases[nodeid] = {} } if(attr2 == undefined){ internal.aliases[nodeid][attr] = e.srcElement.value }else{ if(internal.aliases[nodeid][attr] == undefined){ internal.aliases[nodeid][attr] = {} } internal.aliases[nodeid][attr][attr2] = e.srcElement.value } send('POST',internal.config.api+'/aliases/alias/'+nodeid,internal.aliases[nodeid]) } menuAliases.setAttribute("data-badge",Object.keys(internal.aliases).length) } } function routeNodes(){ fill = '' + '' + '' +'' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' Object.keys(internal.nodes).map(function(key){ fill += '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' }) fill += '
HostnamePortsFreqClientsChTxOrtSSH
' + 'camera' + '
' + '' + '' + '
' + '
100%2Ghz'+internal.nodes[key].statistics.clients.wifi24+'' + '' + '' + '' + 'placeSSH
5Ghz'+ internal.nodes[key].statistics.clients.wifi5+'' + '' + '' + '' + '
' container.innerHTML = fill Object.keys(internal.nodes).map(function(key){ document.getElementById("hostname_"+key).addEventListener('keypress', routeNodesPrivEvent(key,'hostname',null)) document.getElementById("freq24_ch_"+key).addEventListener('keypress', routeNodesPrivEvent(key,'freq24','channel')) document.getElementById("freq24_tx_"+key).addEventListener('keypress', routeNodesPrivEvent(key,'freq24','txpower')) document.getElementById("freq5_ch_"+key).addEventListener('keypress', routeNodesPrivEvent(key,'freq5','channel')) document.getElementById("freq5_tx_"+key).addEventListener('keypress', routeNodesPrivEvent(key,'freq5','txpower')) }) }