Skip to content

Commit

Permalink
Moved env.browser.isMobile check to toggle.tooltip() to unconditi…
Browse files Browse the repository at this point in the history
…onally make `tooltipDiv` to support use for future menus
  • Loading branch information
adamlui committed Feb 4, 2025
1 parent 54bb498 commit 9a1256c
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 73 deletions.
34 changes: 16 additions & 18 deletions amazongpt/greasemonkey/amazongpt.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// @description Adds the magic of AI to Amazon shopping
// @author KudoAI
// @namespace https://kudoai.com
// @version 2025.2.4.6
// @version 2025.2.4.7
// @license MIT
// @icon https://amazongpt.kudoai.com/assets/images/icons/amazongpt/black-gold-teal/icon48.png?v=0fddfc7
// @icon64 https://amazongpt.kudoai.com/assets/images/icons/amazongpt/black-gold-teal/icon64.png?v=0fddfc7
Expand Down Expand Up @@ -2003,8 +2003,7 @@
get.reply(msgChain)

// Hide/remove elems
if (!env.browser.isMobile) // hide 'Send reply' tooltip post-send btn click
tooltipDiv.style.opacity = 0
tooltipDiv.style.opacity = 0 // hide chatbar button tooltips

// Show loading status
const replySection = appDiv.querySelector('section')
Expand Down Expand Up @@ -2296,7 +2295,7 @@
}
}
update.appBottomPos() // toggle visual minimization
if (!env.browser.isMobile) setTimeout(() => tooltipDiv.style.opacity = 0, 1) // remove lingering tooltip
setTimeout(() => tooltipDiv.style.opacity = 0, 1) // remove lingering tooltip
},

proxyMode() {
Expand Down Expand Up @@ -2349,6 +2348,7 @@
},

tooltip(event) {
if (env.browser.isMobile) return
if (event.type == 'mouseleave') { tooltipDiv.style.opacity = 0 ; return }

const btn = event.currentTarget, btnType = /[^-]+-([\w-]+)-btn/.exec(btn.id)[1],
Expand Down Expand Up @@ -3122,20 +3122,18 @@
document.head.append(dom.create.style(GM_getResourceText(`${cssType}CSS`))))

// Create/stylize TOOLTIPs
if (!env.browser.isMobile) {
var tooltipDiv = dom.create.elem('div', { class: `${app.slug}-btn-tooltip no-user-select` })
document.head.append(dom.create.style(`.${app.slug}-btn-tooltip {`
+ 'background-color:' // bubble style
+ 'rgba(0,0,0,0.64) ; padding: 4px 6px ; border-radius: 6px ; border: 1px solid #d9d9e3 ;'
+ 'font-size: 0.87em ; color: white ; fill: white ; stroke: white ;' // font/icon style
+ 'position: absolute ;' // for update.tooltip() calcs
+ `--shadow: 3px 5px 16px 0 rgb(0,0,0,0.21) ;
box-shadow: var(--shadow) ; -webkit-box-shadow: var(--shadow) ; -moz-box-shadow: var(--shadow)`
+ 'opacity: 0 ; height: fit-content ; z-index: 1250 ;' // visibility
+ 'transition: opacity 0.1s ; -webkit-transition: opacity 0.1s ; -moz-transition: opacity 0.1s ;'
+ '-o-transition: opacity 0.1s ; -ms-transition: opacity 0.1s }'
))
}
const tooltipDiv = dom.create.elem('div', { class: `${app.slug}-btn-tooltip no-user-select` })
document.head.append(dom.create.style(`.${app.slug}-btn-tooltip {`
+ 'background-color:' // bubble style
+ 'rgba(0,0,0,0.64) ; padding: 4px 6px ; border-radius: 6px ; border: 1px solid #d9d9e3 ;'
+ 'font-size: 0.87em ; color: white ; fill: white ; stroke: white ;' // font/icon style
+ 'position: absolute ;' // for update.tooltip() calcs
+ `--shadow: 3px 5px 16px 0 rgb(0,0,0,0.21) ;
box-shadow: var(--shadow) ; -webkit-box-shadow: var(--shadow) ; -moz-box-shadow: var(--shadow)`
+ 'opacity: 0 ; height: fit-content ; z-index: 1250 ;' // visibility
+ 'transition: opacity 0.1s ; -webkit-transition: opacity 0.1s ; -moz-transition: opacity 0.1s ;'
+ '-o-transition: opacity 0.1s ; -ms-transition: opacity 0.1s }'
))

