Skip to content

Commit

Permalink
deploy: update dist v1.9.61
Browse files Browse the repository at this point in the history
  • Loading branch information
Atlassian Bamboo committed Aug 1, 2023
1 parent 5e507b5 commit 5c1ccff
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 7 deletions.
2 changes: 1 addition & 1 deletion dist/build.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version=1.9.58
version=1.9.61
2 changes: 1 addition & 1 deletion dist/redirects.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# AdGuard Scriptlets (Redirects Source)
# Version 1.9.58
# Version 1.9.61
#
- title: 1x1-transparent.gif
added: v1.0.4
Expand Down
2 changes: 1 addition & 1 deletion dist/scriptlets.corelibs.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.9.58",
"version": "1.9.61",
"scriptlets": [
{
"names": [
Expand Down
38 changes: 36 additions & 2 deletions dist/scriptlets.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

/**
* AdGuard Scriptlets
* Version 1.9.58
* Version 1.9.61
*/

(function () {
Expand Down Expand Up @@ -10394,6 +10394,7 @@
var REMOVE_ATTR_ALIASES = scriptletList[REMOVE_ATTR_METHOD].names;
var REMOVE_CLASS_ALIASES = scriptletList[REMOVE_CLASS_METHOD].names;
var REMOVE_ATTR_CLASS_APPLYING = ['asap', 'stay', 'complete'];
var ABP_RESOURCE_MARKER = 'abp-resource:';

/**
* Possible rule origins.
Expand Down Expand Up @@ -10668,10 +10669,11 @@
};

/**
* Converts UBO scriptlet rule to AdGuard one
* Converts AdGuard scriptlet rule to UBO syntax.
*
* @param rule AdGuard scriptlet rule
* @returns UBO scriptlet rule
* or undefined if `rule` is not valid AdGuard scriptlet rule.
*/
var convertAdgScriptletToUbo = function convertAdgScriptletToUbo(rule) {
var res;
Expand Down Expand Up @@ -10955,6 +10957,37 @@
return "".concat(basePart, "$").concat(uboModifiers);
};

/**
* Converts a redirect name to ADG compatible one, if possible
*
* @param name Redirect name to convert
* @returns Converted ADG compatible redirect name or `undefined` if the redirect isn't supported
*/
var convertRedirectNameToAdg = function convertRedirectNameToAdg(name) {
var nameToCheck = name.trim();

// Check if the redirect is already ADG compatible
if (validator.REDIRECT_RULE_TYPES.ADG.compatibility[nameToCheck]) {
return nameToCheck;
}

// Convert uBO redirects to ADG
if (validator.REDIRECT_RULE_TYPES.UBO.compatibility[nameToCheck]) {
return validator.REDIRECT_RULE_TYPES.UBO.compatibility[nameToCheck];
}

// Convert ABP redirects to ADG
// AGTree parses '$rewrite=abp-resource:blank-js' as 'rewrite' modifier with
// 'abp-resource:blank-js' value. So at this point we have to check if the
// redirect name starts with 'abp-resource:' and remove it if it does.
if (nameToCheck.startsWith(ABP_RESOURCE_MARKER)) {
nameToCheck = nameToCheck.slice(ABP_RESOURCE_MARKER.length).trim();
}

// This also returns `undefined` if the redirect isn't supported
return validator.REDIRECT_RULE_TYPES.ABP.compatibility[nameToCheck];
};

/**
* @redirect google-analytics
*
Expand Down Expand Up @@ -16653,6 +16686,7 @@
convertUboRedirectToAdg,
convertAbpRedirectToAdg,
convertRedirectToAdg,
convertRedirectNameToAdg,
convertAdgRedirectToUbo
};

Expand Down
7 changes: 7 additions & 0 deletions dist/umd/scriptlets.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,5 +190,12 @@ declare module '@adguard/scriptlets' {
* @param rule
*/
convertRedirectToAdg(rule: string): string;

/**
* Converts a redirect name to AdGuard one
*
* @param name
*/
convertRedirectNameToAdg(name: string): string | undefined;
};
}
38 changes: 36 additions & 2 deletions dist/umd/scriptlets.umd.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

/**
* AdGuard Scriptlets
* Version 1.9.58
* Version 1.9.61
*/

(function (factory) {
Expand Down Expand Up @@ -10396,6 +10396,7 @@
var REMOVE_ATTR_ALIASES = scriptletList[REMOVE_ATTR_METHOD].names;
var REMOVE_CLASS_ALIASES = scriptletList[REMOVE_CLASS_METHOD].names;
var REMOVE_ATTR_CLASS_APPLYING = ['asap', 'stay', 'complete'];
var ABP_RESOURCE_MARKER = 'abp-resource:';

/**
* Possible rule origins.
Expand Down Expand Up @@ -10670,10 +10671,11 @@
};

/**
* Converts UBO scriptlet rule to AdGuard one
* Converts AdGuard scriptlet rule to UBO syntax.
*
* @param rule AdGuard scriptlet rule
* @returns UBO scriptlet rule
* or undefined if `rule` is not valid AdGuard scriptlet rule.
*/
var convertAdgScriptletToUbo = function convertAdgScriptletToUbo(rule) {
var res;
Expand Down Expand Up @@ -10957,6 +10959,37 @@
return "".concat(basePart, "$").concat(uboModifiers);
};

/**
* Converts a redirect name to ADG compatible one, if possible
*
* @param name Redirect name to convert
* @returns Converted ADG compatible redirect name or `undefined` if the redirect isn't supported
*/
var convertRedirectNameToAdg = function convertRedirectNameToAdg(name) {
var nameToCheck = name.trim();

// Check if the redirect is already ADG compatible
if (validator.REDIRECT_RULE_TYPES.ADG.compatibility[nameToCheck]) {
return nameToCheck;
}

// Convert uBO redirects to ADG
if (validator.REDIRECT_RULE_TYPES.UBO.compatibility[nameToCheck]) {
return validator.REDIRECT_RULE_TYPES.UBO.compatibility[nameToCheck];
}

// Convert ABP redirects to ADG
// AGTree parses '$rewrite=abp-resource:blank-js' as 'rewrite' modifier with
// 'abp-resource:blank-js' value. So at this point we have to check if the
// redirect name starts with 'abp-resource:' and remove it if it does.
if (nameToCheck.startsWith(ABP_RESOURCE_MARKER)) {
nameToCheck = nameToCheck.slice(ABP_RESOURCE_MARKER.length).trim();
}

// This also returns `undefined` if the redirect isn't supported
return validator.REDIRECT_RULE_TYPES.ABP.compatibility[nameToCheck];
};

/**
* @redirect google-analytics
*
Expand Down Expand Up @@ -16655,6 +16688,7 @@
convertUboRedirectToAdg,
convertAbpRedirectToAdg,
convertRedirectToAdg,
convertRedirectNameToAdg,
convertAdgRedirectToUbo
};

Expand Down

0 comments on commit 5c1ccff

Please sign in to comment.