Skip to content

Commit

Permalink
Abstracted btns.getVisibleTypes() ↞ [auto-sync from https://github.…
Browse files Browse the repository at this point in the history
  • Loading branch information
kudo-sync-bot committed Dec 12, 2024
1 parent 30f54f7 commit f594b24
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 25 deletions.
17 changes: 9 additions & 8 deletions chrome/extension/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,7 @@
if (chatgpt.canvasIsOpen()) inputArea.parentNode.style.width = '100%'
else if (!env.tallChatbar) { // narrow it to not clash w/ buttons
const widths = { chatbar: chatbarDiv.getBoundingClientRect().width }
const visibleBtnTypes = [...btns.types, 'send'].filter(type =>
!(type == 'fullWindow' && !sites[env.site].hasSidebar)
&& !(type == 'wideScreen' && chatgpt.canvasIsOpen())
&& !(type == 'newChat' && config.ncbDisabled))
const visibleBtnTypes = [...btns.getVisibleTypes(), 'send']
visibleBtnTypes.forEach(type =>
widths[type] = btns[type]?.getBoundingClientRect().width
|| document.querySelector(`${sites.chatgpt.selectors.btns.send}, ${
Expand Down Expand Up @@ -276,6 +273,13 @@

// Update SVG
if (!btn.contains(btnSVG)) btn.append(btnSVG)
},

getVisibleTypes() { // used in update.tooltip() + chatbar.tweak()
return this.types.filter(type =>
!(type == 'fullWindow' && !sites[env.site].hasSidebar)
&& !(type == 'wideScreen' && chatgpt.canvasIsOpen())
&& !(type == 'newChat' && config.ncbDisabled))
}
}

Expand Down Expand Up @@ -340,10 +344,7 @@
},

tooltip(btnType) { // text & position
const visibleBtnTypes = btns.types.filter(type =>
!(type == 'fullWindow' && !sites[env.site].hasSidebar)
&& !(type == 'wideScreen' && chatgpt.canvasIsOpen())
&& !(type == 'newChat' && config.ncbDisabled))
const visibleBtnTypes = btns.getVisibleTypes()
const ctrAddend = ( env.site == 'perplexity' ? ( location.pathname == '/' ? 94 : 105 )
: env.site == 'poe' ? 45 : 13 ) +25
const spreadFactor = env.site == 'perplexity' ? 26.5 : env.site == 'poe' ? 34 : 30.55
Expand Down
17 changes: 9 additions & 8 deletions firefox/extension/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,7 @@
if (chatgpt.canvasIsOpen()) inputArea.parentNode.style.width = '100%'
else if (!env.tallChatbar) { // narrow it to not clash w/ buttons
const widths = { chatbar: chatbarDiv.getBoundingClientRect().width }
const visibleBtnTypes = [...btns.types, 'send'].filter(type =>
!(type == 'fullWindow' && !sites[env.site].hasSidebar)
&& !(type == 'wideScreen' && chatgpt.canvasIsOpen())
&& !(type == 'newChat' && config.ncbDisabled))
const visibleBtnTypes = [...btns.getVisibleTypes(), 'send']
visibleBtnTypes.forEach(type =>
widths[type] = btns[type]?.getBoundingClientRect().width
|| document.querySelector(`${sites.chatgpt.selectors.btns.send}, ${
Expand Down Expand Up @@ -276,6 +273,13 @@

// Update SVG
if (!btn.contains(btnSVG)) btn.append(btnSVG)
},

getVisibleTypes() { // used in update.tooltip() + chatbar.tweak()
return this.types.filter(type =>
!(type == 'fullWindow' && !sites[env.site].hasSidebar)
&& !(type == 'wideScreen' && chatgpt.canvasIsOpen())
&& !(type == 'newChat' && config.ncbDisabled))
}
}

Expand Down Expand Up @@ -340,10 +344,7 @@
},

tooltip(btnType) { // text & position
const visibleBtnTypes = btns.types.filter(type =>
!(type == 'fullWindow' && !sites[env.site].hasSidebar)
&& !(type == 'wideScreen' && chatgpt.canvasIsOpen())
&& !(type == 'newChat' && config.ncbDisabled))
const visibleBtnTypes = btns.getVisibleTypes()
const ctrAddend = ( env.site == 'perplexity' ? ( location.pathname == '/' ? 94 : 105 )
: env.site == 'poe' ? 45 : 13 ) +25
const spreadFactor = env.site == 'perplexity' ? 26.5 : env.site == 'poe' ? 34 : 30.55
Expand Down
19 changes: 10 additions & 9 deletions greasemonkey/chatgpt-widescreen-mode.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@
// @description:zu Yengeza Isikrini Esibanzi + Izindlela Zesikrini Esigcwele ku-chatgpt.com + perplexity.ai + poe.com ukuze uthole ukubuka okuthuthukisiwe + okuncishisiwe ukuskrola
// @author Adam Lui
// @namespace https://github.com/adamlui
// @version 2024.12.11
// @version 2024.12.11.1
// @license MIT
// @icon https://media.chatgptwidescreen.com/images/icons/widescreen-robot-emoji/icon48.png?9a393be
// @icon64 https://media.chatgptwidescreen.com/images/icons/widescreen-robot-emoji/icon64.png?9a393be
Expand Down Expand Up @@ -515,10 +515,7 @@
if (chatgpt.canvasIsOpen()) inputArea.parentNode.style.width = '100%'
else if (!env.tallChatbar) { // narrow it to not clash w/ buttons
const widths = { chatbar: chatbarDiv.getBoundingClientRect().width }
const visibleBtnTypes = [...btns.types, 'send'].filter(type =>
!(type == 'fullWindow' && !sites[env.site].hasSidebar)
&& !(type == 'wideScreen' && chatgpt.canvasIsOpen())
&& !(type == 'newChat' && config.ncbDisabled))
const visibleBtnTypes = [...btns.getVisibleTypes(), 'send']
visibleBtnTypes.forEach(type =>
widths[type] = btns[type]?.getBoundingClientRect().width
|| document.querySelector(`${sites[env.site].selectors.btns.send}, ${
Expand Down Expand Up @@ -708,6 +705,13 @@

// Update SVG
if (!btn.contains(btnSVG)) btn.append(btnSVG)
},

getVisibleTypes() { // used in update.tooltip() + chatbar.tweak()
return this.types.filter(type =>
!(type == 'fullWindow' && !sites[env.site].hasSidebar)
&& !(type == 'wideScreen' && chatgpt.canvasIsOpen())
&& !(type == 'newChat' && config.ncbDisabled))
}
}

Expand Down Expand Up @@ -774,10 +778,7 @@
},

tooltip(btnType) { // text & position
const visibleBtnTypes = btns.types.filter(type =>
!(type == 'fullWindow' && !sites[env.site].hasSidebar)
&& !(type == 'wideScreen' && chatgpt.canvasIsOpen())
&& !(type == 'newChat' && config.ncbDisabled))
const visibleBtnTypes = btns.getVisibleTypes()
const ctrAddend = ( env.site == 'perplexity' ? ( location.pathname == '/' ? 94 : 105 )
: env.site == 'poe' ? 45 : 13 ) +25
const spreadFactor = env.site == 'perplexity' ? 26.5 : env.site == 'poe' ? 34 : 30.55
Expand Down

0 comments on commit f594b24

Please sign in to comment.