Skip to content
This repository has been archived by the owner on Dec 19, 2022. It is now read-only.

Commit

Permalink
fix(html/script): failsafe for null values
Browse files Browse the repository at this point in the history
  • Loading branch information
BerkieBb committed Apr 25, 2022
1 parent beb903f commit c6428f0
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions html/js/script.js
Expand Up @@ -12,15 +12,17 @@ window.addEventListener('message', function (event) {
$('.target-label').html('');

for (let [index, itemData] of Object.entries(item.data)) {
const numberTest = Number(index);

if (!isNaN(numberTest)) index = numberTest + 1;

$('.target-label').append(
`<div class='target-item' id='${index}'><i class='${itemData.icon} fa-fw fa-pull-left target-icon'></i>${itemData.label}</div>`
);

$(`#${index}`).css('padding-top', '0.75vh');
if (itemData !== null) {
const numberTest = Number(index);

if (!isNaN(numberTest)) index = numberTest + 1;

$('.target-label').append(
`<div class='target-item' id='${index}'><i class='${itemData.icon} fa-fw fa-pull-left target-icon'></i>${itemData.label}</div>`
);

$(`#${index}`).css('padding-top', '0.75vh');
}
}

$('.target-eye').css('color', 'rgba(255, 255, 255, 0.8)');
Expand Down

0 comments on commit c6428f0

Please sign in to comment.