@kudoai/chatgpt.js 3.6.3 → 3.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,7 @@
3
3
  window.icons = {
4
4
  import(deps) { Object.assign(this.imports = this.imports || {}, deps) },
5
5
 
6
- create({ name, size = 16, width, height, ...additionalAttrs }) {
6
+ create(name, { size = 16, width, height, ...additionalAttrs } = {}) {
7
7
  const iconData = icons[name],
8
8
  iconAttrs = { width: width || size, height: height || size, ...additionalAttrs }
9
9
  if (iconData.type == 'svg') {
@@ -9,16 +9,19 @@ window.modals = {
9
9
  about() {
10
10
 
11
11
  // Show modal
12
+ const labelStyles = 'text-transform: uppercase ; font-size: 17px ; font-weight: bold ;'
13
+ + `color: ${ this.imports.env.ui.scheme == 'dark' ? 'white' : '#494141' }`
12
14
  const aboutModal = this.alert(
13
15
  `${this.imports.app.symbol} ${chrome.runtime.getManifest().name}`, // title
14
- '🧠 Author: ' // msg
15
- + `<a href="${this.imports.app.author.url}">${this.imports.app.author.name}</a> `
16
+ `<span style="${labelStyles}">🧠 Author:</span> `
17
+ + `<a href="${this.imports.app.author.url}">${this.imports.app.author.name}</a> `
16
18
  + `& <a href="${this.imports.app.urls.contributors}">contributors</a>\n`
17
- + `🏷️ Version: <span class="about-em">${this.imports.app.version}</span>\n`
18
- + '📜 Open source code: '
19
+ + `<span style="${labelStyles}">🏷️ Version:</span> `
20
+ + `<span class="about-em">${this.imports.app.version}</span>\n`
21
+ + `<span style="${labelStyles}">📜 Open source code:</span> `
19
22
  + `<a href="${this.imports.app.urls.gitHub}" target="_blank" rel="nopener">`
20
23
  + this.imports.app.urls.gitHub + '</a>\n'
21
- + '⚡ Powered by: '
24
+ + `<span style="${labelStyles}">⚡ Powered by:</span> `
22
25
  + `<a href="${this.imports.app.urls.chatgptJS}" target="_blank" rel="noopener">chatgpt.js</a>`,
23
26
  [ function getSupport(){}, function rateUs(){}, function moreAiExtensions(){} ], // button labels
24
27
  '', 656 // modal width
@@ -12,7 +12,7 @@
12
12
  env.browser.isPortrait = env.browser.isMobile && (window.innerWidth < window.innerHeight)
13
13
 
14
14
  // Import APP data
15
- const { app } = await chrome.storage.sync.get('app')
15
+ const { app } = await chrome.storage.local.get('app')
16
16
 
17
17
  // Export DEPENDENCIES to imported resources
18
18
  dom.import({ env }) // for env.ui.scheme
@@ -24,12 +24,14 @@
24
24
  notify(...['msg', 'pos', 'notifDuration', 'shadow'].map(arg => req.options[arg]))
25
25
  else if (req.action == 'alert')
26
26
  modals.alert(...['title', 'msg', 'btns', 'checkbox', 'width'].map(arg => req.options[arg]))
27
- else if (req.action == 'showAbout') chatgpt.isLoaded().then(() => { modals.open('about') })
28
- else if (req.action == 'syncConfigToUI') syncConfigToUI(req.options)
27
+ else if (req.action == 'showAbout') {
28
+ config.skipAlert = true ; chatgpt.isLoaded().then(() => modals.open('about'))
29
+ } else if (req.action == 'syncConfigToUI') syncConfigToUI(req.options)
29
30
  })
30
31
 
31
32
  // Init SETTINGS
32
- await settings.load(Object.keys(settings.controls), 'skipAlert')
33
+ await settings.load(Object.keys(settings.controls))
34
+ if (!config.skipAlert) await settings.load('skipAlert') // only if not showing About modal
33
35
 
34
36
  // Define FUNCTIONS
35
37
 
@@ -48,7 +50,7 @@
48
50
  const stateStyles = {
49
51
  on: {
50
52
  light: 'color: #5cef48 ; text-shadow: rgba(255,250,169,0.38) 2px 1px 5px',
51
- dark: 'color: #5cef48 ; text-shadow: rgb(55, 255, 0) 3px 0 10px'
53
+ dark: 'color: #5cef48 ; text-shadow: rgb(55,255,0) 3px 0 10px'
52
54
  },
53
55
  off: {
54
56
  light: 'color: #ef4848 ; text-shadow: rgba(255,169,225,0.44) 2px 1px 5px',
@@ -99,7 +101,7 @@
99
101
  modals.alert('≫ ChatGPT extension loaded! 🚀', // title
100
102
  'Success! Press Ctrl+Shift+J to view all chatgpt.js methods.', // msg
101
103
  function getHelp() { // button
102
- chrome.tabs.create({ url: `${app.urls.gitHub}/issues` }) },
104
+ open(`${app.urls.gitHub}/issues`) },
103
105
  function dontShowAgain() { // checkbox
104
106
  settings.save('skipAlert', !config.skipAlert) }
105
107
  )