diff --git a/starters/chrome/extension/components/icons.js b/starters/chrome/extension/components/icons.js
index 6e47916ac..5e18a8a0f 100644
--- a/starters/chrome/extension/components/icons.js
+++ b/starters/chrome/extension/components/icons.js
@@ -2,7 +2,8 @@
window.icons = {
- import(dependencies) { Object.entries(dependencies).forEach(([name, dependency]) => this[name] = dependency) },
+ import(dependencies) { // { app }
+ for (const name in dependencies) this[name] = dependencies[name] },
create({ name, size = 16, width, height, ...additionalAttrs }) {
const iconData = icons[name],
@@ -24,6 +25,6 @@ window.icons = {
questionMark: {
type: 'png',
- get src() { return `${icons.app.urls.assetHost}@b5551ac/images/icons/question-mark/icon16.png` }
+ get src() { return `${icons.dependencies.app.urls.assetHost}@b5551ac/images/icons/question-mark/icon16.png` }
}
};
diff --git a/starters/chrome/extension/components/modals.js b/starters/chrome/extension/components/modals.js
index 9e38edc2c..c75b8c27a 100644
--- a/starters/chrome/extension/components/modals.js
+++ b/starters/chrome/extension/components/modals.js
@@ -3,8 +3,10 @@
window.modals = {
stack: [], // of types of undismissed modals
- import(dependencies) { // { app, siteAlert }
- Object.entries(dependencies).forEach(([name, dependency]) => this[name] = dependency) },
+ dependencies: {
+ import(dependencies) { // { app, siteAlert }
+ for (const name in dependencies) this[name] = dependencies[name] }
+ },
open(modalType) {
this.stack.unshift(modalType) // add to stack
@@ -71,23 +73,23 @@ window.modals = {
// Init buttons
const modalBtns = [
- function getSupport(){ modals.safeWinOpen(`${modals.app.urls.gitHub}/issues`) },
- function rateUs() { modals.safeWinOpen(`${modals.app.urls.gitHub}/discussions`) },
- function moreAiExtensions(){ modals.safeWinOpen(modals.app.urls.relatedExtensions) }
+ function getSupport(){ modals.safeWinOpen(`${modals.dependencies.app.urls.gitHub}/issues`) },
+ function rateUs() { modals.safeWinOpen(`${modals.dependencies.app.urls.gitHub}/discussions`) },
+ function moreAiExtensions(){ modals.safeWinOpen(modals.dependencies.app.urls.relatedExtensions) }
]
// Show modal
- const aboutModal = this.siteAlert(
- `${this.app.symbol} ${chrome.runtime.getManifest().name}`, // title
+ const aboutModal = this.dependencies.siteAlert(
+ `${this.dependencies.app.symbol} ${chrome.runtime.getManifest().name}`, // title
`🏷️ Version: `
- + `${this.app.version}\n`
+ + `${this.dependencies.app.version}\n`
+ `⚡ Powered by: `
+ ``
- + ``
- + 'chatgpt.js\n'
+ + `chatgpt.js\n'
+ `📜 Open source code:\n`
- + ``
- + this.app.urls.gitHub + '',
+ + `${this.dependencies.app.urls.gitHub}`,
modalBtns, '', 451
)
diff --git a/starters/chrome/extension/content.js b/starters/chrome/extension/content.js
index 6a681737b..13655cbcf 100644
--- a/starters/chrome/extension/content.js
+++ b/starters/chrome/extension/content.js
@@ -12,7 +12,7 @@
// Import APP data
const { app } = await chrome.storage.sync.get('app')
- modals.import({ app, siteAlert })
+ modals.dependencies.import({ app, siteAlert })
// Add CHROME MSG listener
chrome.runtime.onMessage.addListener(req => { // from service-worker.js + popup/index.html
diff --git a/starters/chrome/extension/popup/controller.js b/starters/chrome/extension/popup/controller.js
index 7bb1b2130..15763e7e3 100644
--- a/starters/chrome/extension/popup/controller.js
+++ b/starters/chrome/extension/popup/controller.js
@@ -10,7 +10,7 @@
// Import APP data
const { app } = await chrome.storage.sync.get('app')
- icons.import({ app }) // for src's using app.urls.assetHost
+ icons.dependencies.import({ app }) // for src's using app.urls.assetHost
// Define FUNCTIONS