Skip to content

Commit f6e667f

Browse files
committed
Added lib/feedback.js as dependency ↞ [auto-sync from https://github.com/adamlui/ai-web-extensions/tree/main/chatgpt-widescreen]
1 parent b863b68 commit f6e667f

1 file changed

Lines changed: 5 additions & 41 deletions

File tree

chatgpt/chatgpt-widescreen/chatgpt-widescreen-mode.user.js

Lines changed: 5 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@
235235
// @description:zu Thuthukisa iChatGPT ngemodi zesikrini ezibanzi/egcwele/ephezulu + imodi yokuvimbela i-spam. Futhi isebenza ku-poe.com!
236236
// @author Adam Lui
237237
// @namespace https://github.com/adamlui
238-
// @version 2025.9.5.15
238+
// @version 2025.9.5.17
239239
// @license MIT
240240
// @icon https://assets.chatgptwidescreen.com/images/icons/widescreen-robot-emoji/icon48.png?v=844b16e
241241
// @icon64 https://assets.chatgptwidescreen.com/images/icons/widescreen-robot-emoji/icon64.png?v=844b16e
@@ -258,6 +258,7 @@
258258
// @require https://cdn.jsdelivr.net/npm/json5@2.2.3/dist/index.min.js#sha256-S7ltnVPzgKyAGBlBG4wQhorJqYTehj5WQCrADCKJufE=
259259
// @require https://cdn.jsdelivr.net/gh/adamlui/chatgpt-widescreen@152a535/chromium/extension/lib/browser.js#sha256-7teBecqrjkazKH6oetGyxKlBkAk5U9ota/LNCB3Q+Jw=
260260
// @require https://cdn.jsdelivr.net/gh/adamlui/chatgpt-widescreen@dd4f5ac/chromium/extension/lib/chatbar.js#sha256-YUVTAFP+pS5dYG//S0j8anbrR4IdGaqyfMzyHYJLmKk=
261+
// @require https://cdn.jsdelivr.net/gh/adamlui/chatgpt-widescreen@ca09ef2/chromium/extension/lib/feedback.js#sha256-+pCdFOvlfPkjBY2uk+6waX+K+NPkJ6teEBY2qSlUnuo=
261262
// @require https://cdn.jsdelivr.net/gh/adamlui/chatgpt-widescreen@01bcbd6/chromium/extension/lib/settings.js#sha256-gfnbziJG+aHUeYEYi55OUTC/mHpy4DF3SeDGX32s+i8=
262263
// @require https://cdn.jsdelivr.net/gh/adamlui/chatgpt-widescreen@22c8c58/chromium/extension/lib/styles.js#sha256-B2atf6x6EB2a1cEFMmfVjalQA2OKeIkyAFWYpzQF7is=
263264
// @require https://cdn.jsdelivr.net/gh/adamlui/chatgpt-widescreen@0697e67/chromium/extension/lib/sync.js#sha256-TgnlMU6Y+2hW2YDsPuzvndeYQ2lZEqWOGmF++7CQ7nE=
@@ -421,43 +422,6 @@
421422
return words.join(' ') // join'em back together
422423
}
423424

424-
// Define FEEDBACK functions
425-
426-
window.notify = function(msg, pos = '', notifDuration = '', shadow = '') {
427-
if (!styles.toast.node) styles.update({ key: 'toast' })
428-
if (config.notifDisabled
429-
&& !new RegExp(`${app.msgs.menuLabel_show} ${app.msgs.menuLabel_notifs}`, 'i').test(msg)
430-
) return
431-
432-
// Strip state word to append colored one later
433-
const foundState = toolbarMenu.state.words.find(word => msg.includes(word))
434-
if (foundState) msg = msg.replace(foundState, '')
435-
436-
// Show notification
437-
chatgpt.notify(`${app.symbol} ${msg}`, pos ||( config.notifBottom ? 'bottom' : '' ),
438-
notifDuration, shadow || env.ui.scheme == 'light')
439-
const notif = document.querySelector('.chatgpt-notif:last-child')
440-
notif.classList.add(app.slug) // for styles.toast
441-
442-
// Append styled state word
443-
if (foundState) {
444-
const stateStyles = {
445-
on: {
446-
light: 'color: #5cef48 ; text-shadow: rgba(255,250,169,0.38) 2px 1px 5px',
447-
dark: 'color: #5cef48 ; text-shadow: rgb(55,255,0) 3px 0 10px'
448-
},
449-
off: {
450-
light: 'color: #ef4848 ; text-shadow: rgba(255,169,225,0.44) 2px 1px 5px',
451-
dark: 'color: #ef4848 ; text-shadow: rgba(255, 116, 116, 0.87) 3px 0 9px'
452-
}
453-
}
454-
const styledStateSpan = dom.create.elem('span')
455-
styledStateSpan.style.cssText = stateStyles[
456-
foundState == toolbarMenu.state.words[0] ? 'off' : 'on'][env.ui.scheme]
457-
styledStateSpan.append(foundState) ; notif.append(styledStateSpan)
458-
}
459-
}
460-
461425
// Define UI functions
462426

463427
window.toggleMode = async (mode, state) => {
@@ -608,10 +572,10 @@
608572
)
609573
sync.configToUI({ updatedKey: key })
610574
if (ctgKey == 'siteSettings' && env.site == key) // notify if setting of active site toggled
611-
notify(`${app.name} 🧩 ${
575+
feedback.notify(`${app.name} 🧩 ${
612576
app.msgs[`state_${config[`${key}Disabled`] ? 'off' : 'on' }`].toUpperCase()}`)
613577
else if (ctgKey != 'siteSettings')
614-
notify(`${entryData.label}: ${toolbarMenu.state.words[+settings.typeIsEnabled(key)]}`)
578+
feedback.notify(`${entryData.label}: ${toolbarMenu.state.words[+settings.typeIsEnabled(key)]}`)
615579

616580
// Enable/disable dependent entries
617581
for (const [ctrlKey, ctrlData] of Object.entries(
@@ -937,7 +901,7 @@
937901
if ((event.key == 'F11' || event.keyCode == 122) && !config.fullscreen) config.f11 = true
938902
else if ((event.key.startsWith('Esc') || event.keyCode == 27) && chatgpt.isTyping())
939903
try { chatgpt.stop() ; requestAnimationFrame(() => !chatgpt.isTyping() &&
940-
notify(app.msgs.notif_chatStopped, 'bottom-right')) } catch (err) {}
904+
feedback.notify(app.msgs.notif_chatStopped, 'bottom-right')) } catch (err) {}
941905
})
942906

943907
})()

0 commit comments

Comments
 (0)