From d709d8b86801fa013907dc0de9055a34fa694c12 Mon Sep 17 00:00:00 2001 From: Luciano Iam Date: Sun, 12 Apr 2020 09:51:09 +0200 Subject: WebSockets: cleanup index page JS --- share/web_surfaces/index/main.js | 19 ++++++++----------- 1 file 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 = `
  • - ${surface.name} + ${surface.name}

    ${surface.description}

  • `; ul.appendChild(li); @@ -54,7 +51,7 @@ import { Ardour } from '/shared/ardour.js'; } else { const p = document.createElement('p'); p.innerHTML = '

    No surfaces found

    '; - document.getElementById(groupPath).appendChild(p); + document.getElementById(group.path).appendChild(p); } } -- cgit v1.2.3