Skip to content

Commit

Permalink
Make more links clickable.
Browse files Browse the repository at this point in the history
  • Loading branch information
DeKleineKobini committed Feb 23, 2025
1 parent 5965e69 commit 2327cf8
Show file tree
Hide file tree
Showing 3 changed files with 1,924 additions and 1,910 deletions.
5 changes: 4 additions & 1 deletion extension/pages/popup/dashboard.css
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,13 @@ a#dashboard > header #country:hover {
height: 16px;
display: inline-block;
margin-right: 5px;
cursor: pointer;
position: relative;
}

a.icon {
cursor: pointer;
}

.icon > div {
background: url(https://torn.com/images/v2/svg_icons/sprites/user_status_icons_sprite.svg);
width: inherit;
Expand Down
29 changes: 11 additions & 18 deletions extension/pages/popup/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,24 +136,17 @@ async function setupDashboard() {

const iconsWrap = dashboard.find(".icons-wrap");
for (const { icon, id, description, url } of ALL_ICONS) {
const iconWrap = document.newElement({
type: "div",
class: "icon tt-hidden",
children: [document.newElement({ type: "div", class: icon, style: { backgroundPosition: `-${(id - 1) * 18}px 0` } })],
});
iconWrap.classList.add("hover_tooltip");
iconWrap.appendChild(document.newElement({ type: "span", class: "hover_tooltip_text", text: description }));

// Add a click event if the icon has a URL
if (url) {
iconWrap.addEventListener("click", () => {
window.open(url, "_blank", "noopener,noreferrer");
});

iconWrap.style.cursor = "pointer";
}

iconsWrap.appendChild(iconWrap);
iconsWrap.appendChild(
document.newElement({
type: url ? "a" : "div",
class: ["icon", "tt-hidden", "hover_tooltip"],
children: [
document.newElement({ type: "div", class: icon, style: { backgroundPosition: `-${(id - 1) * 18}px 0` } }),
document.newElement({ type: "span", class: "hover_tooltip_text", text: description }),
],
attributes: url ? { href: url, target: "_blank" } : {},
})
);
}

dashboard.find("#mute-notifications").classList.add(settings.notifications.types.global ? "enabled" : "disabled");
Expand Down
Loading

0 comments on commit 2327cf8

Please sign in to comment.