function routeNodesPrivEvent(nodeid,attr,attr2){ return function (e){ var input = e.which || e.keyCode; if (input === 13) { // 13 is enter value = e.target.value || e.srcElement.value || '' if(internal.aliases[nodeid] == undefined){ internal.aliases[nodeid] = {} } if(attr2 == undefined){ internal.aliases[nodeid][attr] = value }else{ if(internal.aliases[nodeid][attr] == undefined){ internal.aliases[nodeid][attr] = {} } internal.aliases[nodeid][attr][attr2] = 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 += '
HostnamePortsFreqClientsChTxEditSSH
' + '
' + moment(internal.nodes[key].lastseen).fromNow(true) +'
' + '
' + '' + '' + '
' + '
100%2Ghz'+internal.nodes[key].statistics.clients.wifi24+'' + '' + '' + '' + 'edit'+sshUrl(key)+'
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("edit_"+key).addEventListener('click', function(){ editModel(key) }) }) }