@kudoai/chatgpt.js 2.6.7 → 2.6.8
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.
- package/LICENSE.md +9 -0
- package/README.md +26 -24
- package/chatgpt.js +2056 -2060
- package/dist/chatgpt.min.js +3 -3
- package/docs/README.md +26 -24
- package/docs/SECURITY.md +25 -25
- package/docs/USERGUIDE.md +6 -6
- package/docs/de/LICENSE.md +29 -29
- package/docs/de/README.md +25 -23
- package/docs/de/SECURITY.md +25 -25
- package/docs/es/LICENSE.md +29 -29
- package/docs/es/README.md +25 -23
- package/docs/es/SECURITY.md +25 -25
- package/docs/fr/LICENSE.md +29 -29
- package/docs/fr/README.md +25 -23
- package/docs/fr/SECURITY.md +25 -25
- package/docs/hi/LICENSE.md +29 -29
- package/docs/hi/README.md +25 -23
- package/docs/hi/SECURITY.md +25 -25
- package/docs/it/LICENSE.md +26 -26
- package/docs/it/README.md +25 -23
- package/docs/it/SECURITY.md +25 -25
- package/docs/ja/LICENSE.md +29 -29
- package/docs/ja/README.md +25 -23
- package/docs/ja/SECURITY.md +25 -25
- package/docs/ko/LICENSE.md +32 -32
- package/docs/ko/README.md +25 -23
- package/docs/ko/SECURITY.md +25 -25
- package/docs/ne/LICENSE.md +35 -35
- package/docs/ne/README.md +25 -23
- package/docs/ne/SECURITY.md +25 -25
- package/docs/nl/LICENSE.md +29 -29
- package/docs/nl/README.md +25 -23
- package/docs/nl/SECURITY.md +25 -25
- package/docs/pt/LICENSE.md +28 -28
- package/docs/pt/README.md +25 -23
- package/docs/pt/SECURITY.md +25 -25
- package/docs/vi/LICENSE.md +29 -29
- package/docs/vi/README.md +25 -23
- package/docs/vi/SECURITY.md +25 -25
- package/docs/zh-cn/LICENSE.md +29 -29
- package/docs/zh-cn/README.md +25 -24
- package/docs/zh-cn/SECURITY.md +25 -25
- package/docs/zh-tw/LICENSE.md +29 -29
- package/docs/zh-tw/README.md +26 -24
- package/docs/zh-tw/SECURITY.md +25 -25
- package/package.json +73 -73
- package/starters/chrome/LICENSE.md +31 -43
- package/starters/chrome/docs/README.md +93 -93
- package/starters/chrome/docs/SECURITY.md +17 -17
- package/starters/chrome/docs/de/LICENSE.md +31 -31
- package/starters/chrome/docs/de/README.md +93 -93
- package/starters/chrome/docs/es/LICENSE.md +31 -31
- package/starters/chrome/docs/es/README.md +93 -93
- package/starters/chrome/docs/fr/LICENSE.md +31 -31
- package/starters/chrome/docs/fr/README.md +93 -93
- package/starters/chrome/docs/hi/LICENSE.md +31 -31
- package/starters/chrome/docs/hi/README.md +93 -93
- package/starters/chrome/docs/hi/SECURITY.md +17 -17
- package/starters/chrome/docs/it/LICENSE.md +29 -29
- package/starters/chrome/docs/it/README.md +93 -93
- package/starters/chrome/docs/ja/LICENSE.md +31 -31
- package/starters/chrome/docs/ja/README.md +93 -93
- package/starters/chrome/docs/ko/LICENSE.md +34 -34
- package/starters/chrome/docs/ko/README.md +93 -93
- package/starters/chrome/docs/nl/LICENSE.md +31 -30
- package/starters/chrome/docs/nl/README.md +93 -93
- package/starters/chrome/docs/pt/LICENSE.md +31 -31
- package/starters/chrome/docs/pt/README.md +93 -93
- package/starters/chrome/docs/vi/LICENSE.md +31 -31
- package/starters/chrome/docs/vi/README.md +93 -93
- package/starters/chrome/docs/zh-cn/LICENSE.md +31 -31
- package/starters/chrome/docs/zh-cn/README.md +93 -93
- package/starters/chrome/docs/zh-cn/SECURITY.md +17 -17
- package/starters/chrome/docs/zh-tw/LICENSE.md +31 -31
- package/starters/chrome/docs/zh-tw/README.md +93 -93
- package/starters/chrome/extension/background.js +14 -14
- package/starters/chrome/extension/content.js +62 -62
- package/starters/chrome/extension/lib/chatgpt.js +2057 -2061
- package/starters/chrome/extension/lib/settings-utils.js +24 -24
- package/starters/chrome/extension/manifest.json +24 -24
- package/starters/chrome/extension/popup/index.html +62 -62
- package/starters/chrome/extension/popup/popup.js +92 -92
- package/starters/chrome/extension/popup/style.css +55 -55
- package/starters/docs/LICENSE.md +13 -25
- package/starters/docs/README.md +29 -29
- package/starters/docs/de/LICENSE.md +13 -13
- package/starters/docs/de/README.md +29 -29
- package/starters/docs/es/LICENSE.md +13 -13
- package/starters/docs/es/README.md +29 -29
- package/starters/docs/fr/LICENSE.md +13 -13
- package/starters/docs/fr/README.md +29 -29
- package/starters/docs/hi/LICENSE.md +13 -13
- package/starters/docs/hi/README.md +29 -29
- package/starters/docs/it/LICENSE.md +11 -11
- package/starters/docs/it/README.md +29 -29
- package/starters/docs/ja/LICENSE.md +13 -13
- package/starters/docs/ja/README.md +30 -30
- package/starters/docs/ko/LICENSE.md +16 -16
- package/starters/docs/ko/README.md +29 -29
- package/starters/docs/nl/LICENSE.md +13 -13
- package/starters/docs/nl/README.md +29 -29
- package/starters/docs/pt/LICENSE.md +13 -13
- package/starters/docs/pt/README.md +29 -29
- package/starters/docs/vi/LICENSE.md +13 -13
- package/starters/docs/vi/README.md +29 -29
- package/starters/docs/zh-cn/LICENSE.md +13 -13
- package/starters/docs/zh-cn/README.md +30 -30
- package/starters/docs/zh-tw/LICENSE.md +13 -13
- package/starters/docs/zh-tw/README.md +29 -29
- package/starters/greasemonkey/LICENSE.md +31 -43
- package/starters/greasemonkey/chatgpt.js-greasemonkey-starter.user.js +5 -5
- package/starters/greasemonkey/docs/README.md +7 -7
- package/starters/greasemonkey/docs/SECURITY.md +17 -17
- package/starters/greasemonkey/docs/de/LICENSE.md +31 -31
- package/starters/greasemonkey/docs/es/LICENSE.md +31 -31
- package/starters/greasemonkey/docs/fr/LICENSE.md +31 -31
- package/starters/greasemonkey/docs/hi/LICENSE.md +31 -31
- package/starters/greasemonkey/docs/hi/SECURITY.md +17 -17
- package/starters/greasemonkey/docs/it/LICENSE.md +29 -29
- package/starters/greasemonkey/docs/ja/LICENSE.md +31 -31
- package/starters/greasemonkey/docs/ko/LICENSE.md +34 -34
- package/starters/greasemonkey/docs/nl/LICENSE.md +31 -30
- package/starters/greasemonkey/docs/pt/LICENSE.md +31 -31
- package/starters/greasemonkey/docs/vi/LICENSE.md +31 -31
- package/starters/greasemonkey/docs/zh-cn/LICENSE.md +31 -31
- package/starters/greasemonkey/docs/zh-cn/SECURITY.md +17 -17
- package/starters/greasemonkey/docs/zh-tw/LICENSE.md +31 -31
- package/LICENSE +0 -21
|
@@ -1,93 +1,93 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
<h6>
|
|
3
|
-
<picture>
|
|
4
|
-
<source type="image/svg+xml" media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/KudoAI/chatgpt.js/main/media/images/icons/earth-americas-white-icon32.svg">
|
|
5
|
-
<img height=14 src="https://raw.githubusercontent.com/KudoAI/chatgpt.js/main/media/images/icons/earth-americas-icon32.svg">
|
|
6
|
-
</picture>
|
|
7
|
-
繁體中文 |
|
|
8
|
-
<a href="../..#readme">English</a> |
|
|
9
|
-
<a href="../zh-cn#readme">简体中文</a> |
|
|
10
|
-
<a href="../ja#readme">日本</a> |
|
|
11
|
-
<a href="../ko#readme">한국인</a> |
|
|
12
|
-
<a href="../hi#readme">हिंदी</a> |
|
|
13
|
-
<a href="../de#readme">Deutsch</a> |
|
|
14
|
-
<a href="../es#readme">Español</a> |
|
|
15
|
-
<a href="../fr#readme">Français</a> |
|
|
16
|
-
<a href="../it#readme">Italiano</a> |
|
|
17
|
-
<a href="../nl#readme">Nederlands</a> |
|
|
18
|
-
<a href="../pt#readme">Português</a> |
|
|
19
|
-
<a href="../vi#readme">Việt</a>
|
|
20
|
-
</h6>
|
|
21
|
-
</div>
|
|
22
|
-
|
|
23
|
-
# <img height=21 src="https://www.google.com/chrome/static/images/favicons/apple-icon-60x60.png"> chatgpt.js-chrome-starter
|
|
24
|
-
|
|
25
|
-
<h3>使用 <a href="https://github.com/KudoAI/chatgpt.js">chatgpt.js</a> 開發自己的 Chrome 擴展程序的起點</h3>
|
|
26
|
-
|
|
27
|
-
<br>
|
|
28
|
-
|
|
29
|
-
<img src="../../media/images/screenshots/extension-loaded.png">
|
|
30
|
-
|
|
31
|
-
## ⚡ 安裝
|
|
32
|
-
|
|
33
|
-
1. 點擊 **Fork** -或者- **Use this template** > **Create a new repository** 在 https://github.com/KudoAI/chatgpt.js-chrome-starter
|
|
34
|
-
|
|
35
|
-
2. **Clone** 您在本地新創建的存儲庫
|
|
36
|
-
|
|
37
|
-
3. 在 Chrome(或任何 Chromium 瀏覽器)中訪問 `chrome://extensions`
|
|
38
|
-
|
|
39
|
-
4. 確保 **Developer mode** 開關已激活<br>
|
|
40
|
-