// APPEND AMAZONGPT to Amazon
document.body.append(appDiv)
Expand Down
34 changes: 16 additions & 18 deletions bravegpt/greasemonkey/bravegpt.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
// @description:zu Yengeza izimpendulo ze-AI ku-Brave Search (inikwa amandla yi-GPT-4o!)
// @author KudoAI
// @namespace https://kudoai.com
// @version 2025.2.4.6
// @version 2025.2.4.7
// @license MIT
// @icon https://assets.bravegpt.com/images/icons/bravegpt/icon48.png?v=df624b0
// @icon64 https://assets.bravegpt.com/images/icons/bravegpt/icon64.png?v=df624b0
Expand Down Expand Up @@ -2584,8 +2584,7 @@

// Hide/remove elems
appDiv.querySelector(`.${app.slug}-related-queries`)?.remove() // remove related queries
if (!env.browser.isMobile) // hide chatbar button tooltips
tooltipDiv.style.opacity = 0
tooltipDiv.style.opacity = 0 // hide chatbar button tooltips
appDiv.querySelector('footer').textContent = ''

// Show loading status
Expand Down Expand Up @@ -2940,7 +2939,7 @@
}
}
update.appBottomPos() // toggle visual minimization
if (!env.browser.isMobile) setTimeout(() => tooltipDiv.style.opacity = 0, 1) // remove lingering tooltip
setTimeout(() => tooltipDiv.style.opacity = 0, 1) // remove lingering tooltip
},

proxyMode() {
Expand Down Expand Up @@ -3031,6 +3030,7 @@
},

tooltip(event) {
if (env.browser.isMobile) return
if (event.type == 'mouseleave') { tooltipDiv.style.opacity = 0 ; return }

const btn = event.currentTarget, btnType = /[^-]+-([\w-]+)-btn/.exec(btn.id)[1],
Expand Down Expand Up @@ -3994,20 +3994,18 @@
document.head.append(dom.create.style(GM_getResourceText(`${cssType}CSS`))))

// Create/stylize TOOLTIPs
if (!env.browser.isMobile) {
var tooltipDiv = dom.create.elem('div', { class: `${app.slug}-btn-tooltip no-user-select` })
document.head.append(dom.create.style(`.${app.slug}-btn-tooltip {`
+ 'background-color:' // bubble style
+ 'rgba(0,0,0,0.64) ; padding: 4px 6px 4px ; border-radius: 6px ; border: 1px solid #d9d9e3 ;'
+ 'font-size: 0.58rem ; color: white ; fill: white ; stroke: white ;' // font/icon style
+ 'position: absolute ;' // for update.tooltip() calcs
+ `--shadow: 3px 5px 16px 0 rgb(0,0,0,0.21) ;
box-shadow: var(--shadow) ; -webkit-box-shadow: var(--shadow) ; -moz-box-shadow: var(--shadow)`
+ 'opacity: 0 ; height: fit-content ; z-index: 1250 ;' // visibility
+ 'transition: opacity 0.1s ; -webkit-transition: opacity 0.1s ; -moz-transition: opacity 0.1s ;'
+ '-o-transition: opacity 0.1s ; -ms-transition: opacity 0.1s }'
))
}
const tooltipDiv = dom.create.elem('div', { class: `${app.slug}-btn-tooltip no-user-select` })
document.head.append(dom.create.style(`.${app.slug}-btn-tooltip {`
+ 'background-color:' // bubble style
+ 'rgba(0,0,0,0.64) ; padding: 4px 6px 4px ; border-radius: 6px ; border: 1px solid #d9d9e3 ;'
+ 'font-size: 0.58rem ; color: white ; fill: white ; stroke: white ;' // font/icon style
+ 'position: absolute ;' // for update.tooltip() calcs
+ `--shadow: 3px 5px 16px 0 rgb(0,0,0,0.21) ;
box-shadow: var(--shadow) ; -webkit-box-shadow: var(--shadow) ; -moz-box-shadow: var(--shadow)`
+ 'opacity: 0 ; height: fit-content ; z-index: 1250 ;' // visibility
+ 'transition: opacity 0.1s ; -webkit-transition: opacity 0.1s ; -moz-transition: opacity 0.1s ;'
+ '-o-transition: opacity 0.1s ; -ms-transition: opacity 0.1s }'
))

