diff options
author | Luciano Iam <lucianito@gmail.com> | 2020-04-12 09:51:09 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2020-04-13 16:29:37 +0200 |
commit | d709d8b86801fa013907dc0de9055a34fa694c12 (patch) | |
tree | d972945d52adb541054d65fa5aeac07890f477bd /share/web_surfaces/index | |
parent | 70937dc1f952e36a70224d9e4134469e53024dfa (diff) |
WebSockets: cleanup index page JS
Diffstat (limited to 'share/web_surfaces/index')
-rw-r--r-- | share/web_surfaces/index/main.js | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/share/web_surfaces/index/main.js b/share/web_surfaces/index/main.js index fd64a29a40..785e003c9c 100644 --- a/share/web_surfaces/index/main.js +++ b/share/web_surfaces/index/main.js @@ -33,20 +33,17 @@ import { Ardour } from '/shared/ardour.js'; function printIndex (index) { for (const group of index) { - const surfaces = group.surfaces; - const groupPath = group['path']; - const groupPathSpan = document.querySelector(`#${groupPath} span`); - - groupPathSpan.innerHTML = group['diskPath']; + const span = document.querySelector(`#${group.path} span`); + span.innerHTML = group.diskPath; - if (surfaces.length > 0) { - const ul = document.querySelector(`#${groupPath} > ul`); - surfaces.sort((a, b) => a.name.localeCompare(b.name)); + if (group.surfaces.length > 0) { + const ul = document.querySelector(`#${group.path} > ul`); + group.surfaces.sort((a, b) => a.name.localeCompare(b.name)); - for (const surface of surfaces) { + for (const surface of group.surfaces) { const li = document.createElement('li'); li.innerHTML = `<li> - <a href="${groupPath}/${surface.path}/">${surface.name}</a> + <a href="${group.path}/${surface.path}/">${surface.name}</a> <p>${surface.description}</p> </li>`; ul.appendChild(li); @@ -54,7 +51,7 @@ import { Ardour } from '/shared/ardour.js'; } else { const p = document.createElement('p'); p.innerHTML = '<p>No surfaces found</p>'; - document.getElementById(groupPath).appendChild(p); + document.getElementById(group.path).appendChild(p); } } |