Skip to content

Commit 6b6ed91

Browse files
committed
Stop using :visible ✋
1 parent e7400f9 commit 6b6ed91

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/inject/inject.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@ function initOnHashChangeAction(domains) {
6565
function initShortcuts(shortcut, backgroundShortcut) {
6666
$(document).on("keydown", function(event) {
6767
// Shortcut: bind user's combination, if a button exist and event not in a textarea
68-
if( processRightCombinationBasedOnShortcut(shortcut, event) && window.idled && $(".github-link:visible")[0] && notAnInput(event.target)) {
68+
if( processRightCombinationBasedOnShortcut(shortcut, event) && window.idled && getVisible(document.getElementsByClassName('github-link')) && notAnInput(event.target)) {
6969
triggerGitHubLink(false)
7070
}
7171

7272
// Bacground Shortcut: bind user's combination, if a button exist and event not in a textarea
73-
if( processRightCombinationBasedOnShortcut(backgroundShortcut, event) && window.idled && $(".github-link:visible")[0] && notAnInput(event.target)) {
73+
if( processRightCombinationBasedOnShortcut(backgroundShortcut, event) && window.idled && getVisible(document.getElementsByClassName('github-link')) && notAnInput(event.target)) {
7474
triggerGitHubLink(true)
7575
}
7676
})
@@ -92,7 +92,7 @@ function triggerGitHubLink (backgroundOrNot) {
9292
window.idled = false
9393
event = backgroundOrNot ? fakeBackgroundClick() : fakeEvent('click')
9494

95-
$(".github-link:visible")[0].dispatchEvent(event)
95+
getVisible(document.getElementsByClassName('github-link')).dispatchEvent(event)
9696
setTimeout( function(){ window.idled = true }, 100)
9797
}
9898

0 commit comments

Comments
 (0)