Add site-specific scriptlet

Related issue:
https://github.com/uBlockOrigin/uAssets/issues/19903
This commit is contained in:
Raymond Hill 2023-09-29 12:51:44 -04:00
parent 1ff3878a49
commit d3b95c1c68
No known key found for this signature in database
GPG key ID: 25E1490B761470C2

View file

@ -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 });
}
/*******************************************************************************
*