Skip to content

Commit

Permalink
Removed trailing whitespace ↞ [auto-sync from https://github.com/adam…
Browse files Browse the repository at this point in the history
  • Loading branch information
kudo-sync-bot committed Nov 21, 2024
1 parent 7f1ab2f commit 2c80502
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 41 deletions.
2 changes: 1 addition & 1 deletion chrome/extension/components/icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const icons = {
if (iconData.type == 'svg') {
const svg = dom.create.svgElem('svg', { viewBox: iconData.viewBox, ...iconAttrs })
iconData.elems.forEach(([tag, attrs]) => svg.append(dom.create.svgElem(tag, attrs)))
return svg
return svg
} else // img w/ src
return dom.create.elem('img', { src: iconData.src, ...iconAttrs })
},
Expand Down
4 changes: 2 additions & 2 deletions chrome/extension/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

// Add CHROME MSG listener
chrome.runtime.onMessage.addListener(req => {

if (req.action == 'notify') notify(req.msg, req.pos)
else if (req.action == 'alert') siteAlert(req.title, req.msg, req.btns)
else if (req.action.startsWith('infinity')) {
Expand Down Expand Up @@ -105,7 +105,7 @@
const sidebar = document.querySelectorAll('nav')[env.browser.isMobile ? 1 : 0]
if (!sidebar) return
sidebar.insertBefore(sidebarToggle.div, sidebar.children[1])

// Tweak styles
const knobSpan = document.getElementById('infinity-toggle-knob-span'),
navicon = document.getElementById('infinity-toggle-navicon')
Expand Down
20 changes: 10 additions & 10 deletions chrome/extension/lib/chatgpt.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const chatgpt = {
modalMessage = document.createElement('p');

// Create/append/update modal style (if missing or outdated)
const thisUpdated = 20231203; // datestamp of last edit for this file's `modalStyle`
const thisUpdated = 20231203; // datestamp of last edit for this file's `modalStyle`
let modalStyle = document.querySelector('#chatgpt-modal-style'); // try to select existing style
if (!modalStyle || parseInt(modalStyle.getAttribute('last-updated'), 10) < thisUpdated) { // if missing or outdated
if (!modalStyle) { // outright missing, create/id/attr/append it first
Expand All @@ -38,7 +38,7 @@ const chatgpt = {
'.no-mobile-tap-outline { outline: none ; -webkit-tap-highlight-color: transparent }'

// Background styles
+ '.chatgpt-modal {'
+ '.chatgpt-modal {'
+ 'position: fixed ; top: 0 ; left: 0 ; width: 100% ; height: 100% ;' // expand to full view-port
+ 'background-color: rgba(67, 70, 72, 0) ;' // init dim bg but no opacity
+ 'transition: background-color 0.05s ease ;' // speed to transition in show alert routine
Expand Down Expand Up @@ -90,7 +90,7 @@ const chatgpt = {
+ `border: 1px solid ${ scheme == 'dark' ? 'white' : 'black' } ;`
+ 'background-color: black ; position: inherit }'
+ '.chatgpt-modal input[type="checkbox"]:focus { outline: none ; box-shadow: none }'
);
);
}

// Insert text into elements
Expand Down Expand Up @@ -160,7 +160,7 @@ const chatgpt = {
const modalElems = [closeBtn, modalTitle, modalMessage, modalButtons, checkboxDiv];
modalElems.forEach((elem) => { modal.append(elem); });
modal.style.width = `${ width || 458 }px`;
modalContainer.append(modal); document.body.append(modalContainer);
modalContainer.append(modal); document.body.append(modalContainer);

// Enqueue alert
let alertQueue = JSON.parse(localStorage.alertQueue);
Expand All @@ -172,7 +172,7 @@ const chatgpt = {
if (alertQueue.length === 1) {
modalContainer.style.display = '';
setTimeout(() => { // delay non-0 opacity's for transition fx
modalContainer.style.backgroundColor = (
modalContainer.style.backgroundColor = (
`rgba(67, 70, 72, ${ scheme === 'dark' ? 0.62 : 0.1 })`);
modalContainer.classList.add('animated'); }, 100);
}
Expand Down Expand Up @@ -314,7 +314,7 @@ const chatgpt = {
+ (notificationDiv.isRight ? 'Right' : 'Left');

// Create/append/update notification style (if missing or outdated)
const thisUpdated = 20231110; // datestamp of last edit for this file's `notifStyle`
const thisUpdated = 20231110; // datestamp of last edit for this file's `notifStyle`
let notifStyle = document.querySelector('#chatgpt-notif-style'); // try to select existing style
if (!notifStyle || parseInt(notifStyle.getAttribute('last-updated'), 10) < thisUpdated) { // if missing or outdated
if (!notifStyle) { // outright missing, create/id/attr/append it first
Expand All @@ -337,7 +337,7 @@ const chatgpt = {
+ '45% { opacity: 0.05 ; transform: rotateX(-81deg) }'
+ '100% { opacity: 0 ; transform: rotateX(-180deg) scale(1.15) }}'
);
}
}

// Enqueue notification
let notifyProps = JSON.parse(localStorage.notifyProps);
Expand Down Expand Up @@ -370,7 +370,7 @@ const chatgpt = {
notificationDiv.style.transition = 'transform 0.15s ease, opacity 0.15s ease';
}, 10);

// Init delay before hiding
// Init delay before hiding
const hideDelay = fadeDuration > notifDuration ? 0 // don't delay if fade exceeds notification duration
: notifDuration - fadeDuration; // otherwise delay for difference

Expand All @@ -379,7 +379,7 @@ const chatgpt = {
notificationDiv.style.animation = `notif-zoom-fade-out ${ fadeDuration }s ease-out`;
clearTimeout(dismissFuncTID);
};
const dismissFuncTID = setTimeout(dismissNotif, hideDelay * 1000); // maintain visibility for `hideDelay` secs, then dismiss
const dismissFuncTID = setTimeout(dismissNotif, hideDelay * 1000); // maintain visibility for `hideDelay` secs, then dismiss
closeSVG.onclick = dismissNotif; // add to close button clicks

// Destroy notification
Expand Down Expand Up @@ -612,7 +612,7 @@ for (const prop in chatgpt) {
// Prefix console logs w/ '🤖 chatgpt.js >> '
const consolePrefix = '🤖 chatgpt.js >> ', ogError = console.error, ogInfo = console.info;
console.error = (...args) => {
if (!args[0].startsWith(consolePrefix)) ogError(consolePrefix + args[0], ...args.slice(1));
if (!args[0].startsWith(consolePrefix)) ogError(consolePrefix + args[0], ...args.slice(1));
else ogError(...args);
};
console.info = (msg) => {
Expand Down
4 changes: 2 additions & 2 deletions chrome/extension/popup/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
+ 'icon' + dimension + '.png'
})
chrome.action.setIcon({ path: iconPaths })

// Update menu contents
document.querySelectorAll('div.logo, div.menu-title, div.menu')
.forEach(elem => {
Expand All @@ -64,7 +64,7 @@
const masterToggle = document.querySelector('input')
await settings.load('extensionDisabled')
masterToggle.checked = !config.extensionDisabled ; sync.fade()
masterToggle.onchange = () => {
masterToggle.onchange = () => {
settings.save('extensionDisabled', !config.extensionDisabled)
if (config.infinityMode) // always disable Infinity Mode on master toggle
document.querySelector('.menu-area > .toggle-switch > input')?.click()
Expand Down
2 changes: 1 addition & 1 deletion firefox/extension/components/icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const icons = {
if (iconData.type == 'svg') {
const svg = dom.create.svgElem('svg', { viewBox: iconData.viewBox, ...iconAttrs })
iconData.elems.forEach(([tag, attrs]) => svg.append(dom.create.svgElem(tag, attrs)))
return svg
return svg
} else // img w/ src
return dom.create.elem('img', { src: iconData.src, ...iconAttrs })
},
Expand Down
4 changes: 2 additions & 2 deletions firefox/extension/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

// Add CHROME MSG listener
chrome.runtime.onMessage.addListener((req, _, sendResp) => {

if (req.action == 'notify') notify(req.msg, req.pos)
else if (req.action == 'alert') siteAlert(req.title, req.msg, req.btns)
else if (req.action == 'prompt') {
Expand Down Expand Up @@ -109,7 +109,7 @@
const sidebar = document.querySelectorAll('nav')[env.browser.isMobile ? 1 : 0]
if (!sidebar) return
sidebar.insertBefore(sidebarToggle.div, sidebar.children[1])

// Tweak styles
const knobSpan = document.getElementById('infinity-toggle-knob-span'),
navicon = document.getElementById('infinity-toggle-navicon')
Expand Down
20 changes: 10 additions & 10 deletions firefox/extension/lib/chatgpt.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const chatgpt = {
modalMessage = document.createElement('p');

// Create/append/update modal style (if missing or outdated)
const thisUpdated = 20231203; // datestamp of last edit for this file's `modalStyle`
const thisUpdated = 20231203; // datestamp of last edit for this file's `modalStyle`
let modalStyle = document.querySelector('#chatgpt-modal-style'); // try to select existing style
if (!modalStyle || parseInt(modalStyle.getAttribute('last-updated'), 10) < thisUpdated) { // if missing or outdated
if (!modalStyle) { // outright missing, create/id/attr/append it first
Expand All @@ -38,7 +38,7 @@ const chatgpt = {
'.no-mobile-tap-outline { outline: none ; -webkit-tap-highlight-color: transparent }'

// Background styles
+ '.chatgpt-modal {'
+ '.chatgpt-modal {'
+ 'position: fixed ; top: 0 ; left: 0 ; width: 100% ; height: 100% ;' // expand to full view-port
+ 'background-color: rgba(67, 70, 72, 0) ;' // init dim bg but no opacity
+ 'transition: background-color 0.05s ease ;' // speed to transition in show alert routine
Expand Down Expand Up @@ -90,7 +90,7 @@ const chatgpt = {
+ `border: 1px solid ${ scheme == 'dark' ? 'white' : 'black' } ;`
+ 'background-color: black ; position: inherit }'
+ '.chatgpt-modal input[type="checkbox"]:focus { outline: none ; box-shadow: none }'
);
);
}

// Insert text into elements
Expand Down Expand Up @@ -160,7 +160,7 @@ const chatgpt = {
const modalElems = [closeBtn, modalTitle, modalMessage, modalButtons, checkboxDiv];
modalElems.forEach((elem) => { modal.append(elem); });
modal.style.width = `${ width || 458 }px`;
modalContainer.append(modal); document.body.append(modalContainer);
modalContainer.append(modal); document.body.append(modalContainer);

// Enqueue alert
let alertQueue = JSON.parse(localStorage.alertQueue);
Expand All @@ -172,7 +172,7 @@ const chatgpt = {
if (alertQueue.length === 1) {
modalContainer.style.display = '';
setTimeout(() => { // delay non-0 opacity's for transition fx
modalContainer.style.backgroundColor = (
modalContainer.style.backgroundColor = (
`rgba(67, 70, 72, ${ scheme === 'dark' ? 0.62 : 0.1 })`);
modalContainer.classList.add('animated'); }, 100);
}
Expand Down Expand Up @@ -314,7 +314,7 @@ const chatgpt = {
+ (notificationDiv.isRight ? 'Right' : 'Left');

// Create/append/update notification style (if missing or outdated)
const thisUpdated = 20231110; // datestamp of last edit for this file's `notifStyle`
const thisUpdated = 20231110; // datestamp of last edit for this file's `notifStyle`
let notifStyle = document.querySelector('#chatgpt-notif-style'); // try to select existing style
if (!notifStyle || parseInt(notifStyle.getAttribute('last-updated'), 10) < thisUpdated) { // if missing or outdated
if (!notifStyle) { // outright missing, create/id/attr/append it first
Expand All @@ -337,7 +337,7 @@ const chatgpt = {
+ '45% { opacity: 0.05 ; transform: rotateX(-81deg) }'
+ '100% { opacity: 0 ; transform: rotateX(-180deg) scale(1.15) }}'
);
}
}

// Enqueue notification
let notifyProps = JSON.parse(localStorage.notifyProps);
Expand Down Expand Up @@ -370,7 +370,7 @@ const chatgpt = {
notificationDiv.style.transition = 'transform 0.15s ease, opacity 0.15s ease';
}, 10);

// Init delay before hiding
// Init delay before hiding
const hideDelay = fadeDuration > notifDuration ? 0 // don't delay if fade exceeds notification duration
: notifDuration - fadeDuration; // otherwise delay for difference

Expand All @@ -379,7 +379,7 @@ const chatgpt = {
notificationDiv.style.animation = `notif-zoom-fade-out ${ fadeDuration }s ease-out`;
clearTimeout(dismissFuncTID);
};
const dismissFuncTID = setTimeout(dismissNotif, hideDelay * 1000); // maintain visibility for `hideDelay` secs, then dismiss
const dismissFuncTID = setTimeout(dismissNotif, hideDelay * 1000); // maintain visibility for `hideDelay` secs, then dismiss
closeSVG.onclick = dismissNotif; // add to close button clicks

// Destroy notification
Expand Down Expand Up @@ -612,7 +612,7 @@ for (const prop in chatgpt) {
// Prefix console logs w/ '🤖 chatgpt.js >> '
const consolePrefix = '🤖 chatgpt.js >> ', ogError = console.error, ogInfo = console.info;
console.error = (...args) => {
if (!args[0].startsWith(consolePrefix)) ogError(consolePrefix + args[0], ...args.slice(1));
if (!args[0].startsWith(consolePrefix)) ogError(consolePrefix + args[0], ...args.slice(1));
else ogError(...args);
};
console.info = (msg) => {
Expand Down
4 changes: 2 additions & 2 deletions firefox/extension/popup/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
+ 'icon' + dimension + '.png'
})
chrome.action.setIcon({ path: iconPaths })

// Update menu contents
document.querySelectorAll('div.logo, div.menu-title, div.menu')
.forEach(elem => {
Expand All @@ -66,7 +66,7 @@
const masterToggle = document.querySelector('input')
await settings.load('extensionDisabled')
masterToggle.checked = !config.extensionDisabled ; sync.fade()
masterToggle.onchange = () => {
masterToggle.onchange = () => {
settings.save('extensionDisabled', !config.extensionDisabled)
if (config.infinityMode) // always disable Infinity Mode on master toggle
document.querySelector('.menu-area > .toggle-switch > input')?.click()
Expand Down
22 changes: 11 additions & 11 deletions greasemonkey/chatgpt-infinity.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
// @description:zh-TW 從無所不知的 ChatGPT 生成無窮無盡的答案 (用任何語言!)
// @author Adam Lui
// @namespace https://github.com/adamlui
// @version 2024.11.21.9
// @version 2024.11.21.10
// @license MIT
// @match *://chatgpt.com/*
// @match *://chat.openai.com/*
Expand Down Expand Up @@ -415,7 +415,7 @@
( app.msgs.appName ) + ' ' // msg
+ ( app.msgs.alert_willReplyIn ) + ' '
+ ( replyLanguage || app.msgs.alert_yourSysLang) + '.')
if (config.infinityMode) infinity.restart({ target: 'new' }) // using new reply language
if (config.infinityMode) infinity.restart({ target: 'new' }) // using new reply language
break
}
}
Expand Down Expand Up @@ -449,7 +449,7 @@
( app.msgs.appName ) + ' ' // msg
+ ( app.msgs.alert_willReplyEvery ) + ' '
+ replyInterval + ' ' + ( app.msgs.unit_seconds ) + '.')
if (config.infinityMode) infinity.restart({ target: 'self' }) // using new reply interval
if (config.infinityMode) infinity.restart({ target: 'self' }) // using new reply interval
break
}
}
Expand Down Expand Up @@ -589,7 +589,7 @@
function moreChatGPTapps() { modals.safeWinOpen(app.urls.relatedApps) }
], '', 478 // set width
)

// Re-format buttons to include emoji + localized label + hide Dismiss button
for (const button of document.getElementById(aboutModalID).querySelectorAll('button')) {
button.style.cssText = 'cursor: pointer !important' // since tweaks won't load on auto-disable
Expand All @@ -603,7 +603,7 @@
'🤖 ' + ( app.msgs.btnLabel_moreAIextensions ))
else button.style.display = 'none' // hide Dismiss button
}
}
}
},

donate: {
Expand Down Expand Up @@ -712,7 +712,7 @@
const sidebar = document.querySelectorAll('nav')[env.browser.isMobile ? 1 : 0]
if (!sidebar) return
sidebar.insertBefore(sidebarToggle.div, sidebar.children[1])

// Tweak styles
const knobSpan = document.getElementById('infinity-toggle-knob-span'),
navicon = document.getElementById('infinity-toggle-navicon')
Expand All @@ -735,12 +735,12 @@
|| dom.create.elem('img', { id: 'infinity-toggle-navicon' })
navicon.style.width = navicon.style.height = '1.25rem'
navicon.style.marginLeft = '2px' ; navicon.style.marginRight = '4px'

// Create/ID/disable/hide/update checkbox
const toggleInput = document.getElementById('infinity-toggle-input')
|| dom.create.elem('input', { id: 'infinity-toggle-input', type: 'checkbox', disabled: true })
toggleInput.style.display = 'none' ; toggleInput.checked = config.infinityMode

// Create/ID/stylize switch
const switchSpan = document.getElementById('infinity-switch-span')
|| dom.create.elem('span', { id: 'infinity-switch-span' })
Expand All @@ -750,7 +750,7 @@
bottom: `${ !ui.firstLink ? -0.15 : env.browser.isFF ? 0.05 : 0 }em`,
width: '30px', height: '15px', '-webkit-transition': '.4s', transition: '0.4s', borderRadius: '28px'
})

// Create/stylize knob, append to switch
const knobSpan = document.getElementById('infinity-toggle-knob-span')
|| dom.create.elem('span', { id: 'infinity-toggle-knob-span' })
Expand All @@ -761,7 +761,7 @@
'translateX(0)' : 'translateX(13px) translateY(0)',
backgroundColor: 'white', '-webkit-transition': '0.4s', transition: '0.4s'
}) ; switchSpan.append(knobSpan)

// Create/stylize/fill label
const toggleLabel = document.getElementById('infinity-toggle-label')
|| dom.create.elem('label', { id: 'infinity-toggle-label' })
Expand All @@ -777,7 +777,7 @@
: ( app.msgs.state_disabled ))
// Append elements
for (const elem of [navicon, toggleInput, switchSpan, toggleLabel]) sidebarToggle.div.append(elem)

// Update visual state
setTimeout(() => {
switchSpan.style.backgroundColor = toggleInput.checked ? '#ad68ff' : '#ccc'
Expand Down

0 comments on commit 2c80502

Please sign in to comment.