From c96e392f0fc252fd6ae8d4d91a950bed146a8d51 Mon Sep 17 00:00:00 2001 From: Luciano Iam Date: Sat, 11 Apr 2020 09:37:00 +0200 Subject: WebSockets: prepare for developing a shared JS API client --- share/web_surfaces/css/junge-regular-webfont.ttf | Bin 71400 -> 0 bytes share/web_surfaces/css/junge-regular-webfont.woff | Bin 30848 -> 0 bytes share/web_surfaces/css/main.css | 81 --------------------- share/web_surfaces/img/logo.png | Bin 36211 -> 0 bytes share/web_surfaces/index.html | 6 +- share/web_surfaces/index/junge-regular-webfont.ttf | Bin 0 -> 71400 bytes .../web_surfaces/index/junge-regular-webfont.woff | Bin 0 -> 30848 bytes share/web_surfaces/index/logo.png | Bin 0 -> 36211 bytes share/web_surfaces/index/main.css | 81 +++++++++++++++++++++ share/web_surfaces/index/main.js | 80 ++++++++++++++++++++ share/web_surfaces/js/main.js | 80 -------------------- share/web_surfaces/shared/ardour.js | 0 12 files changed, 164 insertions(+), 164 deletions(-) delete mode 100644 share/web_surfaces/css/junge-regular-webfont.ttf delete mode 100644 share/web_surfaces/css/junge-regular-webfont.woff delete mode 100644 share/web_surfaces/css/main.css delete mode 100644 share/web_surfaces/img/logo.png create mode 100644 share/web_surfaces/index/junge-regular-webfont.ttf create mode 100644 share/web_surfaces/index/junge-regular-webfont.woff create mode 100644 share/web_surfaces/index/logo.png create mode 100644 share/web_surfaces/index/main.css create mode 100644 share/web_surfaces/index/main.js delete mode 100644 share/web_surfaces/js/main.js create mode 100644 share/web_surfaces/shared/ardour.js (limited to 'share') diff --git a/share/web_surfaces/css/junge-regular-webfont.ttf b/share/web_surfaces/css/junge-regular-webfont.ttf deleted file mode 100644 index 4e381e9e3f..0000000000 Binary files a/share/web_surfaces/css/junge-regular-webfont.ttf and /dev/null differ diff --git a/share/web_surfaces/css/junge-regular-webfont.woff b/share/web_surfaces/css/junge-regular-webfont.woff deleted file mode 100644 index 4a74925aa9..0000000000 Binary files a/share/web_surfaces/css/junge-regular-webfont.woff and /dev/null differ diff --git a/share/web_surfaces/css/main.css b/share/web_surfaces/css/main.css deleted file mode 100644 index 3b330fa36f..0000000000 --- a/share/web_surfaces/css/main.css +++ /dev/null @@ -1,81 +0,0 @@ -@font-face { - font-family: 'junge-regular'; - src: url('junge-regular-webfont.woff') format('woff'), - url('junge-regular-webfont.ttf') format('truetype'); - font-weight: normal; - font-style: normal; -} - -html { - height: 100%; -} - -body { - font-family: 'junge-regular'; - font-size: 16px; - height: 100%; - margin: 0; -} - -div { - box-sizing: border-box; -} - -a { - color: #337ab7; - text-decoration: none; -} - -a:visited { - text-decoration: underline; -} - -a:focus, a:hover { - color: #23527c; - text-decoration: underline; -} - -h1, h2 { - font-weight: normal; -} - -h1 { - font-size: 1.8em; - margin: 0 0 2ex 0; - padding-bottom: .8ex; -} - -h2 { - font-size: 1.3em; - margin: 2ex 0 1ex 0; -} - -#top-bar { - background: #212a30; - padding: 4px; -} - -#logo { - height: 36px; - margin: 8px 8px 0 8px; -} - -#content { - padding: 24px; -} - -#index h2 { - border-bottom: 2px solid #ddd; -} - -.surface-list { - margin-bottom: 6ex; -} - -.surface-list > ul { - list-style-type: none; -} - -.surface-list > ul > li { - margin: 4ex 0; -} \ No newline at end of file diff --git a/share/web_surfaces/img/logo.png b/share/web_surfaces/img/logo.png deleted file mode 100644 index 652a6c3e1c..0000000000 Binary files a/share/web_surfaces/img/logo.png and /dev/null differ diff --git a/share/web_surfaces/index.html b/share/web_surfaces/index.html index df8726a109..6cead8b251 100644 --- a/share/web_surfaces/index.html +++ b/share/web_surfaces/index.html @@ -3,11 +3,11 @@ Ardour Web Surfaces - +
- +

Loading...

@@ -24,6 +24,6 @@
- + diff --git a/share/web_surfaces/index/junge-regular-webfont.ttf b/share/web_surfaces/index/junge-regular-webfont.ttf new file mode 100644 index 0000000000..4e381e9e3f Binary files /dev/null and b/share/web_surfaces/index/junge-regular-webfont.ttf differ diff --git a/share/web_surfaces/index/junge-regular-webfont.woff b/share/web_surfaces/index/junge-regular-webfont.woff new file mode 100644 index 0000000000..4a74925aa9 Binary files /dev/null and b/share/web_surfaces/index/junge-regular-webfont.woff differ diff --git a/share/web_surfaces/index/logo.png b/share/web_surfaces/index/logo.png new file mode 100644 index 0000000000..652a6c3e1c Binary files /dev/null and b/share/web_surfaces/index/logo.png differ diff --git a/share/web_surfaces/index/main.css b/share/web_surfaces/index/main.css new file mode 100644 index 0000000000..3b330fa36f --- /dev/null +++ b/share/web_surfaces/index/main.css @@ -0,0 +1,81 @@ +@font-face { + font-family: 'junge-regular'; + src: url('junge-regular-webfont.woff') format('woff'), + url('junge-regular-webfont.ttf') format('truetype'); + font-weight: normal; + font-style: normal; +} + +html { + height: 100%; +} + +body { + font-family: 'junge-regular'; + font-size: 16px; + height: 100%; + margin: 0; +} + +div { + box-sizing: border-box; +} + +a { + color: #337ab7; + text-decoration: none; +} + +a:visited { + text-decoration: underline; +} + +a:focus, a:hover { + color: #23527c; + text-decoration: underline; +} + +h1, h2 { + font-weight: normal; +} + +h1 { + font-size: 1.8em; + margin: 0 0 2ex 0; + padding-bottom: .8ex; +} + +h2 { + font-size: 1.3em; + margin: 2ex 0 1ex 0; +} + +#top-bar { + background: #212a30; + padding: 4px; +} + +#logo { + height: 36px; + margin: 8px 8px 0 8px; +} + +#content { + padding: 24px; +} + +#index h2 { + border-bottom: 2px solid #ddd; +} + +.surface-list { + margin-bottom: 6ex; +} + +.surface-list > ul { + list-style-type: none; +} + +.surface-list > ul > li { + margin: 4ex 0; +} \ No newline at end of file diff --git a/share/web_surfaces/index/main.js b/share/web_surfaces/index/main.js new file mode 100644 index 0000000000..9a8e9301a5 --- /dev/null +++ b/share/web_surfaces/index/main.js @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2020 Luciano Iam + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +(() => { + + const INDEX_RESOURCE = 'index.json'; + + async function fetchIndex (url) { + const response = await fetch(url); + + if (response.status == 200) { + return await response.json(); + } else { + throw new Error(`HTTP response status ${response.status}`); + } + } + + function buildItem (group, model) { + const li = document.createElement('li'); + li.innerHTML = `
  • + ${model.name} +

    ${model.description}

    +
  • `; + return li; + } + + function printIndex (index) { + ['builtin', 'user'].forEach((group) => { + const ul = document.getElementById(group); + let models = index[group]; + + if (models.length > 0) { + models.sort((a, b) => a.name.localeCompare(b.name)); + for (model of models) { + ul.appendChild(buildItem(group, model)); + } + } else { + ul.parentNode.style.display = 'none'; + } + }); + + document.getElementById('index').style.display = 'inline'; + } + + function printError (message) { + const error = document.getElementById('error'); + error.innerHTML = message; + error.style.display = 'inline'; + } + + async function main () { + try { + const indexUrl = `${location.protocol}//${location.host}/${INDEX_RESOURCE}`; + const index = await fetchIndex (indexUrl); + printIndex(index); + } catch (err) { + printError(`Error loading ${INDEX_RESOURCE}: ${err.message}`); + } + + document.getElementById('loading').style.display = 'none'; + } + + main(); + +})(); diff --git a/share/web_surfaces/js/main.js b/share/web_surfaces/js/main.js deleted file mode 100644 index 9a8e9301a5..0000000000 --- a/share/web_surfaces/js/main.js +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (C) 2020 Luciano Iam - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -(() => { - - const INDEX_RESOURCE = 'index.json'; - - async function fetchIndex (url) { - const response = await fetch(url); - - if (response.status == 200) { - return await response.json(); - } else { - throw new Error(`HTTP response status ${response.status}`); - } - } - - function buildItem (group, model) { - const li = document.createElement('li'); - li.innerHTML = `
  • - ${model.name} -

    ${model.description}

    -
  • `; - return li; - } - - function printIndex (index) { - ['builtin', 'user'].forEach((group) => { - const ul = document.getElementById(group); - let models = index[group]; - - if (models.length > 0) { - models.sort((a, b) => a.name.localeCompare(b.name)); - for (model of models) { - ul.appendChild(buildItem(group, model)); - } - } else { - ul.parentNode.style.display = 'none'; - } - }); - - document.getElementById('index').style.display = 'inline'; - } - - function printError (message) { - const error = document.getElementById('error'); - error.innerHTML = message; - error.style.display = 'inline'; - } - - async function main () { - try { - const indexUrl = `${location.protocol}//${location.host}/${INDEX_RESOURCE}`; - const index = await fetchIndex (indexUrl); - printIndex(index); - } catch (err) { - printError(`Error loading ${INDEX_RESOURCE}: ${err.message}`); - } - - document.getElementById('loading').style.display = 'none'; - } - - main(); - -})(); diff --git a/share/web_surfaces/shared/ardour.js b/share/web_surfaces/shared/ardour.js new file mode 100644 index 0000000000..e69de29bb2 -- cgit v1.2.3