diff --git a/htdocs/lib/Modes.js b/htdocs/lib/Modes.js index dda89f2..e7b2597 100644 --- a/htdocs/lib/Modes.js +++ b/htdocs/lib/Modes.js @@ -18,27 +18,30 @@ var Modes = { var normalModes = available.filter(function(m){ return !m.digimode; }); var digiModes = available.filter(function(m){ return m.digimode; }); - var index = 0; - var arrayLength = normalModes.length; - var chunks = []; - - - for (index = 0; index < arrayLength; index += 5) { - chunks.push(normalModes.slice(index, index + 5)); - } var html = [] - html.push.apply(html, chunks.map(function(chunk){ + var buttons = normalModes.map(function(m){ return $( - '
' + - chunk.map(function(m){ - return '
' + - m.name + '
'; - }).join('') + - '
'); + '
' + + m.name + '
' + ); + }); + + var index = 0; + var arrayLength = buttons.length; + var chunks = []; + + for (index = 0; index < arrayLength; index += 5) { + chunks.push(buttons.slice(index, index + 5)); + } + + html.push.apply(html, chunks.map(function(chunk){ + $line = $('
'); + $line.append.apply($line, chunk); + return $line })); html.push($( @@ -55,7 +58,7 @@ var Modes = { $("#openwebrx-panel-receiver").find(".openwebrx-modes").html(html); } -} +}; var Mode = function(json){ this.modulation = json.modulation;