Handle replacement clicks even if a content placeholder is obstructed.
This commit is contained in:
parent
081ffddda6
commit
22393ac858
|
@ -72,9 +72,14 @@ var PlaceHolder = (() => {
|
||||||
static listen() {
|
static listen() {
|
||||||
PlaceHolder.listen = () => {};
|
PlaceHolder.listen = () => {};
|
||||||
window.addEventListener("click", ev => {
|
window.addEventListener("click", ev => {
|
||||||
if (ev.button === 0) {
|
if (ev.button === 0 && ev.isTrusted) {
|
||||||
let replacement = ev.target.closest("a.__NoScript_PlaceHolder__");
|
let ph, replacement;
|
||||||
let ph = replacement && ev.isTrusted && replacement._placeHolderObj;
|
for (let e of document.elementsFromPoint(ev.clientX, ev.clientY)) {
|
||||||
|
if (ph = e._placeHolderObj) {
|
||||||
|
replacement = e;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (ph) {
|
if (ph) {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
|
|
Loading…
Reference in New Issue