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');
};