mirror of
https://github.com/gorhill/uBlock.git
synced 2024-10-06 09:37:12 +02:00
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
Block a user