Skip to content

Commit

Permalink
Prevented link buttons from auto-dismissing modals ↞ [auto-sync from h…
Browse files Browse the repository at this point in the history
  • Loading branch information
kudo-sync-bot committed Dec 2, 2024
1 parent b889d92 commit 838ffc6
Showing 1 changed file with 37 additions and 12 deletions.
49 changes: 37 additions & 12 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.1.5
// @version 2024.12.1.6
// @license MIT
// @compatible chrome
// @compatible firefox
Expand Down Expand Up @@ -589,19 +589,29 @@
+ app.urls.gitHub + '</a></span>',
[ // buttons
function checkForUpdates() { updateCheck() },
function getSupport() { modals.safeWinOpen(app.urls.support) },
function getSupport(){},
function rateUs() { modals.feedback.show() },
function moreAIextensions() { modals.safeWinOpen(app.urls.relatedExtensions) }
function moreAIextensions(){}
], '', 546 // set width
)

// Re-style text
// Format text
aboutModal.querySelector('h2').style.cssText = 'text-align: center ; font-size: 37px ; padding: 9px'
aboutModal.querySelector('p').style.cssText = 'text-align: center'

// Re-format buttons to include emoji + localized label + hide Dismiss button
for (const btn of aboutModal.querySelectorAll('button')) {
btn.style.cssText = 'cursor: pointer !important' // since tweaks won't load on auto-disable
// Hack buttons
aboutModal.querySelectorAll('button').forEach(btn => {
btn.style.cssText = 'cursor: pointer !important' // since tweaks won't load on script auto-disable

// Replace link buttons w/ clones that don't dismissAlert()
if (/support|extensions/i.test(btn.textContent)) {
const btnClone = btn.cloneNode(true)
btn.parentNode.replaceChild(btnClone, btn) ; btn = btnClone
btn.onclick = () => modals.safeWinOpen(app.urls[
btn.textContent.includes(app.msgs.btnLabel_getSupport) ? 'support' : 'relatedExtensions' ])
}

// Prepend emoji + localize labels
if (/updates/i.test(btn.textContent)) btn.textContent = (
'🚀 ' + ( app.msgs.btnLabel_updateCheck ))
else if (/support/i.test(btn.textContent)) btn.textContent = (
Expand All @@ -610,8 +620,10 @@
'⭐ ' + ( app.msgs.btnLabel_rateUs ))
else if (/extensions/i.test(btn.textContent)) btn.textContent = (
'🤖 ' + ( app.msgs.btnLabel_moreAIextensions ))

// Hide Dismiss button
else btn.style.display = 'none' // hide Dismiss button
}
})
}
},

Expand All @@ -638,9 +650,9 @@
+ `<p>—<b><a target="_blank" rel="noopener" href="${app.author.url}">`
+ `${app.msgs.appAuthor}</a></b>, ${app.msgs.alert_author}</p>`,
[ // buttons
function paypal() { modals.safeWinOpen(app.urls.donate.payPal) },
function githubSponsors() { modals.safeWinOpen(app.urls.donate.gitHub) },
function cashApp() { modals.safeWinOpen(app.urls.donate.cashApp) },
function paypal(){},
function githubSponsors(){},
function cashApp(){},
function rateUs() { modals.feedback.show() }
], '', 478 // set width
)
Expand All @@ -649,9 +661,22 @@
donateModal.querySelectorAll('p').forEach(p => // v-pad text, shrink line height
p.style.cssText = 'padding: 8px 0 ; line-height: 20px')

// Format buttons
// Hack buttons
const btns = donateModal.querySelectorAll('button')
btns.forEach((btn, idx) => {

// Replace link buttons w/ clones that don't dismissAlert()
if (!/dismiss|rate/i.test(btn.textContent)) {
const btnClone = btn.cloneNode(true)
btn.parentNode.replaceChild(btnClone, btn) ; btn = btnClone
btn.onclick = () => modals.safeWinOpen(app.urls.donate[
btnClone.textContent == 'Cash App' ? 'cashApp'
: btnClone.textContent == 'GitHub' ? 'gitHub'
: 'payPal'
])
}

// Format buttons
if (idx == 0) btn.style.display = 'none' // hide Dismiss button
else {
btn.style.cssText = 'padding: 8px 6px !important ; margin-top: -14px ;'
Expand Down

0 comments on commit 838ffc6

Please sign in to comment.