Skip to content

Commit

Permalink
Un-modulized JS resources for simplicity ↞ [auto-sync from https://gi…
Browse files Browse the repository at this point in the history
  • Loading branch information
kudo-sync-bot committed Dec 1, 2024
1 parent d89fb14 commit a8a2d2f
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 31 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Requires lib/dom.js

const icons = {
window.icons = {

import(dependencies) { Object.entries(dependencies).forEach(([name, dependency]) => this[name] = dependency) },

Expand All @@ -27,6 +27,4 @@ const icons = {
get src() { return `${
icons.app.urls.mediaHost}/images/icons/question-mark/icon16.png?${icons.app.latestAssetCommitHash}` }

Check failure on line 28 in chrome/extension/components/icons.js

View workflow job for this annotation

GitHub Actions / JavaScript + JSON + Markdown + YAML

'icons' is not defined

Check failure on line 28 in chrome/extension/components/icons.js

View workflow job for this annotation

GitHub Actions / JavaScript + JSON + Markdown + YAML

'icons' is not defined
}
}

export { icons }
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Requires lib/dom.js

const modals = {
window.modals = {

setup(modal) {
modal.classList.add('chatgpt-infinity-modal')
Expand Down Expand Up @@ -37,6 +37,4 @@ const modals = {
modals.dragHandlers.draggableElem = null
}
}
}

export { modals }
};
4 changes: 2 additions & 2 deletions chrome/extension/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

document.documentElement.setAttribute('chatgpt-widescreen-extension-installed', true) // for userscript auto-disable

// Import LIBS
// Import JS resources
await import(chrome.runtime.getURL('components/modals.js'))
await import(chrome.runtime.getURL('lib/chatgpt.js'))
await import(chrome.runtime.getURL('lib/dom.js'))
await import(chrome.runtime.getURL('lib/settings.js'))
const { modals } = await import(chrome.runtime.getURL('components/modals.mjs'))

// Init ENV context
const env = {
Expand Down
2 changes: 1 addition & 1 deletion chrome/extension/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"action": { "default_popup": "popup/index.html" },
"web_accessible_resources": [{
"matches": [ "<all_urls>" ],
"resources": [ "lib/chatgpt.js", "lib/dom.js", "lib/settings.js", "components/modals.mjs" ]
"resources": [ "lib/chatgpt.js", "lib/dom.js", "lib/settings.js", "components/modals.js" ]
}],
"content_scripts": [{
"matches": [ "https://chatgpt.com/*", "https://www.perplexity.ai/*", "https://poe.com/*" ],
Expand Down
6 changes: 2 additions & 4 deletions chrome/extension/popup/controller.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
(async () => {

// Import LIBS
// Import JS resources
await import(chrome.runtime.getURL('components/icons.js'))
await import(chrome.runtime.getURL('lib/dom.js'))
await import(chrome.runtime.getURL('lib/settings.js'))

// Import ICONS
const { icons } = await import(chrome.runtime.getURL('components/icons.mjs'))

// Init ENV context
const env = { site: /([^.]+)\.[^.]+$/.exec(new URL((await chrome.tabs.query(
{ active: true, currentWindow: true }))[0].url).hostname)?.[1] }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Requires lib/dom.js

const icons = {
window.icons = {

import(dependencies) { Object.entries(dependencies).forEach(([name, dependency]) => this[name] = dependency) },

Expand All @@ -27,6 +27,4 @@ const icons = {
get src() { return `${
icons.app.urls.mediaHost}/images/icons/question-mark/icon16.png?${icons.app.latestAssetCommitHash}` }

Check failure on line 28 in firefox/extension/components/icons.js

View workflow job for this annotation

GitHub Actions / JavaScript + JSON + Markdown + YAML

'icons' is not defined

Check failure on line 28 in firefox/extension/components/icons.js

View workflow job for this annotation

GitHub Actions / JavaScript + JSON + Markdown + YAML

'icons' is not defined
}
}

export { icons }
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Requires lib/dom.js

const modals = {
window.modals = {

setup(modal) {
modal.classList.add('chatgpt-infinity-modal')
Expand All @@ -26,7 +26,6 @@ const modals = {
const newX = event.clientX - modals.dragHandlers.offsetX,
newY = event.clientY - modals.dragHandlers.offsetY
Object.assign(modals.dragHandlers.draggableElem.style, { left: `${newX}px`, top: `${newY}px` })
console.log(newX)
}
},

Expand All @@ -37,6 +36,4 @@ const modals = {
modals.dragHandlers.draggableElem = null
}
}
}

export { modals }
};
4 changes: 2 additions & 2 deletions firefox/extension/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

document.documentElement.setAttribute('chatgpt-widescreen-extension-installed', true) // for userscript auto-disable

// Import LIBS
// Import JS resources
await import(chrome.runtime.getURL('components/modals.js'))
await import(chrome.runtime.getURL('lib/chatgpt.js'))
await import(chrome.runtime.getURL('lib/dom.js'))
await import(chrome.runtime.getURL('lib/settings.js'))
const { modals } = await import(chrome.runtime.getURL('components/modals.mjs'))

// Init ENV context
const env = {
Expand Down
2 changes: 1 addition & 1 deletion firefox/extension/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"action": { "default_popup": "popup/index.html" },
"web_accessible_resources": [{
"matches": [ "<all_urls>" ],
"resources": [ "lib/chatgpt.js", "lib/dom.js", "lib/settings.js", "components/modals.mjs" ]
"resources": [ "lib/chatgpt.js", "lib/dom.js", "lib/settings.js", "components/modals.js" ]
}],
"content_scripts": [{
"matches": [ "https://chatgpt.com/*", "https://www.perplexity.ai/*", "https://poe.com/*" ],
Expand Down
6 changes: 2 additions & 4 deletions firefox/extension/popup/controller.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
(async () => {

// Import LIBS
// Import JS resources
await import(chrome.runtime.getURL('components/icons.js'))
await import(chrome.runtime.getURL('lib/dom.js'))
await import(chrome.runtime.getURL('lib/settings.js'))

// Import ICONS
const { icons } = await import(chrome.runtime.getURL('components/icons.mjs'))

// Init ENV context
const env = { site: /([^.]+)\.[^.]+$/.exec(new URL((await chrome.tabs.query(
{ active: true, currentWindow: true }))[0].url).hostname)?.[1] }
Expand Down

0 comments on commit a8a2d2f

Please sign in to comment.