fix yomichan menu on Firefox Android
This commit is contained in:
parent
8a94d186c3
commit
e3d96eb67d
@ -26,22 +26,24 @@ function showExtensionInfo() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setupButtonEvents(selector, command, url) {
|
function setupButtonEvents(selector, command, url) {
|
||||||
const node = document.querySelector(selector);
|
const nodes = document.querySelectorAll(selector);
|
||||||
node.addEventListener('click', (e) => {
|
for (const node of nodes) {
|
||||||
if (e.button !== 0) { return; }
|
node.addEventListener('click', (e) => {
|
||||||
apiCommandExec(command, {newTab: e.ctrlKey});
|
if (e.button !== 0) { return; }
|
||||||
e.preventDefault();
|
apiCommandExec(command, {newTab: e.ctrlKey});
|
||||||
}, false);
|
e.preventDefault();
|
||||||
node.addEventListener('auxclick', (e) => {
|
}, false);
|
||||||
if (e.button !== 1) { return; }
|
node.addEventListener('auxclick', (e) => {
|
||||||
apiCommandExec(command, {newTab: true});
|
if (e.button !== 1) { return; }
|
||||||
e.preventDefault();
|
apiCommandExec(command, {newTab: true});
|
||||||
}, false);
|
e.preventDefault();
|
||||||
|
}, false);
|
||||||
|
|
||||||
if (typeof url === 'string') {
|
if (typeof url === 'string') {
|
||||||
node.href = url;
|
node.href = url;
|
||||||
node.target = '_blank';
|
node.target = '_blank';
|
||||||
node.rel = 'noopener';
|
node.rel = 'noopener';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user