Skip to content

Commit

Permalink
Implemented item/block highlighting. Fixes #17.
Browse files Browse the repository at this point in the history
  • Loading branch information
Matriks404 committed Feb 24, 2024
1 parent 35996bb commit c17d904
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 10 deletions.
19 changes: 18 additions & 1 deletion scss/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ img {
image-rendering: pixelated;
}

//img:hover {
// filter: contrast(0.5) brightness(1.5);
//}

main > fieldset {
width: 324px;
}
Expand Down Expand Up @@ -248,12 +252,25 @@ p {
}

.entry {
margin: 0 2px 3px 2px;
margin: 0 1px 3px 1px;
padding: 0 1px 0 1px;

width: 32px;
height: 48px;
}

.entry:hover {
background-color: #c5c5c5;

outline: 1px solid #4b4b4b;
}

.field {
width: 32px;
height: 32px;
}


.fieldset-content {
display: flex;

Expand Down
20 changes: 11 additions & 9 deletions site/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,9 @@ function loadEntries(entries, el, entriesName, hasUnknownIds) {
damageElement.innerHTML = damageValue;
}

var elementWithTooltip = document.createElement('div');
elementWithTooltip.className = 'with-tooltip';
entryElement.appendChild(elementWithTooltip);
var fieldElement = document.createElement('div');
fieldElement.className = 'field';
entryElement.appendChild(fieldElement);

var img = document.createElement('img');

Expand All @@ -217,16 +217,18 @@ function loadEntries(entries, el, entriesName, hasUnknownIds) {
img.src = 'images/unknown.png';
}

elementWithTooltip.appendChild(img);
fieldElement.appendChild(img);

var tooltip = document.createElement('div');
tooltip.className = 'tooltip';
if (entry.name) {
entryElement.className += ' with-tooltip'

var name = entry.name ? entry.name : "[NO NAME]";
var tooltip = document.createElement('div');
tooltip.className = 'tooltip';

tooltip.innerHTML = name;
tooltip.innerHTML = entry.name;

elementWithTooltip.appendChild(tooltip);
entryElement.appendChild(tooltip);
}
});
}

Expand Down

0 comments on commit c17d904

Please sign in to comment.