mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-10 01:02:08 +01:00
Add site-specific scriptlet
Related issue: https://github.com/uBlockOrigin/uAssets/issues/19903
This commit is contained in:
parent
1ff3878a49
commit
d3b95c1c68
1 changed files with 23 additions and 0 deletions
|
@ -3452,6 +3452,29 @@ function preventCanvas(
|
|||
});
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
builtinScriptlets.push({
|
||||
name: 'multiup.js',
|
||||
fn: multiup,
|
||||
world: 'ISOLATED',
|
||||
});
|
||||
function multiup() {
|
||||
const handler = ev => {
|
||||
const target = ev.target;
|
||||
if ( target.matches('button[link]') === false ) { return; }
|
||||
const ancestor = target.closest('form');
|
||||
if ( ancestor === null ) { return; }
|
||||
if ( ancestor !== target.parentElement ) { return; }
|
||||
const link = (target.getAttribute('link') || '').trim();
|
||||
if ( link === '' ) { return; }
|
||||
ev.preventDefault();
|
||||
ev.stopPropagation();
|
||||
document.location.href = link;
|
||||
};
|
||||
document.addEventListener('click', handler, { capture: true });
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue