|
3 | 3 | window.modals = { |
4 | 4 | stack: [], // of types of undismissed modals |
5 | 5 |
|
6 | | - import(dependencies) { // { app, siteAlert } |
7 | | - Object.entries(dependencies).forEach(([name, dependency]) => this[name] = dependency) }, |
| 6 | + dependencies: { |
| 7 | + import(dependencies) { // { app, siteAlert } |
| 8 | + for (const name in dependencies) this[name] = dependencies[name] } |
| 9 | + }, |
8 | 10 |
|
9 | 11 | open(modalType) { |
10 | 12 | this.stack.unshift(modalType) // add to stack |
@@ -71,23 +73,23 @@ window.modals = { |
71 | 73 |
|
72 | 74 | // Init buttons |
73 | 75 | const modalBtns = [ |
74 | | - function getSupport(){ modals.safeWinOpen(`${modals.app.urls.gitHub}/issues`) }, |
75 | | - function rateUs() { modals.safeWinOpen(`${modals.app.urls.gitHub}/discussions`) }, |
76 | | - function moreAiExtensions(){ modals.safeWinOpen(modals.app.urls.relatedExtensions) } |
| 76 | + function getSupport(){ modals.safeWinOpen(`${modals.dependencies.app.urls.gitHub}/issues`) }, |
| 77 | + function rateUs() { modals.safeWinOpen(`${modals.dependencies.app.urls.gitHub}/discussions`) }, |
| 78 | + function moreAiExtensions(){ modals.safeWinOpen(modals.dependencies.app.urls.relatedExtensions) } |
77 | 79 | ] |
78 | 80 |
|
79 | 81 | // Show modal |
80 | | - const aboutModal = this.siteAlert( |
81 | | - `${this.app.symbol} ${chrome.runtime.getManifest().name}`, // title |
| 82 | + const aboutModal = this.dependencies.siteAlert( |
| 83 | + `${this.dependencies.app.symbol} ${chrome.runtime.getManifest().name}`, // title |
82 | 84 | `<span style="${headingStyle}"><b>🏷️ <i>Version</i></b>: </span>` |
83 | | - + `<span style="${pStyle}">${this.app.version}</span>\n` |
| 85 | + + `<span style="${pStyle}">${this.dependencies.app.version}</span>\n` |
84 | 86 | + `<span style="${headingStyle}"><b>⚡ <i>Powered by</i></b>: </span>` |
85 | 87 | + `<span style="${pStyle}">` |
86 | | - + `<a style="${aStyle}" href="${this.app.urls.chatgptJS}" target="_blank" rel="noopener">` |
87 | | - + 'chatgpt.js</a></span>\n' |
| 88 | + + `<a style="${aStyle}" href="${this.dependencies.app.urls.chatgptJS}" target="_blank"` |
| 89 | + + ' rel="noopener">chatgpt.js</a></span>\n' |
88 | 90 | + `<span style="${headingStyle}"><b>📜 <i>Open source code</i></b>:</span>\n` |
89 | | - + `<span style="${pBrStyle}"><a href="${this.app.urls.gitHub}" target="_blank" rel="nopener">` |
90 | | - + this.app.urls.gitHub + '</a></span>', |
| 91 | + + `<span style="${pBrStyle}"><a href="${this.dependencies.app.urls.gitHub}" target="_blank"` |
| 92 | + + ` rel="nopener">${this.dependencies.app.urls.gitHub}</a></span>`, |
91 | 93 | modalBtns, '', 451 |
92 | 94 | ) |
93 | 95 |
|
|
0 commit comments