console, modules

This commit is contained in:
Daniel
2025-04-16 18:37:32 +02:00
parent 3be94ba3f6
commit 0ec5672068
8 changed files with 77 additions and 53 deletions

View File

@ -38,10 +38,6 @@ function createContent(s, message) {
var content = document.createElement('div');
content.classList.add("content");
// Process components of the message
// console.log("create content");
// console.log("message: ",message);
// console.log('length: ',message.components.length);
for (var i = 0; i < message.components.length; i++) {
var component = message.components[i];
if (!("title" in component))
@ -528,11 +524,14 @@ function createTitle(component, modules) {
var title = component.title;
if (modules) {
var icon_status = '<img name = ' + title + ':status class = "modules-icon status-icon" src="res/icon_status.png">';
if (component.statusname) {
left.innerHTML = icon_status;
}
left.innerHTML += '<span class = "modules-title">' + component.title + '</span>';
left.innerHTML += '<span class = "modules-title">' + title + '</span>';
if (component.statusname) {
let name = title + '-info'
left.innerHTML += '<span name = ' + name + ' class = "status-info"></span>';
}
} else {
left.innerHTML = component.title;
}
@ -543,12 +542,12 @@ function createParElement(component, tag='span', cls='col-right') {
if (debug_group_daniel) {
console.log("%cfunction: createParElement", "color:white;background:salmon");
}
var right = document.createElement(tag);
if (cls)
right.classList.add(cls);
// right.name = is not sufficient, getElementsByName would not work
right.setAttribute('name', component.name);
// Add DOM-property
right.__ctype__ = component.type;
return right;
}
@ -585,7 +584,31 @@ function appendToContent(component, left, right) {
row.appendChild(createInfo(component));
}
row.appendChild(left);
console.log(component);
row.appendChild(right);
return row;
}
function appendToGridElement(s, title, type, content) {
if (debug_swiper_daniel) {
console.log("%cfunction: appendToGridElement", "color:white;background:lightblue");
console.log("title: ",title);
}
var panel = document.createElement('div');
panel.classList.add("panel");
titlewrapper = document.createElement('span');
titlewrapper.innerHTML = title;
panel.appendChild(titlewrapper);
var gridContainer = document.createElement('div');
gridContainer.classList.add("grid-container");
// Store type so it can be found easiely later.
gridContainer.slideType = type;
gridContainer.appendChild(panel);
gridContainer.appendChild(content);
var gridelements = document.getElementsByClassName('grid-element');
gridelements[s].innerHTML = "";
gridelements[s].appendChild(gridContainer);
}