Skip to content

Commit 7dec5f0

Browse files
ghostery-adblocker-bot[bot]Ghostery Adblocker Bot
andauthored
Update scriptlets (#29)
Co-authored-by: Ghostery Adblocker Bot <ghostery-adblocker-bot@users.noreply.github.com>
1 parent dfe3cea commit 7dec5f0

File tree

2 files changed

+9
-24
lines changed

2 files changed

+9
-24
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"main": "index.js",
66
"type": "module",
77
"scripts": {
8-
"build": "deno build.ts --tagName 1.66.5b2 > ubo.js",
8+
"build": "deno build.ts --tagName 1.67.0 > ubo.js",
99
"test": "node --test"
1010
},
1111
"author": {

ubo.js

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1542,35 +1542,17 @@ function hrefSanitizer(
15421542
}
15431543
return '';
15441544
};
1545-
const extractParam = (href, source) => {
1546-
if ( Boolean(source) === false ) { return href; }
1547-
const recursive = source.includes('?', 1);
1548-
const end = recursive ? source.indexOf('?', 1) : source.length;
1549-
try {
1550-
const url = new URL(href, document.location);
1551-
let value = url.searchParams.get(source.slice(1, end));
1552-
if ( value === null ) { return href }
1553-
if ( recursive ) { return extractParam(value, source.slice(end)); }
1554-
return value;
1555-
} catch {
1556-
}
1557-
return href;
1558-
};
15591545
const extractURL = (elem, source) => {
15601546
if ( /^\[.*\]$/.test(source) ) {
15611547
return elem.getAttribute(source.slice(1,-1).trim()) || '';
15621548
}
15631549
if ( source === 'text' ) {
15641550
return elem.textContent
1565-
.replace(/^[^\x21-\x7e]+/, '') // remove leading invalid characters
1566-
.replace(/[^\x21-\x7e]+$/, '') // remove trailing invalid characters
1567-
;
1568-
}
1569-
if ( source.startsWith('?') === false ) { return ''; }
1570-
const steps = source.replace(/(\S)\?/g, '\\1?').split(/\s+/);
1571-
const url = steps.length === 1
1572-
? extractParam(elem.href, source)
1573-
: urlSkip(elem.href, false, steps);
1551+
.replace(/^[^\x21-\x7e]+/, '') // remove leading invalid characters
1552+
.replace(/[^\x21-\x7e]+$/, ''); // remove trailing invalid characters
1553+
}
1554+
const steps = source.replace(/(\S)\?/g, '\\1 ?').split(/\s+/);
1555+
const url = urlSkip(elem.href, false, steps);
15741556
if ( url === undefined ) { return; }
15751557
return url.replace(/ /g, '%20');
15761558
};
@@ -32168,6 +32150,9 @@ function trustedClickElement(
3216832150
if ( typeof steps[i-1] !== 'string' ) { continue; }
3216932151
steps.splice(i, 0, clickDelay);
3217032152
}
32153+
if ( steps.length === 1 && delay !== '' ) {
32154+
steps.unshift(clickDelay);
32155+
}
3217132156
if ( typeof steps.at(-1) !== 'number' ) {
3217232157
steps.push(10000);
3217332158
}

0 commit comments

Comments
 (0)