|
149 | 149 | // @description:zu Yengeza izimpendulo ze-AI ku-Google Search (inikwa amandla yi-Google Gemma + GPT-4o!) |
150 | 150 | // @author KudoAI |
151 | 151 | // @namespace https://kudoai.com |
152 | | -// @version 2025.3.3 |
| 152 | +// @version 2025.3.3.1 |
153 | 153 | // @license MIT |
154 | 154 | // @icon https://assets.googlegpt.io/images/icons/googlegpt/black/icon48.png?v=59409b2 |
155 | 155 | // @icon64 https://assets.googlegpt.io/images/icons/googlegpt/black/icon64.png?v=59409b2 |
|
981 | 981 |
|
982 | 982 | // Replace link buttons w/ clones that don't dismiss modal |
983 | 983 | if (/support|discuss|extensions/i.test(btn.textContent)) { |
984 | | - const btnClone = btn.cloneNode(true) |
985 | | - btn.parentNode.replaceChild(btnClone, btn) ; btn = btnClone |
| 984 | + btn.replaceWith(btn = btn.cloneNode(true)) |
986 | 985 | btn.onclick = () => modals.safeWinOpen(app.urls[ |
987 | 986 | btn.textContent.includes(app.msgs.btnLabel_getSupport) ? 'support' |
988 | 987 | : btn.textContent.includes(app.msgs.btnLabel_discuss) ? 'discuss' : 'relatedExtensions' ]) |
|
1175 | 1174 | schemeModal.querySelector('h2').style.justifySelf = 'center' |
1176 | 1175 | schemeModal.querySelector('.modal-buttons').style.cssText = 'justify-content: center ; margin: 20px 0 9px !important' |
1177 | 1176 |
|
1178 | | - // Re-format each button |
1179 | | - const buttons = schemeModal.querySelectorAll('button'), |
1180 | | - schemeEmojis = { 'light': '☀️', 'dark': '🌘', 'auto': '🌗'} |
1181 | | - for (const btn of buttons) { |
| 1177 | + // Hack buttons |
| 1178 | + const schemeEmojis = { 'light': '☀️', 'dark': '🌘', 'auto': '🌗'} |
| 1179 | + schemeModal.querySelectorAll('button').forEach(btn => { |
1182 | 1180 | const btnScheme = btn.textContent.toLowerCase() |
1183 | 1181 |
|
1184 | 1182 | // Emphasize active scheme |
|
1194 | 1192 | else btn.style.display = 'none' // hide Dismiss button |
1195 | 1193 |
|
1196 | 1194 | // Clone button to replace listener to not dismiss modal on click |
1197 | | - const newBtn = btn.cloneNode(true) ; btn.parentNode.replaceChild(newBtn, btn) |
1198 | | - newBtn.onclick = () => { |
| 1195 | + btn.replaceWith(btn = btn.cloneNode(true)) |
| 1196 | + btn.onclick = () => { |
1199 | 1197 | const newScheme = btnScheme == 'auto' ? getScheme() : btnScheme |
1200 | 1198 | settings.save('scheme', btnScheme == 'auto' ? false : newScheme) |
1201 | 1199 | schemeModal.querySelectorAll('button').forEach(btn => |
1202 | 1200 | btn.classList = '') // clear prev emphasized active scheme |
1203 | | - newBtn.classList = 'primary-modal-btn' // emphasize newly active scheme |
1204 | | - newBtn.style.cssText = 'pointer-events: none' // disable hover fx to show emphasis |
1205 | | - setTimeout(() => { newBtn.style.pointerEvents = 'auto' }, // re-enable hover fx |
| 1201 | + btn.classList = 'primary-modal-btn' // emphasize newly active scheme |
| 1202 | + btn.style.cssText = 'pointer-events: none' // disable hover fx to show emphasis |
| 1203 | + setTimeout(() => { btn.style.pointerEvents = 'auto' }, // re-enable hover fx |
1206 | 1204 | 100) // ...after 100ms to flicker emphasis |
1207 | 1205 | update.scheme(newScheme) ; schemeNotify(btnScheme) |
1208 | 1206 | } |
1209 | | - } |
| 1207 | + }) |
1210 | 1208 |
|
1211 | 1209 | log.debug('Success! Scheme modal shown') |
1212 | 1210 |
|
|
4117 | 4115 | : copyBtn.parentNode.parentNode ) // code container |
4118 | 4116 | const textToCopy = textContainer.textContent.replace(/^>> /, '').trim() |
4119 | 4117 | copyBtn.style.cursor = 'default' // remove finger |
4120 | | - copyBtn.replaceChild(copySVGs.copied, copySVGs.copy) // change to Copied icon |
| 4118 | + copySVGs.copy.replaceWith(copySVGs.copied) // change to Copied icon |
4121 | 4119 | toggle.tooltip(event) // update tooltip |
4122 | 4120 | setTimeout(() => { // restore icon/cursor/tooltip after a bit |
4123 | | - copyBtn.replaceChild(copySVGs.copy, copySVGs.copied) |
| 4121 | + copySVGs.copied.replaceWith(copySVGs.copy) |
4124 | 4122 | copyBtn.style.cursor = 'pointer' ; copyBtn.dispatchEvent(new Event('mouseenter')) |
4125 | 4123 | }, 1355) |
4126 | 4124 | navigator.clipboard.writeText(textToCopy) // copy text to clipboard |
|
0 commit comments