Skip to content

Commit

Permalink
Less DOM elements in reduced mode. Fix CSS link.
Browse files Browse the repository at this point in the history
  • Loading branch information
lwindolf committed Apr 13, 2024
1 parent 86370ae commit c54304b
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions frontend/js/MultiStatusCloud.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class MultiStatusCloud extends HTMLElement {

const linkElem = document.createElement("link");
linkElem.setAttribute("rel", "stylesheet");
linkElem.setAttribute("href", this.#path + "css/style.css");
linkElem.setAttribute("href", (this.#path?this.#path:'') + "css/style.css");

this.shadowRoot.append(this.#cloud);
this.shadowRoot.append(this.#info);
Expand Down Expand Up @@ -79,13 +79,6 @@ class MultiStatusCloud extends HTMLElement {
const s = this.#data.aggregators[e.dataset.nr];

MultiStatus.renderStatus(e, s);

// Hide all good for reduced mode
if(this.#reduced && s.results.length == 0) {
e.style.display = 'none';
} else {
e.style.display = 'inline-block';
}
}

async #update() {
Expand All @@ -102,11 +95,16 @@ class MultiStatusCloud extends HTMLElement {
if (a.name.toLowerCase() < b.name.toLowerCase()) return -1;
return 0;
}).forEach((s, nr) => {
// Hide all good for reduced mode
if(this.#reduced && s.results.length == 0)
return;

if (filter.length == 0 || filter.includes(s.name)) {
var e = document.createElement('div');
e.className = 'status';
e.setAttribute('data-nr', nr);
e.onclick = this.toggleDetails;
e.style.display = 'inline-block';
this.#cloud.append(e);
this.#renderStatus(e);
}
Expand Down

0 comments on commit c54304b

Please sign in to comment.