mirror of
https://github.com/wled/WLED.git
synced 2025-04-20 12:57:19 +00:00

* 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>
30 lines
1.2 KiB
JavaScript
30 lines
1.2 KiB
JavaScript
import $ from './dom.mjs'
|
|
import translate from './translator.mjs'
|
|
|
|
/* Dynamically create the menu
|
|
const menuItems = [
|
|
{ "icon": "", "id": "e-nw", "text": "Network" },
|
|
{ "icon": "", "id": "e-hw", "text": "Hardware" },
|
|
{ "icon": "", "id": "e-ui", "text": "Customization" },
|
|
{ "icon": "", "id": "e-if", "text": "Interfaces" },
|
|
{ "icon": "", "id": "e-tm", "text": "Schedules" },
|
|
{ "icon": "", "id": "e-dx", "text": "DMX Out" },
|
|
{ "icon": "", "id": "e-sr", "text": "Sound Reactive" },
|
|
{ "icon": "", "id": "e-um", "text": "Usermods" },
|
|
{ "icon": "", "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');
|
|
}); |