455bde491f
uses the <tool-tip> tag now, and the setupTooltips() function in ui.ts must be called at any point in the pages load. added "below-center" position, showing below and centered horizontally. breakpoint tailwind lingo also now works (e.g. "below-center sm:right"). If a left or right-aligned tooltip clips off the screen, it will be shifted the appropriate amount left/right to avoid that automatically.
29 lines
939 B
TypeScript
29 lines
939 B
TypeScript
import { toClipboard, notificationBox } from "./modules/common.js";
|
|
import { setupTooltips } from "./modules/ui.js";
|
|
|
|
declare var window: GlobalWindow;
|
|
|
|
setupTooltips();
|
|
|
|
const pin = document.getElementById("pin") as HTMLSpanElement;
|
|
|
|
if (pin) {
|
|
// Load this individual string into the DOM, so we don't have to load the whole language file.
|
|
const copy = document.getElementById("copy-notification");
|
|
const copyString = copy.textContent;
|
|
copy.remove();
|
|
|
|
window.notifications = new notificationBox(document.getElementById("notification-box") as HTMLDivElement, 5);
|
|
|
|
pin.onclick = () => {
|
|
toClipboard(pin.textContent);
|
|
window.notifications.customPositive("copied", "", copyString);
|
|
pin.classList.add("~positive");
|
|
pin.classList.remove("~urge");
|
|
setTimeout(() => {
|
|
pin.classList.add("~urge");
|
|
pin.classList.remove("~positive");
|
|
}, 5000);
|
|
};
|
|
}
|