mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-24 03:12:46 +01:00
Fix breaking navigation through links [regression]
Regression from: - https://github.com/uBlockOrigin/uBlock-issues/issues/1797
This commit is contained in:
parent
c25cfd2116
commit
b63415a3db
@ -61,14 +61,15 @@ const onMaybeSubscriptionLinkClicked = function(target) {
|
|||||||
}
|
}
|
||||||
const location = subscribeURL.searchParams.get('location') || '';
|
const location = subscribeURL.searchParams.get('location') || '';
|
||||||
const title = subscribeURL.searchParams.get('title') || '';
|
const title = subscribeURL.searchParams.get('title') || '';
|
||||||
if ( location === '' || title === '' ) { return; }
|
if ( location === '' || title === '' ) { return true; }
|
||||||
// https://github.com/uBlockOrigin/uBlock-issues/issues/1797
|
// https://github.com/uBlockOrigin/uBlock-issues/issues/1797
|
||||||
if ( /^(file|https?):\/\//.test(location) === false ) { return; }
|
if ( /^(file|https?):\/\//.test(location) === false ) { return true; }
|
||||||
vAPI.messaging.send('scriptlets', {
|
vAPI.messaging.send('scriptlets', {
|
||||||
what: 'subscribeTo',
|
what: 'subscribeTo',
|
||||||
location,
|
location,
|
||||||
title,
|
title,
|
||||||
});
|
});
|
||||||
|
return true;
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -80,9 +81,10 @@ document.addEventListener('click', ev => {
|
|||||||
if ( ev.button !== 0 || ev.isTrusted === false ) { return; }
|
if ( ev.button !== 0 || ev.isTrusted === false ) { return; }
|
||||||
const target = ev.target.closest('a');
|
const target = ev.target.closest('a');
|
||||||
if ( target instanceof HTMLAnchorElement === false ) { return; }
|
if ( target instanceof HTMLAnchorElement === false ) { return; }
|
||||||
onMaybeSubscriptionLinkClicked(target);
|
if ( onMaybeSubscriptionLinkClicked(target) === true ) {
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
Loading…
Reference in New Issue
Block a user