Skip to content

Commit

Permalink
use html instead of icons for button notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
alyyousuf7 committed Mar 25, 2024
1 parent 8d775b1 commit 3961784
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ export function showNotification(text, time = 3000) {

const elm = document.createElement('div');
const elmInner = document.createElement('div');
elmInner.innerText = text;
elmInner.innerHTML = text;
elmInner.classList.add('message');
elmInner.classList.add('message-hidden');
elm.appendChild(elmInner);
Expand All @@ -214,7 +214,21 @@ export function showNotification(text, time = 3000) {
}, time);
}

function getBoxHTML(color, text = '') {
const el = document.createElement('div');
el.style.display = 'inline-block';
el.style.backgroundColor = color;
el.style.paddingInline = '5px';
el.innerText = text;

return el.outerHTML;
}

setTimeout(() => {
showNotification('Press 🟩 to open YTAF configuration screen');
showNotification('Press 🟥 to toggle on/off SponsorBlock');
showNotification(
`Press ${getBoxHTML('green', 'GREEN')} to open YTAF configuration screen`
);
showNotification(
`Press ${getBoxHTML('red', 'RED')} to toggle on/off SponsorBlock`
);
}, 2000);

0 comments on commit 3961784

Please sign in to comment.