mirror of https://github.com/gorhill/uBlock.git
Add site-specific scriptlet
Related issue: https://github.com/uBlockOrigin/uAssets/issues/19903
This commit is contained in:
parent
1ff3878a49
commit
d3b95c1c68
|
@ -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 New Issue