File size: 2,038 Bytes
db14b86 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
import {
archiveRestore,
arrowDownLeft,
arrowDownWideNarrow,
arrowRight,
arrowRightLeft,
arrowUpDown,
clipboardList,
cornerRightUp,
dices,
fileArchive,
folderClosed,
image,
laptop2,
panelRight,
penSquare,
pencilRuler,
pipette,
play,
refreshCcw,
save,
settings,
trash,
wand2,
webcam, // @ts-ignore
} from 'lucide-static';
const replaceIcon = (button: HTMLButtonElement, emoji: string[], svg: string) => {
if (!button?.textContent || !svg) return;
for (const e of emoji) {
if (button?.textContent?.includes(e)) {
button.innerHTML = svg
.replace(`width="24"`, `width="16"`)
.replace(`height="24"`, `height="16"`);
}
}
};
export default () => {
console.time('π€― [svgIcon] replace');
for (const button of document.querySelectorAll('button')) {
replaceIcon(button, ['ποΈ'], penSquare);
replaceIcon(button, ['ποΈ'], fileArchive);
replaceIcon(button, ['πΌοΈ'], pipette);
replaceIcon(button, ['π¨οΈ'], image);
replaceIcon(button, ['π'], folderClosed);
replaceIcon(button, ['π', 'π', 'β»οΈ'], refreshCcw);
replaceIcon(button, ['βοΈ'], arrowDownLeft);
replaceIcon(button, ['‴'], cornerRightUp);
replaceIcon(button, ['βοΈ'], arrowDownWideNarrow);
replaceIcon(button, ['ποΈ'], trash);
replaceIcon(button, ['π'], clipboardList);
replaceIcon(button, ['πΎ'], save);
replaceIcon(button, ['π²οΈ'], dices);
replaceIcon(button, ['πͺ'], wand2);
replaceIcon(button, ['βοΈ'], settings);
replaceIcon(button, ['β‘οΈ'], arrowRight);
replaceIcon(button, ['β
'], arrowUpDown);
replaceIcon(button, ['β'], arrowRightLeft);
replaceIcon(button, ['π΄'], panelRight);
replaceIcon(button, ['π'], archiveRestore);
replaceIcon(button, ['π₯'], play);
replaceIcon(button, ['π·'], webcam);
replaceIcon(button, ['π'], laptop2);
replaceIcon(button, ['π'], pencilRuler);
}
console.timeEnd('π€― [svgIcon] replace');
};
|