Skip to content

Commit

Permalink
Add scriptlet aliases for compatibility with AdGuard lists
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhill committed Sep 28, 2023
1 parent c3cd596 commit 4e2aa3e
Showing 1 changed file with 21 additions and 12 deletions.
33 changes: 21 additions & 12 deletions assets/resources/scriptlets.js
Original file line number Diff line number Diff line change
Expand Up @@ -1441,11 +1441,12 @@ function evaldataPrune(
/******************************************************************************/

builtinScriptlets.push({
name: 'nano-setInterval-booster.js',
name: 'adjust-setInterval.js',
aliases: [
'nano-setInterval-booster.js',
'nano-sib.js',
],
fn: nanoSetIntervalBooster,
fn: adjustSetInterval,
dependencies: [
'safe-self.fn',
],
Expand All @@ -1462,7 +1463,7 @@ builtinScriptlets.push({
// boostRatio - The delay multiplier when there is a match, 0.5 speeds up by
// 2 times and 2 slows down by 2 times, defaults to 0.05 or speed up
// 20 times. Speed up and down both cap at 50 times.
function nanoSetIntervalBooster(
function adjustSetInterval(
needleArg = '',
delayArg = '',
boostArg = ''
Expand Down Expand Up @@ -1493,11 +1494,12 @@ function nanoSetIntervalBooster(
/******************************************************************************/

builtinScriptlets.push({
name: 'nano-setTimeout-booster.js',
name: 'adjust-setTimeout.js',
aliases: [
'nano-setTimeout-booster.js',
'nano-stb.js',
],
fn: nanoSetTimeoutBooster,
fn: adjustSetTimeout,
dependencies: [
'safe-self.fn',
],
Expand All @@ -1515,7 +1517,7 @@ builtinScriptlets.push({
// boostRatio - The delay multiplier when there is a match, 0.5 speeds up by
// 2 times and 2 slows down by 2 times, defaults to 0.05 or speed up
// 20 times. Speed up and down both cap at 50 times.
function nanoSetTimeoutBooster(
function adjustSetTimeout(
needleArg = '',
delayArg = '',
boostArg = ''
Expand Down Expand Up @@ -1650,15 +1652,18 @@ function noFetchIf(
/******************************************************************************/

builtinScriptlets.push({
name: 'refresh-defuser.js',
fn: refreshDefuser,
name: 'prevent-refresh.js',
aliases: [
'refresh-defuser.js',
],
fn: preventRefresh,
world: 'ISOLATED',
dependencies: [
'run-at.fn',
],
});
// https://www.reddit.com/r/uBlockOrigin/comments/q0frv0/while_reading_a_sports_article_i_was_redirected/hf7wo9v/
function refreshDefuser(
function preventRefresh(
arg1 = ''
) {
if ( typeof arg1 !== 'string' ) { return; }
Expand Down Expand Up @@ -2294,16 +2299,20 @@ function noWindowOpenIf(
/******************************************************************************/

builtinScriptlets.push({
name: 'window-close-if.js',
fn: windowCloseIf,
name: 'close-window.js',
aliases: [
'window-close-if.js',
],
fn: closeWindow,
world: 'ISOLATED',
dependencies: [
'safe-self.fn',
],
});
// https://github.com/uBlockOrigin/uAssets/issues/10323#issuecomment-992312847
// https://github.com/AdguardTeam/Scriptlets/issues/158
// https://github.com/uBlockOrigin/uBlock-issues/discussions/2270
function windowCloseIf(
function closeWindow(
arg1 = ''
) {
if ( typeof arg1 !== 'string' ) { return; }
Expand Down

0 comments on commit 4e2aa3e

Please sign in to comment.