@kudoai/chatgpt.js 3.6.1 → 3.6.3
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/README.md +7 -7
- package/chatgpt.js +119 -102
- package/dist/chatgpt.min.js +64 -16
- package/docs/README.md +7 -7
- package/docs/USERGUIDE.md +3 -3
- package/package.json +2 -2
- package/starters/chrome/extension/lib/chatgpt.js +119 -102
- package/starters/chrome/extension/manifest.json +1 -1
- package/starters/greasemonkey/chatgpt.js-greasemonkey-starter.user.js +2 -2
|
@@ -133,49 +133,53 @@ const chatgpt = {
|
|
|
133
133
|
modalMessage = document.createElement('p');
|
|
134
134
|
|
|
135
135
|
// Create/append/update modal style (if missing or outdated)
|
|
136
|
-
const thisUpdated =
|
|
137
|
-
let modalStyle = document.querySelector('#chatgpt-modal-style')
|
|
136
|
+
const thisUpdated = 1739338889852 // timestamp of last edit for this file's `modalStyle`
|
|
137
|
+
let modalStyle = document.querySelector('#chatgpt-modal-style') // try to select existing style
|
|
138
138
|
if (!modalStyle || parseInt(modalStyle.getAttribute('last-updated'), 10) < thisUpdated) { // if missing or outdated
|
|
139
139
|
if (!modalStyle) { // outright missing, create/id/attr/append it first
|
|
140
|
-
modalStyle = document.createElement('style'); modalStyle.id = 'chatgpt-modal-style'
|
|
141
|
-
modalStyle.setAttribute('last-updated', thisUpdated.toString())
|
|
142
|
-
document.head.append(modalStyle)
|
|
140
|
+
modalStyle = document.createElement('style') ; modalStyle.id = 'chatgpt-modal-style'
|
|
141
|
+
modalStyle.setAttribute('last-updated', thisUpdated.toString())
|
|
142
|
+
document.head.append(modalStyle)
|
|
143
143
|
}
|
|
144
144
|
modalStyle.innerText = ( // update prev/new style contents
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
145
|
+
`.chatgpt-modal { /* vars */
|
|
146
|
+
--transition: opacity 0.65s cubic-bezier(.165,.84,.44,1), /* for fade-in */
|
|
147
|
+
transform 0.55s cubic-bezier(.165,.84,.44,1) ; /* for move-in */
|
|
148
|
+
--bg-transition: background-color 0.25s ease ; /* for bg dim */
|
|
149
|
+
--btn-transition: transform 0.1s ease-in-out, box-shadow 0.1s ease-in-out ; /* for smooth zoom */
|
|
150
|
+
--btn-shadow: 2px 1px ${ scheme == 'dark' ? '54px #00cfff' : '30px #9cdaff' }}`
|
|
149
151
|
|
|
150
152
|
+ '.no-mobile-tap-outline { outline: none ; -webkit-tap-highlight-color: transparent }'
|
|
151
153
|
|
|
152
154
|
// Background styles
|
|
153
|
-
+
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
155
|
+
+ `.chatgpt-modal {
|
|
156
|
+
pointer-events: auto ; /* override any disabling from site modals (like guest login spam) */
|
|
157
|
+
position: fixed ; top: 0 ; left: 0 ; width: 100% ; height: 100% ; /* expand to full view-port */
|
|
158
|
+
display: flex ; justify-content: center ; align-items: center ; z-index: 9999 ; /* align */
|
|
159
|
+
transition: var(--bg-transition) ; /* for bg dim */
|
|
160
|
+
-webkit-transition: var(--bg-transition) ; -moz-transition: var(--bg-transition) ;
|
|
161
|
+
-o-transition: var(--bg-transition) ; -ms-transition: var(--bg-transition) }`
|
|
160
162
|
|
|
161
163
|
// Alert styles
|
|
162
|
-
+
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
164
|
+
+ `.chatgpt-modal > div {
|
|
165
|
+
position: absolute ; /* to be click-draggable */
|
|
166
|
+
opacity: 0 ; /* to fade-in */
|
|
167
|
+
font-family: -apple-system, system-ui, BlinkMacSystemFont, Segoe UI, Roboto,
|
|
168
|
+
Oxygen-Sans, Ubuntu, Cantarell, Helvetica Neue, sans-serif ;
|
|
169
|
+
padding: 20px ; margin: 12px 23px ; font-size: 20px ;
|
|
170
|
+
color: ${ scheme == 'dark' ? 'white' : 'black' };
|
|
171
|
+
background-color: ${ scheme == 'dark' ? 'black' : 'white' };
|
|
172
|
+
border: 1px solid ${ scheme == 'dark' ? 'white' : '#b5b5b5' };
|
|
173
|
+
transform: translateX(-3px) translateY(7px) ; /* offset to move-in from */
|
|
174
|
+
max-width: 75vw ; word-wrap: break-word ; border-radius: 15px ;
|
|
175
|
+
--shadow: 0 30px 60px rgba(0,0,0,0.12) ; box-shadow: var(--shadow) ;
|
|
176
|
+
-webkit-box-shadow: var(--shadow) ; -moz-box-shadow: var(--shadow) ;
|
|
177
|
+
user-select: none ; -webkit-user-select: none ; -moz-user-select: none ;
|
|
178
|
+
-o-user-select: none ; -ms-user-select: none ;
|
|
179
|
+
transition: var(--transition) ; /* for fade-in + move-in */
|
|
180
|
+
-webkit-transition: var(--transition) ; -moz-transition: var(--transition) ;
|
|
181
|
+
-o-transition: var(--transition) ; -ms-transition: var(--transition) }
|
|
182
|
+
.chatgpt-modal h2 { font-weight: bold ; font-size: 24px ; margin-bottom: 9px }
|
|
179
183
|
.chatgpt-modal a { color: ${ scheme == 'dark' ? '#00cfff' : '#1e9ebb' }}
|
|
180
184
|
.chatgpt-modal a:hover { text-decoration: underline }
|
|
181
185
|
.chatgpt-modal.animated > div {
|
|
@@ -185,39 +189,44 @@ const chatgpt = {
|
|
|
185
189
|
100% { opacity: 0 ; transform: scale(1.35) }}`
|
|
186
190
|
|
|
187
191
|
// Button styles
|
|
188
|
-
+
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
box-shadow: var(--
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
192
|
+
+ `.modal-buttons {
|
|
193
|
+
display: flex ; justify-content: flex-end ; margin: 20px -5px -3px 0 ;
|
|
194
|
+
${ isMobile ? 'flex-direction: column-reverse' : '' }}
|
|
195
|
+
.chatgpt-modal button {
|
|
196
|
+
font-size: 14px ; text-transform: uppercase ;
|
|
197
|
+
margin-left: ${ isMobile ? 0 : 10 }px ; padding: ${ isMobile ? 15 : 8 }px 18px ;
|
|
198
|
+
${ isMobile ? 'margin-top: 5px ; margin-bottom: 3px ;' : '' }
|
|
199
|
+
border-radius: 0 ; border: 1px solid ${ scheme == 'dark' ? 'white' : 'black' };
|
|
200
|
+
transition: var(--btn-transition) ;
|
|
201
|
+
-webkit-transition: var(--btn-transition) ; -moz-transition: var(--btn-transition) ;
|
|
202
|
+
-o-transition: var(--btn-transition) ; -ms-transition: var(--btn-transition) }
|
|
203
|
+
.chatgpt-modal button:hover {
|
|
204
|
+
transform: scale(1.055) ; color: black ;
|
|
205
|
+
background-color: #${ scheme == 'dark' ? '00cfff' : '9cdaff' };
|
|
206
|
+
box-shadow: var(--btn-shadow) ;
|
|
207
|
+
-webkit-box-shadow: var(--btn-shadow) ; -moz-box-shadow: var(--btn-shadow) }
|
|
208
|
+
.primary-modal-btn {
|
|
209
|
+
border: 1px solid ${ scheme == 'dark' ? 'white' : 'black' };
|
|
210
|
+
background: ${ scheme == 'dark' ? 'white' : 'black' };
|
|
211
|
+
color: ${ scheme == 'dark' ? 'black' : 'white' }}
|
|
212
|
+
.modal-close-btn {
|
|
213
|
+
cursor: pointer ; width: 29px ; height: 29px ; border-radius: 17px ;
|
|
214
|
+
float: right ; position: relative ; right: -6px ; top: -5px }
|
|
215
|
+
.modal-close-btn svg { margin: 10px } /* center SVG for hover underlay */
|
|
216
|
+
.modal-close-btn:hover { background-color: #f2f2f2${ scheme == 'dark' ? '00' : '' }}`
|
|
208
217
|
|
|
209
218
|
// Checkbox styles
|
|
210
|
-
+ `.chatgpt-modal .checkbox-group { margin
|
|
211
|
-
.chatgpt-modal
|
|
212
|
-
|
|
213
|
-
color: ${ scheme == 'dark' ? '#e1e1e1' : '#1e1e1e' }}
|
|
214
|
-
.chatgpt-modal input[type=checkbox] { transform: scale(0.7) ;
|
|
219
|
+
+ `.chatgpt-modal .checkbox-group { margin: 5px 0 -8px 5px }
|
|
220
|
+
.chatgpt-modal input[type=checkbox] {
|
|
221
|
+
cursor: pointer ; transform: scale(0.7) ; margin-right: 5px ;
|
|
215
222
|
border: 1px solid ${ scheme == 'dark' ? 'white' : 'black' }}
|
|
216
223
|
.chatgpt-modal input[type=checkbox]:checked {
|
|
217
|
-
|
|
218
|
-
|
|
224
|
+
background-color: black ; position: inherit ;
|
|
225
|
+
border: 1px solid ${ scheme == 'dark' ? 'white' : 'black' }}
|
|
219
226
|
.chatgpt-modal input[type=checkbox]:focus {
|
|
220
|
-
outline: none ; box-shadow: none ; -webkit-box-shadow: none ; -moz-box-shadow: none }
|
|
227
|
+
outline: none ; box-shadow: none ; -webkit-box-shadow: none ; -moz-box-shadow: none }
|
|
228
|
+
.chatgpt-modal .checkbox-group label {
|
|
229
|
+
font-size: 14px ; color: ${ scheme == 'dark' ? '#e1e1e1' : '#1e1e1e' }}`
|
|
221
230
|
)
|
|
222
231
|
}
|
|
223
232
|
|
|
@@ -950,7 +959,12 @@ const chatgpt = {
|
|
|
950
959
|
getLastResponse() { return chatgpt.getChatData('active', 'msg', 'chatgpt', 'latest'); },
|
|
951
960
|
|
|
952
961
|
getNewChatButton() {
|
|
953
|
-
return document.querySelector(
|
|
962
|
+
return document.querySelector(
|
|
963
|
+
'button[data-testid*=new-chat-button],' // sidebar button (when logged in)
|
|
964
|
+
+ 'button:has([d^="M3.06957"]),' // Cycle Arrows icon (Temp chat mode)
|
|
965
|
+
+ 'button:has([d^="M15.6729"])' // Pencil icon (recorded chat mode)
|
|
966
|
+
)
|
|
967
|
+
},
|
|
954
968
|
|
|
955
969
|
getNewChatLink() { return document.querySelector('nav a[href="/"]'); },
|
|
956
970
|
getRegenerateButton() { return document.querySelector('button:has([d^="M3.06957"])'); },
|
|
@@ -1983,7 +1997,7 @@ for (const btnAction of cjsBtnActions) {
|
|
|
1983
1997
|
};
|
|
1984
1998
|
}
|
|
1985
1999
|
|
|
1986
|
-
// Create
|
|
2000
|
+
// Create ALIAS functions
|
|
1987
2001
|
const cjsFuncAliases = [
|
|
1988
2002
|
['actAs', 'actas', 'act', 'become', 'persona', 'premadePrompt', 'preMadePrompt', 'prePrompt', 'preprompt', 'roleplay', 'rolePlay', 'rp'],
|
|
1989
2003
|
['activateAutoRefresh', 'activateAutoRefresher', 'activateRefresher', 'activateSessionRefresher',
|
|
@@ -1996,14 +2010,13 @@ const cjsFuncAliases = [
|
|
|
1996
2010
|
['exportChat', 'chatExport', 'export'],
|
|
1997
2011
|
['getFooterDiv', 'getFooter'],
|
|
1998
2012
|
['getHeaderDiv', 'getHeader'],
|
|
1999
|
-
['getLastPrompt', 'getLastQuery', '
|
|
2013
|
+
['getLastPrompt', 'getLastQuery', 'getMyLastMessage', 'getMyLastQuery'],
|
|
2000
2014
|
['getContinueButton', 'getContinueGeneratingButton'],
|
|
2001
2015
|
['getScrollToBottomButton', 'getScrollButton'],
|
|
2002
2016
|
['getStopButton', 'getStopGeneratingButton'],
|
|
2003
2017
|
['getTextarea', 'getTextArea', 'getChatbar', 'getChatBar', 'getChatbox', 'getChatBox'],
|
|
2004
2018
|
['isFullScreen', 'isFullscreen', 'isfullscreen'],
|
|
2005
|
-
['
|
|
2006
|
-
['logOut', 'logout', 'logOff', 'logoff', 'signOut', 'signout', 'signOff', 'signoff'],
|
|
2019
|
+
['logout', 'logOut', 'logOff', 'signOff', 'signOut'],
|
|
2007
2020
|
['minify', 'codeMinify', 'minifyCode'],
|
|
2008
2021
|
['new', 'newChat', 'startNewChat'],
|
|
2009
2022
|
['obfuscate', 'codeObfuscate', 'obfuscateCode'],
|
|
@@ -2013,7 +2026,7 @@ const cjsFuncAliases = [
|
|
|
2013
2026
|
['refreshSession', 'sessionRefresh'],
|
|
2014
2027
|
['renderHTML', 'renderHtml', 'renderLinks', 'renderTags'],
|
|
2015
2028
|
['reviewCode', 'codeReview'],
|
|
2016
|
-
['send', 'sendChat', '
|
|
2029
|
+
['send', 'sendChat', 'sendMessage'],
|
|
2017
2030
|
['sendInNewChat', 'sendNewChat'],
|
|
2018
2031
|
['sentiment', 'analyzeSentiment', 'sentimentAnalysis'],
|
|
2019
2032
|
['startNewChat', 'new', 'newChat'],
|
|
@@ -2024,7 +2037,7 @@ const cjsFuncAliases = [
|
|
|
2024
2037
|
['translate', 'translation', 'translator'],
|
|
2025
2038
|
['unminify', 'unminifyCode', 'codeUnminify'],
|
|
2026
2039
|
['writeCode', 'codeWrite']
|
|
2027
|
-
]
|
|
2040
|
+
]
|
|
2028
2041
|
const cjsFuncSynonyms = [
|
|
2029
2042
|
['account', 'acct'],
|
|
2030
2043
|
['activate', 'turnOn'],
|
|
@@ -2040,6 +2053,7 @@ const cjsFuncSynonyms = [
|
|
|
2040
2053
|
['execute', 'interpret', 'interpreter', 'run'],
|
|
2041
2054
|
['firefox', 'ff'],
|
|
2042
2055
|
['generating', 'generation'],
|
|
2056
|
+
['message', 'msg'],
|
|
2043
2057
|
['minify', 'uglify'],
|
|
2044
2058
|
['refactor', 'rewrite'],
|
|
2045
2059
|
['regenerate', 'regen'],
|
|
@@ -2051,41 +2065,44 @@ const cjsFuncSynonyms = [
|
|
|
2051
2065
|
['typing', 'generating'],
|
|
2052
2066
|
['unminify', 'beautify', 'prettify', 'prettyPrint']
|
|
2053
2067
|
];
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
var newFunctionsCreated = false;
|
|
2075
|
-
for (const funcName in chatgpt) {
|
|
2076
|
-
if (typeof chatgpt[funcName] == 'function') {
|
|
2077
|
-
const funcWords = funcName.split(/(?=[A-Zs])/); // split function name into constituent words
|
|
2078
|
-
for (const funcWord of funcWords) {
|
|
2079
|
-
const synonymValues = [].concat(...cjsFuncSynonyms // flatten into single array w/ word's cjsFuncSynonyms
|
|
2068
|
+
(function createCJSaliasFuncs(obj = chatgpt) {
|
|
2069
|
+
for (const prop in obj) {
|
|
2070
|
+
if (!Object.prototype.hasOwnProperty.call(obj, prop)) continue // skip inherited props
|
|
2071
|
+
if (typeof obj[prop] == 'object') createCJSaliasFuncs(obj[prop]) // recurse thru objs to find deeper functions
|
|
2072
|
+
}
|
|
2073
|
+
let aliasFuncCreated
|
|
2074
|
+
do {
|
|
2075
|
+
aliasFuncCreated = false
|
|
2076
|
+
for (const prop in obj) {
|
|
2077
|
+
if (!Object.prototype.hasOwnProperty.call(obj, prop)) continue // skip inherited props
|
|
2078
|
+
if (typeof obj[prop] == 'function') {
|
|
2079
|
+
obj[prop.toLowerCase()] = obj[prop] // create lowercase variant
|
|
2080
|
+
cjsFuncAliases.forEach(aliasArr => { // create alias function per alias to use
|
|
2081
|
+
if (!aliasArr.includes(prop)) return
|
|
2082
|
+
aliasArr.forEach(alias => { if (!obj[alias]) {
|
|
2083
|
+
obj[alias] = obj[alias.toLowerCase()] = obj[prop] ; aliasFuncCreated = true }})
|
|
2084
|
+
})
|
|
2085
|
+
const funcWords = prop.split(/(?=[A-Z])/) // split function name into constituent words
|
|
2086
|
+
funcWords.forEach(funcWord => { // create alias function per function word per synonym
|
|
2087
|
+
const synonymsToUse = cjsFuncSynonyms
|
|
2080
2088
|
.filter(arr => arr.includes(funcWord.toLowerCase())) // filter in relevant synonym sub-arrays
|
|
2081
|
-
.
|
|
2082
|
-
|
|
2083
|
-
const newFuncName =
|
|
2084
|
-
if (!
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
}
|
|
2089
|
+
.flat().filter(synonym => synonym != funcWord.toLowerCase()) // filter out matching word
|
|
2090
|
+
synonymsToUse.forEach(synonym => { // create alias function per synonym to use
|
|
2091
|
+
const newFuncName = toCamelCase(funcWords.map(word => word == funcWord ? synonym : word))
|
|
2092
|
+
if (!obj[newFuncName]) {
|
|
2093
|
+
obj[newFuncName] = obj[newFuncName.toLowerCase()] = obj[prop] ; aliasFuncCreated = true }
|
|
2094
|
+
})
|
|
2095
|
+
})
|
|
2096
|
+
}
|
|
2097
|
+
}
|
|
2098
|
+
} while (aliasFuncCreated) // loop over new functions to encompass all variations
|
|
2099
|
+
})()
|
|
2100
|
+
|
|
2101
|
+
|
|
2102
|
+
// Define HELPER functions
|
|
2103
|
+
|
|
2104
|
+
function toCamelCase(words) {
|
|
2105
|
+
return words.map((word, idx) => idx == 0 ? word : word.charAt(0).toUpperCase() + word.slice(1)).join('') }
|
|
2089
2106
|
|
|
2090
2107
|
// Prefix console logs w/ '🤖 chatgpt.js >> '
|
|
2091
2108
|
const consolePrefix = '🤖 chatgpt.js >> ', ogError = console.error, ogInfo = console.info;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"name": "ChatGPT Extension",
|
|
4
4
|
"short_name": "ChatGPT 🧩",
|
|
5
5
|
"description": "A Chromium extension template to start using chatgpt.js like a boss!",
|
|
6
|
-
"version": "2025.2.
|
|
6
|
+
"version": "2025.2.12",
|
|
7
7
|
"author": "KudoAI",
|
|
8
8
|
"homepage_url": "https://github.com/KudoAI/chatgpt.js-chrome-starter",
|
|
9
9
|
"icons": {
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
// @description A Greasemonkey template to start using chatgpt.js like a boss
|
|
4
4
|
// @author chatgpt.js
|
|
5
5
|
// @namespace https://chatgpt.js.org
|
|
6
|
-
// @version 2025.2.
|
|
6
|
+
// @version 2025.2.12
|
|
7
7
|
// @license MIT
|
|
8
8
|
// @icon https://cdn.jsdelivr.net/gh/KudoAI/chatgpt.js@1fc50da/starters/greasemonkey/assets/images/icons/robot/icon48.png
|
|
9
9
|
// @icon64 https://cdn.jsdelivr.net/gh/KudoAI/chatgpt.js@1fc50da/starters/greasemonkey/assets/images/icons/robot/icon64.png
|
|
10
10
|
// @match *://chatgpt.com/*
|
|
11
|
-
// @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.6.
|
|
11
|
+
// @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.6.3/dist/chatgpt.min.js
|
|
12
12
|
// @grant GM_getValue
|
|
13
13
|
// @grant GM_setValue
|
|
14
14
|
// @noframes
|