Skip to content

Commit 5c1ccff

Browse files
author
Atlassian Bamboo
committed
deploy: update dist v1.9.61
1 parent 5e507b5 commit 5c1ccff

File tree

6 files changed

+82
-7
lines changed

6 files changed

+82
-7
lines changed

dist/build.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version=1.9.58
1+
version=1.9.61

dist/redirects.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#
22
# AdGuard Scriptlets (Redirects Source)
3-
# Version 1.9.58
3+
# Version 1.9.61
44
#
55
- title: 1x1-transparent.gif
66
added: v1.0.4

dist/scriptlets.corelibs.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "1.9.58",
2+
"version": "1.9.61",
33
"scriptlets": [
44
{
55
"names": [

dist/scriptlets.js

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
/**
33
* AdGuard Scriptlets
4-
* Version 1.9.58
4+
* Version 1.9.61
55
*/
66

77
(function () {
@@ -10394,6 +10394,7 @@
1039410394
var REMOVE_ATTR_ALIASES = scriptletList[REMOVE_ATTR_METHOD].names;
1039510395
var REMOVE_CLASS_ALIASES = scriptletList[REMOVE_CLASS_METHOD].names;
1039610396
var REMOVE_ATTR_CLASS_APPLYING = ['asap', 'stay', 'complete'];
10397+
var ABP_RESOURCE_MARKER = 'abp-resource:';
1039710398

1039810399
/**
1039910400
* Possible rule origins.
@@ -10668,10 +10669,11 @@
1066810669
};
1066910670

1067010671
/**
10671-
* Converts UBO scriptlet rule to AdGuard one
10672+
* Converts AdGuard scriptlet rule to UBO syntax.
1067210673
*
1067310674
* @param rule AdGuard scriptlet rule
1067410675
* @returns UBO scriptlet rule
10676+
* or undefined if `rule` is not valid AdGuard scriptlet rule.
1067510677
*/
1067610678
var convertAdgScriptletToUbo = function convertAdgScriptletToUbo(rule) {
1067710679
var res;
@@ -10955,6 +10957,37 @@
1095510957
return "".concat(basePart, "$").concat(uboModifiers);
1095610958
};
1095710959

10960+
/**
10961+
* Converts a redirect name to ADG compatible one, if possible
10962+
*
10963+
* @param name Redirect name to convert
10964+
* @returns Converted ADG compatible redirect name or `undefined` if the redirect isn't supported
10965+
*/
10966+
var convertRedirectNameToAdg = function convertRedirectNameToAdg(name) {
10967+
var nameToCheck = name.trim();
10968+
10969+
// Check if the redirect is already ADG compatible
10970+
if (validator.REDIRECT_RULE_TYPES.ADG.compatibility[nameToCheck]) {
10971+
return nameToCheck;
10972+
}
10973+
10974+
// Convert uBO redirects to ADG
10975+
if (validator.REDIRECT_RULE_TYPES.UBO.compatibility[nameToCheck]) {
10976+
return validator.REDIRECT_RULE_TYPES.UBO.compatibility[nameToCheck];
10977+
}
10978+
10979+
// Convert ABP redirects to ADG
10980+
// AGTree parses '$rewrite=abp-resource:blank-js' as 'rewrite' modifier with
10981+
// 'abp-resource:blank-js' value. So at this point we have to check if the
10982+
// redirect name starts with 'abp-resource:' and remove it if it does.
10983+
if (nameToCheck.startsWith(ABP_RESOURCE_MARKER)) {
10984+
nameToCheck = nameToCheck.slice(ABP_RESOURCE_MARKER.length).trim();
10985+
}
10986+
10987+
// This also returns `undefined` if the redirect isn't supported
10988+
return validator.REDIRECT_RULE_TYPES.ABP.compatibility[nameToCheck];
10989+
};
10990+
1095810991
/**
1095910992
* @redirect google-analytics
1096010993
*
@@ -16653,6 +16686,7 @@
1665316686
convertUboRedirectToAdg,
1665416687
convertAbpRedirectToAdg,
1665516688
convertRedirectToAdg,
16689+
convertRedirectNameToAdg,
1665616690
convertAdgRedirectToUbo
1665716691
};
1665816692

dist/umd/scriptlets.d.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,5 +190,12 @@ declare module '@adguard/scriptlets' {
190190
* @param rule
191191
*/
192192
convertRedirectToAdg(rule: string): string;
193+
194+
/**
195+
* Converts a redirect name to AdGuard one
196+
*
197+
* @param name
198+
*/
199+
convertRedirectNameToAdg(name: string): string | undefined;
193200
};
194201
}

dist/umd/scriptlets.umd.js

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
/**
33
* AdGuard Scriptlets
4-
* Version 1.9.58
4+
* Version 1.9.61
55
*/
66

77
(function (factory) {
@@ -10396,6 +10396,7 @@
1039610396
var REMOVE_ATTR_ALIASES = scriptletList[REMOVE_ATTR_METHOD].names;
1039710397
var REMOVE_CLASS_ALIASES = scriptletList[REMOVE_CLASS_METHOD].names;
1039810398
var REMOVE_ATTR_CLASS_APPLYING = ['asap', 'stay', 'complete'];
10399+
var ABP_RESOURCE_MARKER = 'abp-resource:';
1039910400

1040010401
/**
1040110402
* Possible rule origins.
@@ -10670,10 +10671,11 @@
1067010671
};
1067110672

1067210673
/**
10673-
* Converts UBO scriptlet rule to AdGuard one
10674+
* Converts AdGuard scriptlet rule to UBO syntax.
1067410675
*
1067510676
* @param rule AdGuard scriptlet rule
1067610677
* @returns UBO scriptlet rule
10678+
* or undefined if `rule` is not valid AdGuard scriptlet rule.
1067710679
*/
1067810680
var convertAdgScriptletToUbo = function convertAdgScriptletToUbo(rule) {
1067910681
var res;
@@ -10957,6 +10959,37 @@
1095710959
return "".concat(basePart, "$").concat(uboModifiers);
1095810960
};
1095910961

10962+
/**
10963+
* Converts a redirect name to ADG compatible one, if possible
10964+
*
10965+
* @param name Redirect name to convert
10966+
* @returns Converted ADG compatible redirect name or `undefined` if the redirect isn't supported
10967+
*/
10968+
var convertRedirectNameToAdg = function convertRedirectNameToAdg(name) {
10969+
var nameToCheck = name.trim();
10970+
10971+
// Check if the redirect is already ADG compatible
10972+
if (validator.REDIRECT_RULE_TYPES.ADG.compatibility[nameToCheck]) {
10973+
return nameToCheck;
10974+
}
10975+
10976+
// Convert uBO redirects to ADG
10977+
if (validator.REDIRECT_RULE_TYPES.UBO.compatibility[nameToCheck]) {
10978+
return validator.REDIRECT_RULE_TYPES.UBO.compatibility[nameToCheck];
10979+
}
10980+
10981+
// Convert ABP redirects to ADG
10982+
// AGTree parses '$rewrite=abp-resource:blank-js' as 'rewrite' modifier with
10983+
// 'abp-resource:blank-js' value. So at this point we have to check if the
10984+
// redirect name starts with 'abp-resource:' and remove it if it does.
10985+
if (nameToCheck.startsWith(ABP_RESOURCE_MARKER)) {
10986+
nameToCheck = nameToCheck.slice(ABP_RESOURCE_MARKER.length).trim();
10987+
}
10988+
10989+
// This also returns `undefined` if the redirect isn't supported
10990+
return validator.REDIRECT_RULE_TYPES.ABP.compatibility[nameToCheck];
10991+
};
10992+
1096010993
/**
1096110994
* @redirect google-analytics
1096210995
*
@@ -16655,6 +16688,7 @@
1665516688
convertUboRedirectToAdg,
1665616689
convertAbpRedirectToAdg,
1665716690
convertRedirectToAdg,
16691+
convertRedirectNameToAdg,
1665816692
convertAdgRedirectToUbo
1665916693
};
1666016694

0 commit comments

Comments
 (0)