|
|
41
|
-
|
|
42
|
-
5. 點擊 **Load unpacked**<br><br>
|
|
43
|
-
<img src="../../media/images/screenshots/load-unpacked-button.png">
|
|
44
|
-
<br>
|
|
45
|
-
|
|
46
|
-
6. 在彈出窗口中,選擇 **extension** 文件夾 > 點擊 **Select Folder**<br><br><br>
|
|
47
|
-
<img src="../../media/images/screenshots/select-extension-folder.png"><br><br>
|
|
48
|
-
|
|
49
|
-
就是這樣! **ChatGPT Extension** 現在將出現在擴展列表中:
|
|
50
|
-
|
|
51
|
-
<br>
|
|
52
|
-
|
|
53
|
-
<img src="../../media/images/screenshots/chatgpt-extension-in-list.png">
|
|
54
|
-
|
|
55
|
-
<p><br>
|
|
56
|
-
|
|
57
|
-
**💡 建議:** _要反映源代碼的更改,請點擊擴展磁貼上的 **重新加載** + 重新加載正在運行的任何 Chrome 選項卡擴展腳本:_
|
|
58
|
-
|
|
59
|
-
<div align="center">
|
|
60
|
-
|
|
61
|
-
<br>
|
|
62
|
-
|
|
63
|
-
<img src="../../media/images/screenshots/reload-extension-button.png">
|
|
64
|
-
<img src="../../media/images/screenshots/reload-page-button.png">
|
|
65
|
-
|
|
66
|
-
<p><br>
|
|
67
|
-
|
|
68
|
-
</div>
|
|
69
|
-
|
|
70
|
-
## 🤖 用 chatgpt.js 製作
|
|
71
|
-
|
|
72
|
-
以下是 Google 提供的一些使用 chatgpt.js 的擴展:
|
|
73
|
-
|
|
74
|
-
<div align="center">
|
|
75
|
-
|
|
76
|
-
<br>
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
<a href="https://chatgptinfinity.com" target="_blank" rel="noopener">
|
|
80
|
-
<img width=777 src="https://raw.githubusercontent.com/adamlui/chatgpt-infinity/main/chrome/media/images/tiles/marquee-promo-tile-1400x560.png">
|
|
81
|
-
</a>
|
|
82
|
-
|
|
83
|
-
<p><br>
|
|
84
|
-
|
|
85
|
-
<a href="https://chatgptwidescreen.com" target="_blank" rel="noopener">
|
|
86
|
-
<img width=777 src="https://raw.githubusercontent.com/adamlui/chatgpt-widescreen/main/chrome/media/images/tiles/marquee-promo-tile-1400x560.png">
|
|
87
|
-
</a>
|
|
88
|
-
|
|
89
|
-
</div>
|
|
90
|
-
|
|
91
|
-
#
|
|
92
|
-
|
|
93
|
-
<a href="https://github.com/KudoAI/chatgpt.js-chrome-starter/issues">得到幫助</a> / <a href="#">回到頂部 ↑</a>
|
|
1
|
+
<div align="center">
|
|
2
|
+
<h6>
|
|
3
|
+
<picture>
|
|
4
|
+
<source type="image/svg+xml" media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/KudoAI/chatgpt.js/main/media/images/icons/earth-americas-white-icon32.svg">
|
|
5
|
+
<img height=14 src="https://raw.githubusercontent.com/KudoAI/chatgpt.js/main/media/images/icons/earth-americas-icon32.svg">
|
|
6
|
+
</picture>
|
|
7
|
+
繁體中文 |
|
|
8
|
+
<a href="../..#readme">English</a> |
|
|
9
|
+
<a href="../zh-cn#readme">简体中文</a> |
|
|
10
|
+
<a href="../ja#readme">日本</a> |
|
|
11
|
+
<a href="../ko#readme">한국인</a> |
|
|
12
|
+
<a href="../hi#readme">हिंदी</a> |
|
|
13
|
+
<a href="../de#readme">Deutsch</a> |
|
|
14
|
+
<a href="../es#readme">Español</a> |
|
|
15
|
+
<a href="../fr#readme">Français</a> |
|
|
16
|
+
<a href="../it#readme">Italiano</a> |
|
|
17
|
+
<a href="../nl#readme">Nederlands</a> |
|
|
18
|
+
<a href="../pt#readme">Português</a> |
|
|
19
|
+
<a href="../vi#readme">Việt</a>
|
|
20
|
+
</h6>
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
# <img height=21 src="https://www.google.com/chrome/static/images/favicons/apple-icon-60x60.png"> chatgpt.js-chrome-starter
|
|
24
|
+
|
|
25
|
+
<h3>使用 <a href="https://github.com/KudoAI/chatgpt.js">chatgpt.js</a> 開發自己的 Chrome 擴展程序的起點</h3>
|
|
26
|
+
|
|
27
|
+
<br>
|
|
28
|
+
|
|
29
|
+
<img src="../../media/images/screenshots/extension-loaded.png">
|
|
30
|
+
|
|
31
|
+
## ⚡ 安裝
|
|
32
|
+
|
|
33
|
+
1. 點擊 **Fork** -或者- **Use this template** > **Create a new repository** 在 https://github.com/KudoAI/chatgpt.js-chrome-starter
|
|
34
|
+
|
|
35
|
+
2. **Clone** 您在本地新創建的存儲庫
|
|
36
|
+
|
|
37
|
+
3. 在 Chrome(或任何 Chromium 瀏覽器)中訪問 `chrome://extensions`
|
|
38
|
+
|
|
39
|
+
4. 確保 **Developer mode** 開關已激活<br>
|
|
40
|
+

