WLED/wled00/data/cfg.js
Christian Schwinne 59025e317e
New settings es6 (merge from pbolduc fork) (#3231)
* Initial new settings page test commit

* quick poc to add chibi style helper and start to change files to es6

* add ready and loaded functions

* added missing pageloaded variable to track if loaded already called.

* More POC to dynamically add content, minimal DOM lib based on chibi

* Add simple translation for any element that has class=l10n

* simply self executing function

---------

Co-authored-by: Phil Bolduc <philbolduc@gmail.com>
2023-06-05 16:33:51 +02:00

30 lines
1.2 KiB
JavaScript

import $ from './dom.mjs'
import translate from './translator.mjs'
/* Dynamically create the menu
const menuItems = [
{ "icon": "&#xe90c;", "id": "e-nw", "text": "Network" },
{ "icon": "&#xe90a;", "id": "e-hw", "text": "Hardware" },
{ "icon": "&#xe904;", "id": "e-ui", "text": "Customization" },
{ "icon": "&#xe906;", "id": "e-if", "text": "Interfaces" },
{ "icon": "&#xe90b;", "id": "e-tm", "text": "Schedules" },
{ "icon": "&#xe90a;", "id": "e-dx", "text": "DMX Out" },
{ "icon": "&#xe903;", "id": "e-sr", "text": "Sound Reactive" },
{ "icon": "&#xe907;", "id": "e-um", "text": "Usermods" },
{ "icon": "&#xe909;", "id": "e-ab", "text": "About" }
];
$().ready(function() {
const menu = $('#menu');
menuItems.map(item =>
menu.append(`<div class="entry"><div class="e-icon"><i class="icons">${item.icon}</i></div><div class="l e-label l10n" id="${item.id}">${item.text}</div></div>`)
);
});
*/
// populate labels when to dom is ready but before it is rendered
$().ready(function() {
// https://www.w3.org/International/questions/qa-i18n
// Localization is sometimes written in English as l10n
translate('.l10n');
});