// APPEND to Brave
const appDivParentSelector = env.browser.isMobile ? '#results' : '.sidebar'
Expand Down
37 changes: 17 additions & 20 deletions duckduckgpt/greasemonkey/duckduckgpt.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
// @description:zu Yengeza izimpendulo ze-AI ku-DuckDuckGo (inikwa amandla yi-GPT-4o!)
// @author KudoAI
// @namespace https://kudoai.com
// @version 2025.2.4.5
// @version 2025.2.4.6
// @license MIT
// @icon https://assets.ddgpt.com/images/icons/duckduckgpt/icon48.png?v=06af076
// @icon64 https://assets.ddgpt.com/images/icons/duckduckgpt/icon64.png?v=06af076
Expand Down Expand Up @@ -2586,8 +2586,7 @@

// Hide/remove elems
appDiv.querySelector(`.${app.slug}-related-queries`)?.remove() // remove related queries
if (!env.browser.isMobile) // hide chatbar button tooltips
tooltipDiv.style.opacity = 0
tooltipDiv.style.opacity = 0 // hide chatbar button tooltips

// Show loading status
const replySection = appDiv.querySelector('section')
Expand Down Expand Up @@ -2943,7 +2942,7 @@
}
}
update.appBottomPos() // toggle visual minimization
if (!env.browser.isMobile) setTimeout(() => tooltipDiv.style.opacity = 0, 1) // remove lingering tooltip
setTimeout(() => tooltipDiv.style.opacity = 0, 1) // remove lingering tooltip
},

proxyMode() {
Expand Down Expand Up @@ -3034,6 +3033,7 @@
},

tooltip(event) {
if (env.browser.isMobile) return
if (event.type == 'mouseleave') { tooltipDiv.style.opacity = 0 ; return }

const btn = event.currentTarget, btnType = /[^-]+-([\w-]+)-btn/.exec(btn.id)[1],
Expand Down Expand Up @@ -3708,8 +3708,7 @@
},

reply(answer) {
if (!env.browser.isMobile) // hide lingering tooltip if cursor was on corner button
tooltipDiv.style.opacity = 0
tooltipDiv.style.opacity = 0 // hide lingering tooltip if cursor was on corner button

// Build answer interface up to reply section if missing
if (!appDiv.querySelector('pre')) {
Expand Down Expand Up @@ -3984,20 +3983,18 @@
document.head.append(dom.create.style(GM_getResourceText(`${cssType}CSS`))))

// Create/stylize TOOLTIPs
if (!env.browser.isMobile) {
var tooltipDiv = dom.create.elem('div', { class: `${app.slug}-btn-tooltip no-user-select` })
document.head.append(dom.create.style(`.${app.slug}-btn-tooltip {`
+ 'background-color:' // bubble style
+ 'rgba(0,0,0,0.64) ; padding: 5px 6px 3px ; border-radius: 6px ; border: 1px solid #d9d9e3 ;'
+ 'font-size: 0.87em ; color: white ; fill: white ; stroke: white ;' // font/icon style
+ 'position: absolute ;' // for update.tooltip() calcs
+ `--shadow: 3px 5px 16px 0 rgb(0,0,0,0.21) ;
box-shadow: var(--shadow) ; -webkit-box-shadow: var(--shadow) ; -moz-box-shadow: var(--shadow)`
+ 'opacity: 0 ; height: fit-content ; z-index: 1250 ;' // visibility
+ 'transition: opacity 0.1s ; -webkit-transition: opacity 0.1s ; -moz-transition: opacity 0.1s ;'
+ '-o-transition: opacity 0.1s ; -ms-transition: opacity 0.1s }'
))
}
const tooltipDiv = dom.create.elem('div', { class: `${app.slug}-btn-tooltip no-user-select` })
document.head.append(dom.create.style(`.${app.slug}-btn-tooltip {`
+ 'background-color:' // bubble style
+ 'rgba(0,0,0,0.64) ; padding: 5px 6px 3px ; border-radius: 6px ; border: 1px solid #d9d9e3 ;'
+ 'font-size: 0.87em ; color: white ; fill: white ; stroke: white ;' // font/icon style
+ 'position: absolute ;' // for update.tooltip() calcs
+ `--shadow: 3px 5px 16px 0 rgb(0,0,0,0.21) ;
box-shadow: var(--shadow) ; -webkit-box-shadow: var(--shadow) ; -moz-box-shadow: var(--shadow)`
+ 'opacity: 0 ; height: fit-content ; z-index: 1250 ;' // visibility
+ 'transition: opacity 0.1s ; -webkit-transition: opacity 0.1s ; -moz-transition: opacity 0.1s ;'
+ '-o-transition: opacity 0.1s ; -ms-transition: opacity 0.1s }'
))

// Create/classify/fill feedback FOOTER
const appFooter = dom.create.elem('footer', { class: 'fade-in anchored-hidden' })
Expand Down
33 changes: 16 additions & 17 deletions googlegpt/greasemonkey/googlegpt.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
// @description:zu Yengeza izimpendulo ze-AI ku-Google Search (inikwa amandla yi-Google Gemma + GPT-4o!)
// @author KudoAI
// @namespace https://kudoai.com
// @version 2025.2.4.6
// @version 2025.2.4.7
// @license MIT
// @icon https://assets.googlegpt.io/images/icons/googlegpt/black/icon48.png?v=59409b2
// @icon64 https://assets.googlegpt.io/images/icons/googlegpt/black/icon64.png?v=59409b2
Expand Down Expand Up @@ -2747,8 +2747,7 @@

// Hide/remove elems
appDiv.querySelector(`.${app.slug}-related-queries`)?.remove() // remove related queries
if (!env.browser.isMobile) // hide chatbar button tooltips
tooltipDiv.style.opacity = 0
tooltipDiv.style.opacity = 0 // hide chatbar button tooltips
appDiv.querySelector('footer').textContent = ''

// Show loading status
Expand Down Expand Up @@ -3111,7 +3110,7 @@
}
}
update.appBottomPos() // toggle visual minimization
if (!env.browser.isMobile) setTimeout(() => tooltipDiv.style.opacity = 0, 1) // remove lingering tooltip
setTimeout(() => tooltipDiv.style.opacity = 0, 1) // remove lingering tooltip
},

