Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
inbasic committed Dec 23, 2023
1 parent ba5e00b commit 388276c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 25 deletions.
48 changes: 23 additions & 25 deletions v3.classic/data/popup/accessibility.js
Expand Up @@ -2,31 +2,29 @@
'use strict';

// Link opener for html
{
const opener = e => {
const target = e.target;

const a = target.closest('a') || target;
const link = a.dataset.href || a.href || a.src || target.src || target.href;

if (link) {
e.preventDefault();
e.stopPropagation();
chrome.runtime.sendMessage({
method: 'open',
url: {
link,
button: e.button,
ctrlKey: e.ctrlKey,
shiftKey: e.shiftKey,
altKey: e.altKey,
metaKey: e.metaKey
}
}, () => e.button === 0 ? window.close() : null);
}
};
addEventListener('click', opener);
}
const opener = self.opener = e => {
const target = e.target;

const a = target.closest('a') || target;
const link = a.dataset.href || a.href || a.src || target.src || target.href;

if (link) {
e.preventDefault();
e.stopPropagation();
chrome.runtime.sendMessage({
method: 'open',
url: {
link,
button: e.button,
ctrlKey: e.ctrlKey,
shiftKey: e.shiftKey,
altKey: e.altKey,
metaKey: e.metaKey
}
}, () => e.button === 0 ? window.close() : null);
}
};
addEventListener('click', opener);

// Support Gmail's keyboard shortcuts on the panel
{
Expand Down
6 changes: 6 additions & 0 deletions v3.classic/data/popup/body/index.js
Expand Up @@ -28,3 +28,9 @@
onclick = e => e.button === 0 && (e.ctrlKey || e.metaKey) && block(e);
onauxclick = e => e.button === 1 && block(e);
}

// Firefox
// https://github.com/inbasic/ignotifier/issues/636#issuecomment-1866121899
if (/Firefox/.test(navigator.userAgent)) {
addEventListener('click', top.opener);
}

0 comments on commit 388276c

Please sign in to comment.