|
39 | 39 | if (entryData.status) entry.label.textContent += ` — ${entryData.status}`
|
40 | 40 | if (entryData.type == 'link') {
|
41 | 41 | entry.label.after(entry.rightElem = dom.create.elem('div', { class: 'menu-right-elem' }))
|
42 |
| - entry.favicon = !entryData.favicon ? null |
43 |
| - : dom.create.elem('img', { width: 15, |
44 |
| - src: typeof entryData.favicon == 'string' ? entryData.favicon |
| 42 | + if (entryData.favicon) entry.favicon = dom.create.elem('img', { width: 15, |
| 43 | + src: typeof entryData.favicon == 'string' ? entryData.favicon |
45 | 44 | : `https://www.google.com/s2/favicons?domain=${new URL(entryData.url).hostname}` })
|
46 | 45 | entry.openIcon = icons.create({ key: 'open', size: 17, fill: 'black' })
|
47 | 46 | entry.rightElem.append(entry.favicon || entry.openIcon)
|
48 | 47 | if (entry.favicon) entry.rightElem.onmouseenter = entry.rightElem.onmouseleave = event =>
|
49 | 48 | entry.rightElem.firstChild.replaceWith(entry[event.type == 'mouseenter' ? 'openIcon' : 'favicon'])
|
50 | 49 | }
|
51 | 50 | }
|
52 |
| - if (entryData.type == 'category') |
| 51 | + if (entryData.type == 'category') // add caret |
53 | 52 | entry.div.append(icons.create({ key: 'caretDown', size: 11, class: 'menu-caret menu-right-elem' }))
|
54 | 53 | else if (entryData.type == 'slider') { // append slider, add listeners, remove .highlight-on-hover
|
55 | 54 | entry.slider = dom.create.elem('input', { class: 'slider', type: 'range',
|
|
69 | 68 | }
|
70 | 69 | entry.div.append(entry.slider) ; entry.div.classList.remove('highlight-on-hover')
|
71 | 70 | }
|
72 |
| - if (entryData.dependencies) { |
| 71 | + if (entryData.dependencies) { // hide/show accordingly |
73 | 72 | const toDisable = Object.values(entryData.dependencies).flat().some(dep => !settings.typeIsEnabled(dep))
|
74 | 73 | Object.assign(entry.div.style, {
|
75 | 74 | transition: '', minHeight: 'auto', opacity: +!toDisable,
|
|
0 commit comments