proxyMode() {
Expand Down Expand Up @@ -3203,6 +3202,7 @@
},

tooltip(event) {
if (env.browser.isMobile) return
if (event.type == 'mouseleave') { tooltipDiv.style.opacity = 0 ; return }

const btn = event.currentTarget, btnType = /[^-]+-([\w-]+)-btn/.exec(btn.id)[1],
Expand Down Expand Up @@ -4181,19 +4181,18 @@
document.head.append(dom.create.style(GM_getResourceText(`${cssType}CSS`))))

// Create/stylize TOOLTIPs
if (!env.browser.isMobile) {
var tooltipDiv = dom.create.elem('div', { class: `${app.slug}-btn-tooltip no-user-select` })
document.head.append(dom.create.style(`.${app.slug}-btn-tooltip {`
+ 'background-color: rgba(0,0,0,0.64) ; padding: 6px ; border-radius: 6px ; border: 1px solid #d9d9e3 ;' // bubble style
+ 'font-size: 0.75rem ; color: white ; fill: white ; stroke: white ;' // font/icon style
+ 'position: absolute ;' // for update.tooltip() calcs
+ `--shadow: 3px 5px 16px 0 rgb(0,0,0,0.21) ;
box-shadow: var(--shadow) ; -webkit-box-shadow: var(--shadow) ; -moz-box-shadow: var(--shadow)`
+ 'opacity: 0 ; height: fit-content ; z-index: 1250 ;' // visibility
+ 'transition: opacity 0.1s ; -webkit-transition: opacity 0.1s ; -moz-transition: opacity 0.1s ;'
+ '-o-transition: opacity 0.1s ; -ms-transition: opacity 0.1s }'
))
}
const tooltipDiv = dom.create.elem('div', { class: `${app.slug}-btn-tooltip no-user-select` })
document.head.append(dom.create.style(`.${app.slug}-btn-tooltip {`
+ 'background-color:' // // bubble style
+ 'rgba(0,0,0,0.64) ; padding: 6px ; border-radius: 6px ; border: 1px solid #d9d9e3 ;'
+ 'font-size: 0.75rem ; color: white ; fill: white ; stroke: white ;' // font/icon style
+ 'position: absolute ;' // for update.tooltip() calcs
+ `--shadow: 3px 5px 16px 0 rgb(0,0,0,0.21) ;
box-shadow: var(--shadow) ; -webkit-box-shadow: var(--shadow) ; -moz-box-shadow: var(--shadow)`
+ 'opacity: 0 ; height: fit-content ; z-index: 1250 ;' // visibility
+ 'transition: opacity 0.1s ; -webkit-transition: opacity 0.1s ; -moz-transition: opacity 0.1s ;'
+ '-o-transition: opacity 0.1s ; -ms-transition: opacity 0.1s }'
))

// APPEND to Google
const centerCol = document.querySelector('#center_col') || document.querySelector('#main')
Expand Down

0 comments on commit 9a1256c

Please sign in to comment.