@kudoai/chatgpt.js 3.8.4 → 3.9.0
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 +1 -1
- package/README.md +13 -17
- package/chatgpt.js +64 -68
- package/dist/chatgpt.min.js +9 -9
- package/docs/README.md +13 -17
- package/docs/USERGUIDE.md +3 -3
- package/package.json +14 -14
- package/starters/chrome/LICENSE.md +1 -1
- package/starters/chrome/extension/components/modals.js +4 -4
- package/starters/chrome/extension/content.js +13 -12
- package/starters/chrome/extension/lib/chatgpt.js +64 -68
- package/starters/chrome/extension/lib/css.min.js +1 -0
- package/starters/chrome/extension/lib/dom.min.js +1 -0
- package/starters/chrome/extension/lib/feedback.js +2 -2
- package/starters/chrome/extension/lib/settings.js +6 -4
- package/starters/chrome/extension/manifest.json +2 -2
- package/starters/chrome/extension/popup/controller.js +9 -9
- package/starters/chrome/extension/popup/style.css +1 -2
- package/starters/greasemonkey/LICENSE.md +1 -1
- package/starters/greasemonkey/chatgpt.js-greasemonkey-starter.user.js +4 -3
- package/starters/chrome/extension/lib/dom.js +0 -114
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
|
|
23
23
|
# 🏛️ MIT License
|
|
24
24
|
|
|
25
|
-
**Copyright © 2023–
|
|
25
|
+
**Copyright © 2023–2026 [KudoAI](https://github.com/KudoAI) & contributors**
|
|
26
26
|
|
|
27
27
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
28
28
|
|
|
@@ -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
|
|
6
|
+
// @version 2026.1.27
|
|
7
7
|
// @license MIT
|
|
8
8
|
// @icon data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='180'%20height='180'%20fill='none'%3e%3cstyle%3e%20:root%20{%20--primary-fill:%20%23000;%20--secondary-fill:%20%23fff;%20}%20@media%20(prefers-color-scheme:%20dark)%20{%20:root%20{%20--primary-fill:%20%23fff;%20--secondary-fill:%20%23000;%20}%20}%20%3c/style%3e%3cg%20clip-path='url(%23a)'%3e%3crect%20width='180'%20height='180'%20fill='var(--primary-fill)'%20rx='90'%20/%3e%3cg%20clip-path='url(%23b)'%3e%3cpath%20fill='var(--secondary-fill)'%20d='M75.91%2073.628V62.232c0-.96.36-1.68%201.199-2.16l22.912-13.194c3.119-1.8%206.838-2.639%2010.676-2.639%2014.394%200%2023.511%2011.157%2023.511%2023.032%200%20.839%200%201.799-.12%202.758l-23.752-13.914c-1.439-.84-2.879-.84-4.318%200L75.91%2073.627Zm53.499%2044.383v-27.23c0-1.68-.72-2.88-2.159-3.719L97.142%2069.55l9.836-5.638c.839-.48%201.559-.48%202.399%200l22.912%2013.195c6.598%203.839%2011.035%2011.995%2011.035%2019.912%200%209.116-5.397%2017.513-13.915%2020.992v.001Zm-60.577-23.99-9.836-5.758c-.84-.48-1.2-1.2-1.2-2.16v-26.39c0-12.834%209.837-22.55%2023.152-22.55%205.039%200%209.716%201.679%2013.676%204.678L70.993%2055.516c-1.44.84-2.16%202.039-2.16%203.719v34.787-.002Zm21.173%2012.234L75.91%2098.339V81.546l14.095-7.917%2014.094%207.917v16.793l-14.094%207.916Zm9.056%2036.467c-5.038%200-9.716-1.68-13.675-4.678l23.631-13.676c1.439-.839%202.159-2.038%202.159-3.718V85.863l9.956%205.757c.84.48%201.2%201.2%201.2%202.16v26.389c0%2012.835-9.957%2022.552-23.27%2022.552v.001Zm-28.43-26.75L47.72%20102.778c-6.599-3.84-11.036-11.996-11.036-19.913%200-9.236%205.518-17.513%2014.034-20.992v27.35c0%201.68.72%202.879%202.16%203.718l29.989%2017.393-9.837%205.638c-.84.48-1.56.48-2.399%200Zm-1.318%2019.673c-13.555%200-23.512-10.196-23.512-22.792%200-.959.12-1.919.24-2.879l23.63%2013.675c1.44.84%202.88.84%204.32%200l30.108-17.392v11.395c0%20.96-.361%201.68-1.2%202.16l-22.912%2013.194c-3.119%201.8-6.837%202.639-10.675%202.639Zm29.748%2014.274c14.515%200%2026.63-10.316%2029.39-23.991%2013.434-3.479%2022.071-16.074%2022.071-28.91%200-8.396-3.598-16.553-10.076-22.43.6-2.52.96-5.039.96-7.557%200-17.153-13.915-29.99-29.989-29.99-3.239%200-6.358.48-9.477%201.56-5.398-5.278-12.835-8.637-20.992-8.637-14.515%200-26.63%2010.316-29.39%2023.991-13.434%203.48-22.07%2016.074-22.07%2028.91%200%208.396%203.598%2016.553%2010.075%2022.431-.6%202.519-.96%205.038-.96%207.556%200%2017.154%2013.915%2029.989%2029.99%2029.989%203.238%200%206.357-.479%209.476-1.559%205.397%205.278%2012.835%208.637%2020.992%208.637Z'%20/%3e%3c/g%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='a'%3e%3cpath%20d='M0%200h180v180H0z'%20/%3e%3c/clipPath%3e%3cclipPath%20id='b'%3e%3cpath%20d='M29.487%2029.964h121.035v119.954H29.487z'%20/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e
|
|
9
9
|
// @icon64 data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='180'%20height='180'%20fill='none'%3e%3cstyle%3e%20:root%20{%20--primary-fill:%20%23000;%20--secondary-fill:%20%23fff;%20}%20@media%20(prefers-color-scheme:%20dark)%20{%20:root%20{%20--primary-fill:%20%23fff;%20--secondary-fill:%20%23000;%20}%20}%20%3c/style%3e%3cg%20clip-path='url(%23a)'%3e%3crect%20width='180'%20height='180'%20fill='var(--primary-fill)'%20rx='90'%20/%3e%3cg%20clip-path='url(%23b)'%3e%3cpath%20fill='var(--secondary-fill)'%20d='M75.91%2073.628V62.232c0-.96.36-1.68%201.199-2.16l22.912-13.194c3.119-1.8%206.838-2.639%2010.676-2.639%2014.394%200%2023.511%2011.157%2023.511%2023.032%200%20.839%200%201.799-.12%202.758l-23.752-13.914c-1.439-.84-2.879-.84-4.318%200L75.91%2073.627Zm53.499%2044.383v-27.23c0-1.68-.72-2.88-2.159-3.719L97.142%2069.55l9.836-5.638c.839-.48%201.559-.48%202.399%200l22.912%2013.195c6.598%203.839%2011.035%2011.995%2011.035%2019.912%200%209.116-5.397%2017.513-13.915%2020.992v.001Zm-60.577-23.99-9.836-5.758c-.84-.48-1.2-1.2-1.2-2.16v-26.39c0-12.834%209.837-22.55%2023.152-22.55%205.039%200%209.716%201.679%2013.676%204.678L70.993%2055.516c-1.44.84-2.16%202.039-2.16%203.719v34.787-.002Zm21.173%2012.234L75.91%2098.339V81.546l14.095-7.917%2014.094%207.917v16.793l-14.094%207.916Zm9.056%2036.467c-5.038%200-9.716-1.68-13.675-4.678l23.631-13.676c1.439-.839%202.159-2.038%202.159-3.718V85.863l9.956%205.757c.84.48%201.2%201.2%201.2%202.16v26.389c0%2012.835-9.957%2022.552-23.27%2022.552v.001Zm-28.43-26.75L47.72%20102.778c-6.599-3.84-11.036-11.996-11.036-19.913%200-9.236%205.518-17.513%2014.034-20.992v27.35c0%201.68.72%202.879%202.16%203.718l29.989%2017.393-9.837%205.638c-.84.48-1.56.48-2.399%200Zm-1.318%2019.673c-13.555%200-23.512-10.196-23.512-22.792%200-.959.12-1.919.24-2.879l23.63%2013.675c1.44.84%202.88.84%204.32%200l30.108-17.392v11.395c0%20.96-.361%201.68-1.2%202.16l-22.912%2013.194c-3.119%201.8-6.837%202.639-10.675%202.639Zm29.748%2014.274c14.515%200%2026.63-10.316%2029.39-23.991%2013.434-3.479%2022.071-16.074%2022.071-28.91%200-8.396-3.598-16.553-10.076-22.43.6-2.52.96-5.039.96-7.557%200-17.153-13.915-29.99-29.989-29.99-3.239%200-6.358.48-9.477%201.56-5.398-5.278-12.835-8.637-20.992-8.637-14.515%200-26.63%2010.316-29.39%2023.991-13.434%203.48-22.07%2016.074-22.07%2028.91%200%208.396%203.598%2016.553%2010.075%2022.431-.6%202.519-.96%205.038-.96%207.556%200%2017.154%2013.915%2029.989%2029.99%2029.989%203.238%200%206.357-.479%209.476-1.559%205.397%205.278%2012.835%208.637%2020.992%208.637Z'%20/%3e%3c/g%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='a'%3e%3cpath%20d='M0%200h180v180H0z'%20/%3e%3c/clipPath%3e%3cclipPath%20id='b'%3e%3cpath%20d='M29.487%2029.964h121.035v119.954H29.487z'%20/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e
|
|
10
10
|
// @match *://chatgpt.com/*
|
|
11
|
-
// @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.
|
|
11
|
+
// @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.9.0/dist/chatgpt.min.js
|
|
12
12
|
// @grant GM_getValue
|
|
13
13
|
// @grant GM_setValue
|
|
14
14
|
// @noframes
|
|
@@ -16,9 +16,10 @@
|
|
|
16
16
|
// @supportURL https://github.com/KudoAI/chatgpt.js-greasemonkey-starter/issues
|
|
17
17
|
// ==/UserScript==
|
|
18
18
|
|
|
19
|
-
// NOTE: This script relies on the powerful chatgpt.js library @ https://chatgpt.js.org © 2023–
|
|
19
|
+
// NOTE: This script relies on the powerful chatgpt.js library @ https://chatgpt.js.org © 2023–2026 KudoAI & contributors under the MIT license
|
|
20
20
|
|
|
21
21
|
(async () => {
|
|
22
|
+
'use strict'
|
|
22
23
|
|
|
23
24
|
// Init config
|
|
24
25
|
const config = { prefix: 'chatgptScript' } ; loadSetting('skipAlert')
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
// Copyright © 2023–2025 Adam Lui (https://github.com/adamlui) under the MIT license
|
|
2
|
-
// Source: https://github.com/adamlui/ai-web-extensions/blob/main/assets/lib/dom.js/src/dom.js
|
|
3
|
-
|
|
4
|
-
window.dom = {
|
|
5
|
-
|
|
6
|
-
addRisingParticles(targetNode, { lightScheme = 'gray', darkScheme = 'white' } = {}) {
|
|
7
|
-
// * Requires https://assets.aiwebextensions.com/styles/rising-particles/dist/<lightScheme>.min.css
|
|
8
|
-
|
|
9
|
-
if (targetNode.querySelector('[id*=particles]')) return
|
|
10
|
-
const particlesDivsWrapper = document.createElement('div')
|
|
11
|
-
particlesDivsWrapper.style.cssText = (
|
|
12
|
-
'position: absolute ; top: 0 ; left: 0 ;' // hug targetNode's top-left corner
|
|
13
|
-
+ 'height: 100% ; width: 100% ; border-radius: 15px ; overflow: clip ;' // bound innards exactly by targetNode
|
|
14
|
-
+ 'z-index: -1' ) // allow interactive elems to be clicked
|
|
15
|
-
;['sm', 'med', 'lg'].forEach(particleSize => {
|
|
16
|
-
const particlesDiv = document.createElement('div')
|
|
17
|
-
particlesDiv.id = config?.bgAnimationsDisabled ? `particles-${particleSize}-off`
|
|
18
|
-
: `${( env?.ui?.scheme || env?.ui?.app?.scheme ) == 'dark' ? darkScheme
|
|
19
|
-
: lightScheme }-particles-${particleSize}`
|
|
20
|
-
particlesDivsWrapper.append(particlesDiv)
|
|
21
|
-
})
|
|
22
|
-
targetNode.prepend(particlesDivsWrapper)
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
create: {
|
|
26
|
-
anchor(linkHref, displayContent, attrs = {}) {
|
|
27
|
-
const anchor = document.createElement('a'),
|
|
28
|
-
defaultAttrs = { href: linkHref, target: '_blank', rel: 'noopener' },
|
|
29
|
-
finalAttrs = { ...defaultAttrs, ...attrs }
|
|
30
|
-
Object.entries(finalAttrs).forEach(([attr, value]) => anchor.setAttribute(attr, value))
|
|
31
|
-
if (displayContent) anchor.append(displayContent)
|
|
32
|
-
return anchor
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
elem(elemType, attrs = {}) {
|
|
36
|
-
const elem = document.createElement(elemType)
|
|
37
|
-
for (const attr in attrs) {
|
|
38
|
-
if (attr in elem) elem[attr] = attrs[attr]
|
|
39
|
-
else elem.setAttribute(attr, attrs[attr])
|
|
40
|
-
}
|
|
41
|
-
return elem
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
style(content, attrs = {}) {
|
|
45
|
-
const style = document.createElement('style')
|
|
46
|
-
style.setAttribute('type', 'text/css') // support older browsers
|
|
47
|
-
for (const attr in attrs) style.setAttribute(attr, attrs[attr])
|
|
48
|
-
if (content) style.textContent = content
|
|
49
|
-
return style
|
|
50
|
-
},
|
|
51
|
-
|
|
52
|
-
svgElem(type, attrs = {}) {
|
|
53
|
-
const elem = document.createElementNS('http://www.w3.org/2000/svg', type)
|
|
54
|
-
for (const attr in attrs) elem.setAttributeNS(null, attr, attrs[attr])
|
|
55
|
-
return elem
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
cssSelectorize(classList) {
|
|
60
|
-
return classList.toString()
|
|
61
|
-
.replace(/([:[\]\\])/g, '\\$1') // escape special chars :[]\
|
|
62
|
-
.replace(/^| /g, '.') // prefix w/ dot, convert spaces to dots
|
|
63
|
-
},
|
|
64
|
-
|
|
65
|
-
get: {
|
|
66
|
-
|
|
67
|
-
computedSize(elems, { dimension } = {}) { // total width/height of elems (including margins)
|
|
68
|
-
// * Returns { width: totalWidth, height: totalHeight } if no dimension passed
|
|
69
|
-
// * Returns float if { dimension: 'width' | 'height' } passed
|
|
70
|
-
|
|
71
|
-
// Validate args
|
|
72
|
-
elems = elems instanceof NodeList ? [...elems] : [].concat(elems)
|
|
73
|
-
elems.forEach(elem => { if (!(elem instanceof Node))
|
|
74
|
-
throw new Error(`Invalid elem: Element "${JSON.stringify(elem)}" is not a valid DOM node`) })
|
|
75
|
-
const validDimensions = ['width', 'height'], dimensionsToCompute = [].concat(dimension || validDimensions)
|
|
76
|
-
dimensionsToCompute.forEach(dimension => { if (!validDimensions.includes(dimension))
|
|
77
|
-
throw new Error('Invalid dimension: Use \'width\' or \'height\'') })
|
|
78
|
-
|
|
79
|
-
// Compute dimensions
|
|
80
|
-
const computedDimensions = { width: 0, height: 0 }
|
|
81
|
-
elems.forEach(elem => {
|
|
82
|
-
const elemStyle = getComputedStyle(elem) ; if (elemStyle.display == 'none') return
|
|
83
|
-
Object.keys(computedDimensions).forEach(dimension => {
|
|
84
|
-
if (dimensionsToCompute.includes(dimension))
|
|
85
|
-
computedDimensions[dimension] += elem.getBoundingClientRect()[dimension]
|
|
86
|
-
+ parseFloat(elemStyle[`margin${dimension == 'width' ? 'Left' : 'Top'}`])
|
|
87
|
-
+ parseFloat(elemStyle[`margin${dimension == 'width' ? 'Right' : 'Bottom'}`])
|
|
88
|
-
})
|
|
89
|
-
})
|
|
90
|
-
|
|
91
|
-
// Return computed dimensions
|
|
92
|
-
return dimensionsToCompute.length > 1 ? computedDimensions // obj w/ width/height
|
|
93
|
-
: computedDimensions[dimensionsToCompute[0]] // single total val
|
|
94
|
-
},
|
|
95
|
-
|
|
96
|
-
computedHeight(elems) { return this.computedSize(elems, { dimension: 'height' }) }, // including margins
|
|
97
|
-
computedWidth(elems) { return this.computedSize(elems, { dimension: 'width' }) }, // including margins
|
|
98
|
-
|
|
99
|
-
loadedElem(selector, { timeout = null } = {}) {
|
|
100
|
-
const raceEntries = [
|
|
101
|
-
new Promise(resolve => { // when elem loads
|
|
102
|
-
const elem = document.querySelector(selector)
|
|
103
|
-
if (elem) resolve(elem)
|
|
104
|
-
else new MutationObserver((_, obs) => {
|
|
105
|
-
const elem = document.querySelector(selector)
|
|
106
|
-
if (elem) { obs.disconnect() ; resolve(elem) }
|
|
107
|
-
}).observe(document.documentElement, { childList: true, subtree: true })
|
|
108
|
-
})
|
|
109
|
-
]
|
|
110
|
-
if (timeout) raceEntries.push(new Promise(resolve => setTimeout(() => resolve(null), timeout)))
|
|
111
|
-
return Promise.race(raceEntries)
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
};
|