|
148 | 148 | // @description:zu Yengeza izimpendulo ze-AI ku-Brave Search (inikwa amandla yi-GPT-4o!)
|
149 | 149 | // @author KudoAI
|
150 | 150 | // @namespace https://kudoai.com
|
151 |
| -// @version 2025.3.3 |
| 151 | +// @version 2025.3.3.1 |
152 | 152 | // @license MIT
|
153 | 153 | // @icon https://assets.bravegpt.com/images/icons/bravegpt/icon48.png?v=df624b0
|
154 | 154 | // @icon64 https://assets.bravegpt.com/images/icons/bravegpt/icon64.png?v=df624b0
|
|
796 | 796 |
|
797 | 797 | // Replace link buttons w/ clones that don't dismiss modal
|
798 | 798 | if (/support|extensions/i.test(btn.textContent)) {
|
799 |
| - const btnClone = btn.cloneNode(true) |
800 |
| - btn.parentNode.replaceChild(btnClone, btn) ; btn = btnClone |
| 799 | + btn.replaceWith(btn = btn.cloneNode(true)) |
801 | 800 | btn.onclick = () => modals.safeWinOpen(app.urls[
|
802 | 801 | btn.textContent.includes(app.msgs.btnLabel_getSupport) ? 'support' : 'relatedExtensions' ])
|
803 | 802 | }
|
|
854 | 853 | btn.style.marginTop = btn.style.marginBottom = '5px' // v-pad btns
|
855 | 854 |
|
856 | 855 | // Replace buttons w/ clones that don't dismiss modal
|
857 |
| - const btnClone = btn.cloneNode(true) |
858 |
| - btn.parentNode.replaceChild(btnClone, btn) ; btn = btnClone |
| 856 | + btn.replaceWith(btn = btn.cloneNode(true)) |
859 | 857 | btn.onclick = () => modals.safeWinOpen(
|
860 | 858 | btn.textContent == 'Product Hunt' ? app.urls.review.productHunt
|
861 | 859 | : btn.textContent == 'Alternativeto' ? app.urls.review.alternativeTo
|
|
1031 | 1029 | schemeModal.querySelector('.modal-buttons')
|
1032 | 1030 | .style.cssText = 'justify-content: center ; margin: 18px 0 14px !important'
|
1033 | 1031 |
|
1034 |
| - // Re-format each button |
1035 |
| - const buttons = schemeModal.querySelectorAll('button'), |
1036 |
| - schemeEmojis = { 'light': '☀️', 'dark': '🌘', 'auto': '🌗'} |
1037 |
| - for (const btn of buttons) { |
| 1032 | + // Hack buttons |
| 1033 | + const schemeEmojis = { 'light': '☀️', 'dark': '🌘', 'auto': '🌗'} |
| 1034 | + schemeModal.querySelectorAll('button').forEach(btn => { |
1038 | 1035 | const btnScheme = btn.textContent.toLowerCase()
|
1039 | 1036 |
|
1040 | 1037 | // Emphasize active scheme
|
|
1050 | 1047 | else btn.style.display = 'none' // hide Dismiss button
|
1051 | 1048 |
|
1052 | 1049 | // Clone button to replace listener to not dismiss modal on click
|
1053 |
| - const newBtn = btn.cloneNode(true) ; btn.parentNode.replaceChild(newBtn, btn) |
1054 |
| - newBtn.onclick = () => { |
| 1050 | + btn.replaceWith(btn = btn.cloneNode(true)) |
| 1051 | + btn.onclick = () => { |
1055 | 1052 | const newScheme = btnScheme == 'auto' ? getScheme() : btnScheme
|
1056 | 1053 | settings.save('scheme', btnScheme == 'auto' ? false : newScheme)
|
1057 | 1054 | schemeModal.querySelectorAll('button').forEach(btn =>
|
1058 | 1055 | btn.classList = '') // clear prev emphasized active scheme
|
1059 |
| - newBtn.classList = 'primary-modal-btn' // emphasize newly active scheme |
1060 |
| - newBtn.style.cssText = 'pointer-events: none' // disable hover fx to show emphasis |
1061 |
| - setTimeout(() => { newBtn.style.pointerEvents = 'auto' }, // re-enable hover fx |
| 1056 | + btn.classList = 'primary-modal-btn' // emphasize newly active scheme |
| 1057 | + btn.style.cssText = 'pointer-events: none' // disable hover fx to show emphasis |
| 1058 | + setTimeout(() => { btn.style.pointerEvents = 'auto' }, // re-enable hover fx |
1062 | 1059 | 100) // ...after 100ms to flicker emphasis
|
1063 | 1060 | update.scheme(newScheme) ; schemeNotify(btnScheme)
|
1064 | 1061 | }
|
1065 |
| - } |
| 1062 | + }) |
1066 | 1063 |
|
1067 | 1064 | log.debug('Success! Scheme modal shown')
|
1068 | 1065 |
|
|
3938 | 3935 | : copyBtn.parentNode.parentNode ) // code container
|
3939 | 3936 | const textToCopy = textContainer.textContent.replace(/^>> /, '').trim()
|
3940 | 3937 | copyBtn.style.cursor = 'default' // remove finger
|
3941 |
| - copyBtn.replaceChild(copySVGs.copied, copySVGs.copy) // change to Copied icon |
| 3938 | + copySVGs.copy.replaceWith(copySVGs.copied) // change to Copied icon |
3942 | 3939 | toggle.tooltip(event) // update tooltip
|
3943 | 3940 | setTimeout(() => { // restore icon/cursor/tooltip after a bit
|
3944 |
| - copyBtn.replaceChild(copySVGs.copy, copySVGs.copied) |
| 3941 | + copySVGs.copied.replaceWith(copySVGs.copy) |
3945 | 3942 | copyBtn.style.cursor = 'pointer' ; copyBtn.dispatchEvent(new Event('mouseenter'))
|
3946 | 3943 | }, 1355)
|
3947 | 3944 | navigator.clipboard.writeText(textToCopy) // copy text to clipboard
|
|
0 commit comments