Skip to content

Commit

Permalink
Moved tooltipsSupported from menu.register() to `env.scriptManage…
Browse files Browse the repository at this point in the history
…r.supportsTooltips` for readability ↞ [auto-sync from https://github.com/adamlui/ai-web-extensions]
  • Loading branch information
kudo-sync-bot committed Dec 25, 2024
1 parent c0c4945 commit 57d13af
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@
// @description:zu Ziba itshala lokucabanga okuzoshintshwa ngokuzenzakalelayo uma ukubuka chatgpt.com
// @author Adam Lui
// @namespace https://github.com/adamlui
// @version 2024.12.23.5
// @version 2024.12.25
// @license MIT
// @icon https://media.autoclearchatgpt.com/images/icons/openai/black/icon48.png?a8868ef
// @icon64 https://media.autoclearchatgpt.com/images/icons/openai/black/icon64.png?a8868ef
Expand Down Expand Up @@ -276,6 +276,8 @@
ui: { scheme: getScheme() }
}
env.browser.isPortrait = env.browser.isMobile && (window.innerWidth < window.innerHeight)
env.scriptManager.supportsTooltips = env.scriptManager.name == 'Tampermonkey'
&& parseInt(env.scriptManager.version.split('.')[0]) >= 5
const xhr = typeof GM != 'undefined' && GM.xmlHttpRequest || GM_xmlhttpRequest

// Init APP data
Expand Down Expand Up @@ -398,8 +400,7 @@
},

register() {
const tooltipsSupported = env.scriptManager.name == 'Tampermonkey'
&& parseInt(env.scriptManager.version.split('.')[0]) >= 5

// Add toggles
Object.keys(settings.controls).forEach(key => {
const settingIsEnabled = config[key] ^ /disabled|hidden/i.test(key)
Expand All @@ -414,14 +415,14 @@
menu.state.words[+(config[key] ^ /disabled|hidden/i.test(key))]}`)
} else // Clear Now action
clearChatsAndGoHome()
}, tooltipsSupported ? { title: settings.controls[key].helptip || ' ' } : undefined))
}, env.scriptManager.supportsTooltips ? { title: settings.controls[key].helptip || ' ' } : undefined))
});

// Add About/Donate entries
['about', 'donate'].forEach(entryType => menu.ids.push(GM_registerMenuCommand(
`${ entryType == 'about' ? '💡' : '💖' }`
+ ` ${app.msgs[`menuLabel_${entryType}`]} ${ entryType == 'about' ? app.msgs.appName : '' }`,
() => modals.open(entryType), tooltipsSupported ? { title: ' ' } : undefined
() => modals.open(entryType), env.scriptManager.supportsTooltips ? { title: ' ' } : undefined
)))
},

Expand Down

0 comments on commit 57d13af

Please sign in to comment.