diff --git a/package.json b/package.json index 71dab27..9fa1fcc 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "index.js", "type": "module", "scripts": { - "build": "deno build.ts --tagName 1.66.5b2 > ubo.js", + "build": "deno build.ts --tagName 1.67.0 > ubo.js", "test": "node --test" }, "author": { diff --git a/ubo.js b/ubo.js index 3895c67..033e856 100644 --- a/ubo.js +++ b/ubo.js @@ -1542,35 +1542,17 @@ function hrefSanitizer( } return ''; }; - const extractParam = (href, source) => { - if ( Boolean(source) === false ) { return href; } - const recursive = source.includes('?', 1); - const end = recursive ? source.indexOf('?', 1) : source.length; - try { - const url = new URL(href, document.location); - let value = url.searchParams.get(source.slice(1, end)); - if ( value === null ) { return href } - if ( recursive ) { return extractParam(value, source.slice(end)); } - return value; - } catch { - } - return href; - }; const extractURL = (elem, source) => { if ( /^\[.*\]$/.test(source) ) { return elem.getAttribute(source.slice(1,-1).trim()) || ''; } if ( source === 'text' ) { return elem.textContent - .replace(/^[^\x21-\x7e]+/, '') // remove leading invalid characters - .replace(/[^\x21-\x7e]+$/, '') // remove trailing invalid characters - ; - } - if ( source.startsWith('?') === false ) { return ''; } - const steps = source.replace(/(\S)\?/g, '\\1?').split(/\s+/); - const url = steps.length === 1 - ? extractParam(elem.href, source) - : urlSkip(elem.href, false, steps); + .replace(/^[^\x21-\x7e]+/, '') // remove leading invalid characters + .replace(/[^\x21-\x7e]+$/, ''); // remove trailing invalid characters + } + const steps = source.replace(/(\S)\?/g, '\\1 ?').split(/\s+/); + const url = urlSkip(elem.href, false, steps); if ( url === undefined ) { return; } return url.replace(/ /g, '%20'); }; @@ -32168,6 +32150,9 @@ function trustedClickElement( if ( typeof steps[i-1] !== 'string' ) { continue; } steps.splice(i, 0, clickDelay); } + if ( steps.length === 1 && delay !== '' ) { + steps.unshift(clickDelay); + } if ( typeof steps.at(-1) !== 'number' ) { steps.push(10000); }