Skip to content

Commit 7664470

Browse files
committed
Moved appName init to app.name re-init for simplicity
1 parent 4f52ea1 commit 7664470

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

chatgpt-widescreen/chromium/extension/popup/controller.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
// Import DATA
1818
const { app } = await chrome.storage.local.get('app'),
1919
{ sites } = await chrome.storage.local.get('sites')
20+
app.name = env.browser.displaysEnglish ? app.name : getMsg('appName') // for shorter notifs
2021

2122
// Export DEPENDENCIES to imported resources
2223
icons.import({ app }) // for src's using app.urls.assetHost
@@ -84,8 +85,6 @@
8485

8586
// Run MAIN routine
8687

87-
const appName = env.browser.displaysEnglish ? app.name : getMsg('appName') // for shorter notifs
88-
8988
// LOCALIZE extension title, set document lang
9089
const menuTitle = document.querySelector('.menu-title')
9190
menuTitle.innerText = getMsg(menuTitle.dataset.locale)
@@ -103,7 +102,7 @@
103102
env.extensionWasDisabled = extensionIsDisabled()
104103
masterToggle.switch.classList.toggle('on') ; settings.save('extensionDisabled', !config.extensionDisabled)
105104
Object.keys(sync).forEach(key => sync[key]()) // sync fade + storage to UI
106-
if (env.extensionWasDisabled ^ extensionIsDisabled()) notify(`${appName} 🧩 ${
105+
if (env.extensionWasDisabled ^ extensionIsDisabled()) notify(`${app.name} 🧩 ${
107106
getMsg(`state_${ extensionIsDisabled() ? 'off' : 'on' }`).toUpperCase()}`)
108107
}
109108

@@ -148,7 +147,7 @@
148147
// Create SITE SETTINGS label
149148
const ssLabel = { // category label row
150149
div: dom.create.elem('div', { id: 'site-settings', class: 'menu-entry highlight-on-hover',
151-
title: `${getMsg('helptip_enableDisable')} ${appName} ${getMsg('helptip_perSite')}`
150+
title: `${getMsg('helptip_enableDisable')} ${app.name} ${getMsg('helptip_perSite')}`
152151
}),
153152
label: dom.create.elem('label', { class: 'menu-icon' }), labelSpan: dom.create.elem('span'),
154153
caret: icons.create('caretDown', { size: 11, class: 'caret',
@@ -170,7 +169,7 @@
170169
// Init entry's elems
171170
const ssEntry = {
172171
div: dom.create.elem('div', { class: 'menu-entry highlight-on-hover',
173-
title: `${getMsg('helptip_run')} ${appName} on ${sites[site].urls.homepage}` }),
172+
title: `${getMsg('helptip_run')} ${app.name} on ${sites[site].urls.homepage}` }),
174173
switch: dom.create.elem('div', { class: 'toggle menu-icon' }),
175174
track: dom.create.elem('span', { class: 'track' }), label: dom.create.elem('span'),
176175
favicon: dom.create.elem('img', {
@@ -189,7 +188,7 @@
189188
settings.save(`${site}Disabled`, !config[`${site}Disabled`]) ; sync.configToUI()
190189
if (env.site == site) { // fade/notify if setting of active site toggled
191190
sync.fade()
192-
if (env.extensionWasDisabled ^ extensionIsDisabled()) notify(`${appName} 🧩 ${
191+
if (env.extensionWasDisabled ^ extensionIsDisabled()) notify(`${app.name} 🧩 ${
193192
getMsg(`state_${ extensionIsDisabled() ? 'off' : 'on' }`).toUpperCase()}`)
194193
}
195194
}
@@ -221,7 +220,7 @@
221220

222221
// Create/append ABOUT footer button
223222
const aboutSpan = dom.create.elem('span', {
224-
title: `${getMsg('menuLabel_about')} ${getMsg('appName')}`,
223+
title: `${getMsg('menuLabel_about')} ${getMsg('app.name')}`,
225224
class: 'menu-icon highlight-on-hover', style: 'right:30px ; padding-top: 2px' })
226225
const aboutIcon = icons.create('questionMark', { width: 15, height: 13, style: 'margin-bottom: 0.04rem' })
227226
aboutSpan.onclick = () => { chrome.runtime.sendMessage({ action: 'showAbout' }) ; close() }