|
|
41
|
+
|
|
42
|
+
5. 點擊 **Load unpacked**<br><br>
|
|
43
|
+
<img src="../../media/images/screenshots/load-unpacked-button.png">
|
|
44
|
+
<br>
|
|
45
|
+
|
|
46
|
+
6. 在彈出窗口中,選擇 **extension** 文件夾 > 點擊 **Select Folder**<br><br><br>
|
|
47
|
+
<img src="../../media/images/screenshots/select-extension-folder.png"><br><br>
|
|
48
|
+
|
|
49
|
+
就是這樣! **ChatGPT Extension** 現在將出現在擴展列表中:
|
|
50
|
+
|
|
51
|
+
<br>
|
|
52
|
+
|
|
53
|
+
<img src="../../media/images/screenshots/chatgpt-extension-in-list.png">
|
|
54
|
+
|
|
55
|
+
<p><br>
|
|
56
|
+
|
|
57
|
+
**💡 建議:** _要反映源代碼的更改,請點擊擴展磁貼上的 **重新加載** + 重新加載正在運行的任何 Chrome 選項卡擴展腳本:_
|
|
58
|
+
|
|
59
|
+
<div align="center">
|
|
60
|
+
|
|
61
|
+
<br>
|
|
62
|
+
|
|
63
|
+
<img src="../../media/images/screenshots/reload-extension-button.png">
|
|
64
|
+
<img src="../../media/images/screenshots/reload-page-button.png">
|
|
65
|
+
|
|
66
|
+
<p><br>
|
|
67
|
+
|
|
68
|
+
</div>
|
|
69
|
+
|
|
70
|
+
## 🤖 用 chatgpt.js 製作
|
|
71
|
+
|
|
72
|
+
以下是 Google 提供的一些使用 chatgpt.js 的擴展:
|
|
73
|
+
|
|
74
|
+
<div align="center">
|
|
75
|
+
|
|
76
|
+
<br>
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
<a href="https://chatgptinfinity.com" target="_blank" rel="noopener">
|
|
80
|
+
<img width=777 src="https://raw.githubusercontent.com/adamlui/chatgpt-infinity/main/chrome/media/images/tiles/marquee-promo-tile-1400x560.png">
|
|
81
|
+
</a>
|
|
82
|
+
|
|
83
|
+
<p><br>
|
|
84
|
+
|
|
85
|
+
<a href="https://chatgptwidescreen.com" target="_blank" rel="noopener">
|
|
86
|
+
<img width=777 src="https://raw.githubusercontent.com/adamlui/chatgpt-widescreen/main/chrome/media/images/tiles/marquee-promo-tile-1400x560.png">
|
|
87
|
+
</a>
|
|
88
|
+
|
|
89
|
+
</div>
|
|
90
|
+
|
|
91
|
+
#
|
|
92
|
+
|
|
93
|
+
<a href="https://github.com/KudoAI/chatgpt.js-chrome-starter/issues">得到幫助</a> / <a href="#">回到頂部 ↑</a>
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
const allowedHosts = ['chat.openai.com'];
|
|
2
|
-
|
|
3
|
-
// Add install/update actions
|
|
4
|
-
chrome.runtime.onInstalled.addListener((details) => {
|
|
5
|
-
chrome.storage.local.set({ 'chatgptJS_extensionDisabled': false }); // auto-enable
|
|
6
|
-
if (details.reason == 'install') chrome.tabs.create({ url: 'https://chat.openai.com/' }); // open ChatGPT
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
// Sync extension state/settings when ChatGPT tab active
|
|
10
|
-
chrome.tabs.onActivated.addListener((activeInfo) => {
|
|
11
|
-
chrome.tabs.get(activeInfo.tabId, (tab) => {
|
|
12
|
-
if (allowedHosts.includes(new URL(tab.url).hostname)) {
|
|
13
|
-
chrome.tabs.sendMessage(tab.id, { action: 'syncExtension' });
|
|
14
|
-
}});});
|
|
1
|
+
const allowedHosts = ['chat.openai.com'];
|
|
2
|
+
|
|
3
|
+
// Add install/update actions
|
|
4
|
+
chrome.runtime.onInstalled.addListener((details) => {
|
|
5
|
+
chrome.storage.local.set({ 'chatgptJS_extensionDisabled': false }); // auto-enable
|
|
6
|
+
if (details.reason == 'install') chrome.tabs.create({ url: 'https://chat.openai.com/' }); // open ChatGPT
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
// Sync extension state/settings when ChatGPT tab active
|
|
10
|
+
chrome.tabs.onActivated.addListener((activeInfo) => {
|
|
11
|
+
chrome.tabs.get(activeInfo.tabId, (tab) => {
|
|
12
|
+
if (allowedHosts.includes(new URL(tab.url).hostname)) {
|
|
13
|
+
chrome.tabs.sendMessage(tab.id, { action: 'syncExtension' });
|
|
14
|
+
}});});
|
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
// NOTE: This script relies on the powerful chatgpt.js library @ https://chatgpt.js.org
|
|
2
|
-
//
|
|
3
|
-
// Source: https://github.com/KudoAI/chatgpt.js
|
|
4
|
-
// Latest minified release: https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js/chatgpt.min.js
|
|
5
|
-
|
|
6
|
-
(async () => {
|
|
7
|
-
|
|
8
|
-
// Import libs
|
|
9
|
-
const { config, settings } = await import(chrome.runtime.getURL('lib/settings-utils.js'));
|
|
10
|
-
const { chatgpt } = await import(chrome.runtime.getURL('lib/chatgpt.js'));
|
|
11
|
-
|
|
12
|
-
// Add Chrome action msg listener
|
|
13
|
-
chrome.runtime.onMessage.addListener((request) => {
|
|
14
|
-
if (request.action === 'notify') notify(request.msg, request.position);
|
|
15
|
-
else if (request.action === 'alert') alert(request.title, request.msg, request.btns);
|
|
16
|
-
else if (typeof window[request.action] === 'function') {
|
|
17
|
-
const args = Array.isArray(request.args) ? request.args // preserve array if supplied
|
|
18
|
-
: request.args !== undefined ? [request.args] : []; // convert to array if single or no arg
|
|
19
|
-
window[request.action](...args); // call expression functions
|
|
20
|
-
}
|
|
21
|
-
return true;
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
await chatgpt.isLoaded();
|
|
25
|
-
chatgpt.printAllFunctions(); // to console
|
|
26
|
-
settings.load('skipAlert').then(() => {
|
|
27
|
-
if (!config.skipAlert) {
|
|
28
|
-
chatgpt.alert('≫ ChatGPT extension loaded! 🚀', // title
|
|
29
|
-
'Success! Press Ctrl+Shift+J to view all chatgpt.js methods.', // msg
|
|
30
|
-
function getHelp() { // button
|
|
31
|
-
window.open(config.ghRepoURL + '/issues', '_blank', 'noopener'); },
|
|
32
|
-
function dontShowAgain() { // checkbox
|
|
33
|
-
settings.save('skipAlert', !config.skipAlert); }
|
|
34
|
-
);}});
|
|
35
|
-
|
|
36
|
-
// Your code here...
|
|
37
|
-
// Your code here...
|
|
38
|
-
// Your code here...
|
|
39
|
-
// Your code here...
|
|
40
|
-
// Your code here...
|
|
41
|
-
// Your code here...
|
|
42
|
-
|
|
43
|
-
// Define FEEDBACK functions
|
|
44
|
-
|
|
45
|
-
function notify(msg, position = '', notifDuration = '', shadow = '') {
|
|
46
|
-
chatgpt.notify(`${ config.appSymbol } ${ msg }`, position, notifDuration,
|
|
47
|
-
shadow || chatgpt.isDarkMode() ? '' : 'shadow' ); }
|
|
48
|
-
|
|
49
|
-
function alert(title = '', msg = '', btns = '', checkbox = '', width = '') {
|
|
50
|
-
return chatgpt.alert(`${ config.appSymbol } ${ title }`, msg, btns, checkbox, width );}
|
|
51
|
-
|
|
52
|
-
// Define SYNC function
|
|
53
|
-
|
|
54
|
-
syncExtension = () => {
|
|
55
|
-
settings.load('extensionDisabled').then(() => {
|
|
56
|
-
if (config.extensionDisabled) {
|
|
57
|
-
// remove your hacks
|
|
58
|
-
} else {
|
|
59
|
-
// sync each potentially updated setting passed to settings.load()
|
|
60
|
-
}});};
|
|
61
|
-
|
|
62
|
-
})();
|
|
1
|
+
// NOTE: This script relies on the powerful chatgpt.js library @ https://chatgpt.js.org
|
|
2
|
+
// © 2023–2024 KudoAI & contributors under the MIT license
|
|
3
|
+
// Source: https://github.com/KudoAI/chatgpt.js
|
|
4
|
+
// Latest minified release: https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js/chatgpt.min.js
|
|
5
|
+
|
|
6
|
+
(async () => {
|
|
7
|
+
|
|
8
|
+
// Import libs
|
|
9
|
+
const { config, settings } = await import(chrome.runtime.getURL('lib/settings-utils.js'));
|
|
10
|
+
const { chatgpt } = await import(chrome.runtime.getURL('lib/chatgpt.js'));
|
|
11
|
+
|
|
12
|
+
// Add Chrome action msg listener
|
|
13
|
+
chrome.runtime.onMessage.addListener((request) => {
|
|
14
|
+
if (request.action === 'notify') notify(request.msg, request.position);
|
|
15
|
+
else if (request.action === 'alert') alert(request.title, request.msg, request.btns);
|
|
16
|
+
else if (typeof window[request.action] === 'function') {
|
|
17
|
+
const args = Array.isArray(request.args) ? request.args // preserve array if supplied
|
|
18
|
+
: request.args !== undefined ? [request.args] : []; // convert to array if single or no arg
|
|
19
|
+
window[request.action](...args); // call expression functions
|
|
20
|
+
}
|
|
21
|
+
return true;
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
await chatgpt.isLoaded();
|
|
25
|
+
chatgpt.printAllFunctions(); // to console
|
|
26
|
+
settings.load('skipAlert').then(() => {
|
|
27
|
+
if (!config.skipAlert) {
|
|
28
|
+
chatgpt.alert('≫ ChatGPT extension loaded! 🚀', // title
|
|
29
|
+
'Success! Press Ctrl+Shift+J to view all chatgpt.js methods.', // msg
|
|
30
|
+
function getHelp() { // button
|
|
31
|
+
window.open(config.ghRepoURL + '/issues', '_blank', 'noopener'); },
|
|
32
|
+
function dontShowAgain() { // checkbox
|
|
33
|
+
settings.save('skipAlert', !config.skipAlert); }
|
|
34
|
+
);}});
|
|
35
|
+
|
|
36
|
+
// Your code here...
|
|
37
|
+
// Your code here...
|
|
38
|
+
// Your code here...
|
|
39
|
+
// Your code here...
|
|
40
|
+
// Your code here...
|
|
41
|
+
// Your code here...
|
|
42
|
+
|
|
43
|
+
// Define FEEDBACK functions
|
|
44
|
+
|
|
45
|
+
function notify(msg, position = '', notifDuration = '', shadow = '') {
|
|
46
|
+
chatgpt.notify(`${ config.appSymbol } ${ msg }`, position, notifDuration,
|
|
47
|
+
shadow || chatgpt.isDarkMode() ? '' : 'shadow' ); }
|
|
48
|
+
|
|
49
|
+
function alert(title = '', msg = '', btns = '', checkbox = '', width = '') {
|
|
50
|
+
return chatgpt.alert(`${ config.appSymbol } ${ title }`, msg, btns, checkbox, width );}
|
|
51
|
+
|
|
52
|
+
// Define SYNC function
|
|
53
|
+
|
|
54
|
+
syncExtension = () => {
|
|
55
|
+
settings.load('extensionDisabled').then(() => {
|
|
56
|
+
if (config.extensionDisabled) {
|
|
57
|
+
// remove your hacks
|
|
58
|
+
} else {
|
|
59
|
+
// sync each potentially updated setting passed to settings.load()
|
|
60
|
+
}});};
|
|
61
|
+
|
|
62
|
+
})();
|