From 8dbbc77b09a6112c724bacd2b32a180978fdf78e Mon Sep 17 00:00:00 2001 From: coon Date: Thu, 14 Dec 2023 22:58:27 +0100 Subject: [PATCH] static: generate queue + playlist sample data via javascript --- static/flexbox/index.html | 183 +------------------------------------- static/flexbox/sanic.js | 34 +++++++ 2 files changed, 36 insertions(+), 181 deletions(-) diff --git a/static/flexbox/index.html b/static/flexbox/index.html index 1ab053b..a89e44a 100644 --- a/static/flexbox/index.html +++ b/static/flexbox/index.html @@ -84,136 +84,7 @@ Time - - - 1 - Chakra - Love Shines Through (Martin Roth's in Electro Love Remix) - undefined - undefined - 9:29 - - - 2 - Chakra - Love Shines Through (Martin Roth's in Electro Love Remix) - undefined - undefined - 9:29 - - - 3 - Chakra - Love Shines Through (Martin Roth's in Electro Love Remix) - undefined - undefined - 9:29 - - - 4 - Chakra - Love Shines Through (Martin Roth's in Electro Love Remix) - undefined - undefined - 9:29 - - - 5 - Chakra - Love Shines Through (Martin Roth's in Electro Love Remix) - undefined - undefined - 9:29 - - - 6 - Chakra - Love Shines Through (Martin Roth's in Electro Love Remix) - undefined - undefined - 9:29 - - - 7 - Chakra - Love Shines Through (Martin Roth's in Electro Love Remix) - undefined - undefined - 9:29 - - - 8 - Chakra - Love Shines Through (Martin Roth's in Electro Love Remix) - undefined - undefined - 9:29 - - - 9 - Chakra - Love Shines Through (Martin Roth's in Electro Love Remix) - undefined - undefined - 9:29 - - - 10 - Chakra - Love Shines Through (Martin Roth's in Electro Love Remix) - undefined - undefined - 9:29 - - - 11 - Chakra - Love Shines Through (Martin Roth's in Electro Love Remix) - undefined - undefined - 9:29 - - - 12 - Chakra - Love Shines Through (Martin Roth's in Electro Love Remix) - undefined - undefined - 9:29 - - - 13 - Chakra - Love Shines Through (Martin Roth's in Electro Love Remix) - undefined - undefined - 9:29 - - - 14 - Chakra - Love Shines Through (Martin Roth's in Electro Love Remix) - undefined - undefined - 9:29 - - - 15 - Chakra - Love Shines Through (Martin Roth's in Electro Love Remix) - undefined - undefined - 9:29 - - - 16 - Chakra - Love Shines Through (Martin Roth's in Electro Love Remix) - undefined - undefined - 9:29 - - +
@@ -278,57 +149,7 @@ Time - - - Chakra - Love Shines Through (Martin Roth's in Electro Love Remix) - undefined - undefined - 9:29 - - - Chakra - Love Shines Through (Martin Roth's in Electro Love Remix) - undefined - undefined - 9:29 - - - Chakra - Love Shines Through (Martin Roth's in Electro Love Remix) - undefined - undefined - 9:29 - - - Chakra - Love Shines Through (Martin Roth's in Electro Love Remix) - undefined - undefined - 9:29 - - - Chakra - Love Shines Through (Martin Roth's in Electro Love Remix) - undefined - undefined - 9:29 - - - Chakra - Love Shines Through (Martin Roth's in Electro Love Remix) - undefined - undefined - 9:29 - - - Chakra - Love Shines Through (Martin Roth's in Electro Love Remix) - undefined - undefined - 9:29 - - +
diff --git a/static/flexbox/sanic.js b/static/flexbox/sanic.js index e69de29..0c5d412 100644 --- a/static/flexbox/sanic.js +++ b/static/flexbox/sanic.js @@ -0,0 +1,34 @@ +document.addEventListener('DOMContentLoaded', function() { + function fillTable(withPositionColumn, tableBodyElementName, numElements, playingIndex) { + for (let i = 0; i < numElements; i++) { + let trElem = ""; + let positionColumn = ""; + + if (i == playingIndex) + trElem += ``; + else + trElem += ``; + + if (withPositionColumn) + positionColumn += `${i + 1}` + + let exampleTableEntry = + ` \ + ${trElem} \ + ${positionColumn} \ + T.E.E.D. \ + Garden (Calibre Remix) \ + undefined \ + undefined \ + 06:01 \ + \ + ` + + tableBodyElement = document.getElementById(tableBodyElementName); + tableBodyElement.innerHTML += exampleTableEntry; + } + } + + fillTable(true, "queue-table-body", 8, 3); + fillTable(false, "playlist-table-body", 15, -1); +});