chatgpt-widescreen/firefox/extension/popup/controller.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
// Import DATA
1818
const { app } = await chrome.storage.local.get('app'),
1919
{ sites } = await chrome.storage.local.get('sites')
20+
app.name = env.browser.displaysEnglish ? app.name : getMsg('appName') // for shorter notifs
2021

2122
// Export DEPENDENCIES to imported resources
2223
icons.import({ app }) // for src's using app.urls.assetHost
@@ -84,8 +85,6 @@
8485

8586
// Run MAIN routine
8687

87-
const appName = env.browser.displaysEnglish ? app.name : getMsg('appName') // for shorter notifs
88-
8988
// LOCALIZE extension title, set document lang
9089
const menuTitle = document.querySelector('.menu-title')
9190
menuTitle.innerText = getMsg(menuTitle.dataset.locale)
@@ -103,7 +102,7 @@
103102
env.extensionWasDisabled = extensionIsDisabled()
104103
masterToggle.switch.classList.toggle('on') ; settings.save('extensionDisabled', !config.extensionDisabled)
105104
Object.keys(sync).forEach(key => sync[key]()) // sync fade + storage to UI
106-
if (env.extensionWasDisabled ^ extensionIsDisabled()) notify(`${appName} 🧩 ${
105+
if (env.extensionWasDisabled ^ extensionIsDisabled()) notify(`${app.name} 🧩 ${
107106
getMsg(`state_${ extensionIsDisabled() ? 'off' : 'on' }`).toUpperCase()}`)
108107
}
109108

@@ -148,7 +147,7 @@
148147
// Create SITE SETTINGS label
149148
const ssLabel = { // category label row
150149
div: dom.create.elem('div', { id: 'site-settings', class: 'menu-entry highlight-on-hover',
151-
title: `${getMsg('helptip_enableDisable')} ${appName} ${getMsg('helptip_perSite')}`
150+
title: `${getMsg('helptip_enableDisable')} ${app.name} ${getMsg('helptip_perSite')}`
152151
}),
153152
label: dom.create.elem('label', { class: 'menu-icon' }), labelSpan: dom.create.elem('span'),
154153
caret: icons.create('caretDown', { size: 11, class: 'caret',
@@ -170,7 +169,7 @@
170169
// Init entry's elems
171170
const ssEntry = {
172171
div: dom.create.elem('div', { class: 'menu-entry highlight-on-hover',
173-
title: `${getMsg('helptip_run')} ${appName} on ${sites[site].urls.homepage}` }),
172+
title: `${getMsg('helptip_run')} ${app.name} on ${sites[site].urls.homepage}` }),
174173
switch: dom.create.elem('div', { class: 'toggle menu-icon' }),
175174
track: dom.create.elem('span', { class: 'track' }), label: dom.create.elem('span'),
176175
favicon: dom.create.elem('img', {
@@ -189,7 +188,7 @@
189188
settings.save(`${site}Disabled`, !config[`${site}Disabled`]) ; sync.configToUI()
190189
if (env.site == site) { // fade/notify if setting of active site toggled
191190
sync.fade()
192-
if (env.extensionWasDisabled ^ extensionIsDisabled()) notify(`${appName} 🧩 ${
191+
if (env.extensionWasDisabled ^ extensionIsDisabled()) notify(`${app.name} 🧩 ${
193192
getMsg(`state_${ extensionIsDisabled() ? 'off' : 'on' }`).toUpperCase()}`)
194193
}
195194
}
@@ -221,7 +220,7 @@
221220

222221
// Create/append ABOUT footer button
223222
const aboutSpan = dom.create.elem('span', {
224-
title: `${getMsg('menuLabel_about')} ${getMsg('appName')}`,
223+
title: `${getMsg('menuLabel_about')} ${getMsg('app.name')}`,
225224
class: 'menu-icon highlight-on-hover', style: 'right:30px ; padding-top: 2px' })
226225
const aboutIcon = icons.create('questionMark', { width: 15, height: 13, style: 'margin-bottom: 0.04rem' })
227226
aboutSpan.onclick = () => { chrome.runtime.sendMessage({ action: 'showAbout' }) ; close() }

0 commit comments

Comments
 (0)