Skip to content

Commit 2ee9cd6

Browse files
author
Atlassian Bamboo
committed
deploy: update dist
1 parent 83f5040 commit 2ee9cd6

File tree

6 files changed

+124
-27
lines changed

6 files changed

+124
-27
lines changed

dist/build.txt

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

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.6.18
3+
# Version 1.6.20
44
#
55
- title: 1x1-transparent.gif
66
description: |-

dist/scriptlets.corelibs.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "1.6.18",
2+
"version": "1.6.20",
33
"scriptlets": [
44
{
55
"names": [
@@ -422,7 +422,7 @@
422422
"ubo-window-close-if.js",
423423
"ubo-window-close-if"
424424
],
425-
"scriptlet": "function forceWindowClose(source,args){function hit(source,message){if(!0===source.verbose){try{var log=console.log.bind(console),trace=console.trace.bind(console),prefix=source.ruleText||\"\";if(source.domainName){var ruleStartIndex;source.ruleText.indexOf(\"#%#//\")>-1?ruleStartIndex=source.ruleText.indexOf(\"#%#//\"):source.ruleText.indexOf(\"##+js\")>-1&&(ruleStartIndex=source.ruleText.indexOf(\"##+js\"));var rulePart=source.ruleText.slice(ruleStartIndex);prefix=\"\".concat(source.domainName).concat(rulePart)}message&&(-1===message.indexOf(\"log: \")?log(\"\".concat(prefix,\" message:\\n\").concat(message)):log(message.slice(\"log: \".length))),log(\"\".concat(prefix,\" trace start\")),trace&&trace(),log(\"\".concat(prefix,\" trace end\"))}catch(e){}\"function\"==typeof window.__debug&&window.__debug(source)}}function toRegExp(){var input=arguments.length>0&&void 0!==arguments[0]?arguments[0]:\"\",DEFAULT_VALUE=\".?\",FORWARD_SLASH=\"/\";if(\"\"===input)return new RegExp(DEFAULT_VALUE);if(input[0]===FORWARD_SLASH&&input[input.length-1]===FORWARD_SLASH)return new RegExp(input.slice(1,-1));var escaped=input.replace(/[.*+?^${}()|[\\]\\\\]/g,\"\\\\$&\");return new RegExp(escaped)}var updatedArgs=args?[].concat(source).concat(args):[source];try{(function(source){var path=arguments.length>1&&void 0!==arguments[1]?arguments[1]:\"\",log=console.log.bind(console);if(\"function\"==typeof window.close){var closeImmediately=function(){try{hit(source),window.close()}catch(e){log(e)}};if(\"\"===path)closeImmediately();else{var pathRegexp=toRegExp(path),currentPath=\"\".concat(window.location.pathname).concat(window.location.search);pathRegexp.test(currentPath)&&closeImmediately()}}else source.verbose&&log(\"window.close() is not a function so 'close-window' scriptlet is unavailable\")}).apply(this,updatedArgs)}catch(e){console.log(e)}}"
425+
"scriptlet": "function forceWindowClose(source,args){function hit(source,message){if(!0===source.verbose){try{var log=console.log.bind(console),trace=console.trace.bind(console),prefix=source.ruleText||\"\";if(source.domainName){var ruleStartIndex;source.ruleText.indexOf(\"#%#//\")>-1?ruleStartIndex=source.ruleText.indexOf(\"#%#//\"):source.ruleText.indexOf(\"##+js\")>-1&&(ruleStartIndex=source.ruleText.indexOf(\"##+js\"));var rulePart=source.ruleText.slice(ruleStartIndex);prefix=\"\".concat(source.domainName).concat(rulePart)}message&&(-1===message.indexOf(\"log: \")?log(\"\".concat(prefix,\" message:\\n\").concat(message)):log(message.slice(\"log: \".length))),log(\"\".concat(prefix,\" trace start\")),trace&&trace(),log(\"\".concat(prefix,\" trace end\"))}catch(e){}\"function\"==typeof window.__debug&&window.__debug(source)}}function toRegExp(){var input=arguments.length>0&&void 0!==arguments[0]?arguments[0]:\"\",DEFAULT_VALUE=\".?\",FORWARD_SLASH=\"/\";if(\"\"===input)return new RegExp(DEFAULT_VALUE);if(input[0]===FORWARD_SLASH&&input[input.length-1]===FORWARD_SLASH)return new RegExp(input.slice(1,-1));var escaped=input.replace(/[.*+?^${}()|[\\]\\\\]/g,\"\\\\$&\");return new RegExp(escaped)}var updatedArgs=args?[].concat(source).concat(args):[source];try{(function(source){var path=arguments.length>1&&void 0!==arguments[1]?arguments[1]:\"\",log=console.log.bind(console);if(\"function\"==typeof window.close){var closeImmediately=function(){try{hit(source),window.close()}catch(e){log(e)}},closeByExtension=function(){var extCall=function(){dispatchEvent(new Event(\"adguard:scriptlet-close-window\"))};window.addEventListener(\"adguard:subscribed-to-close-window\",extCall,{once:!0}),setTimeout((function(){window.removeEventListener(\"adguard:subscribed-to-close-window\",extCall,{once:!0})}),5e3)};(function(){if(\"\"===path)return!0;var pathRegexp=toRegExp(path),currentPath=\"\".concat(window.location.pathname).concat(window.location.search);return pathRegexp.test(currentPath)})()&&(closeImmediately(),navigator.userAgent.indexOf(\"Chrome\")>-1&&closeByExtension())}else source.verbose&&log(\"window.close() is not a function so 'close-window' scriptlet is unavailable\")}).apply(this,updatedArgs)}catch(e){console.log(e)}}"
426426
},
427427
{
428428
"names": [
@@ -447,4 +447,4 @@
447447
"scriptlet": "function noTopics(source,args){var updatedArgs=args?[].concat(source).concat(args):[source];try{(function(source){Document instanceof Object!=0&&Object.prototype.hasOwnProperty.call(Document.prototype,\"browsingTopics\")&&Document.prototype.browsingTopics instanceof Function!=0&&(Document.prototype.browsingTopics=function(){return function(){if(\"undefined\"!=typeof Response){var response=new Response(arguments.length>0&&void 0!==arguments[0]?arguments[0]:\"{}\",{status:200,statusText:\"OK\"});return Promise.resolve(response)}}(\"[]\")},function(source,message){if(!0===source.verbose){try{var log=console.log.bind(console),trace=console.trace.bind(console),prefix=source.ruleText||\"\";if(source.domainName){var ruleStartIndex,AG_SCRIPTLET_MARKER=\"#%#//\",UBO_SCRIPTLET_MARKER=\"##+js\";source.ruleText.indexOf(AG_SCRIPTLET_MARKER)>-1?ruleStartIndex=source.ruleText.indexOf(AG_SCRIPTLET_MARKER):source.ruleText.indexOf(UBO_SCRIPTLET_MARKER)>-1&&(ruleStartIndex=source.ruleText.indexOf(UBO_SCRIPTLET_MARKER));var rulePart=source.ruleText.slice(ruleStartIndex);prefix=\"\".concat(source.domainName).concat(rulePart)}var LOG_MARKER=\"log: \";message&&(-1===message.indexOf(LOG_MARKER)?log(\"\".concat(prefix,\" message:\\n\").concat(message)):log(message.slice(LOG_MARKER.length))),log(\"\".concat(prefix,\" trace start\")),trace&&trace(),log(\"\".concat(prefix,\" trace end\"))}catch(e){}\"function\"==typeof window.__debug&&window.__debug(source)}}(source))}).apply(this,updatedArgs)}catch(e){console.log(e)}}"
448448
}
449449
]
450-
}
450+
}

dist/scriptlets.js

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

22
/**
33
* AdGuard Scriptlets
4-
* Version 1.6.18
4+
* Version 1.6.20
55
*/
66

77
(function () {
@@ -5648,6 +5648,9 @@
56485648
* @description
56495649
* Closes the browser tab immediately.
56505650
*
5651+
* > `window.close()` usage is restricted in Chrome. In this case
5652+
* tab will only be closed if using AdGuard browser extension.
5653+
*
56515654
* **Syntax**
56525655
* ```
56535656
* example.org#%#//scriptlet('close-window'[, path])
@@ -5691,14 +5694,36 @@
56915694
}
56925695
};
56935696

5694-
if (path === '') {
5695-
closeImmediately();
5696-
} else {
5697+
var closeByExtension = function closeByExtension() {
5698+
var extCall = function extCall() {
5699+
dispatchEvent(new Event('adguard:scriptlet-close-window'));
5700+
};
5701+
5702+
window.addEventListener('adguard:subscribed-to-close-window', extCall, {
5703+
once: true
5704+
});
5705+
setTimeout(function () {
5706+
window.removeEventListener('adguard:subscribed-to-close-window', extCall, {
5707+
once: true
5708+
});
5709+
}, 5000);
5710+
};
5711+
5712+
var shouldClose = function shouldClose() {
5713+
if (path === '') {
5714+
return true;
5715+
}
5716+
56975717
var pathRegexp = toRegExp(path);
56985718
var currentPath = "".concat(window.location.pathname).concat(window.location.search);
5719+
return pathRegexp.test(currentPath);
5720+
};
56995721

5700-
if (pathRegexp.test(currentPath)) {
5701-
closeImmediately();
5722+
if (shouldClose()) {
5723+
closeImmediately();
5724+
5725+
if (navigator.userAgent.indexOf('Chrome') > -1) {
5726+
closeByExtension();
57025727
}
57035728
}
57045729
}
@@ -15184,14 +15209,36 @@
1518415209
}
1518515210
};
1518615211

15187-
if (path === "") {
15188-
closeImmediately();
15189-
} else {
15212+
var closeByExtension = function closeByExtension() {
15213+
var extCall = function extCall() {
15214+
dispatchEvent(new Event("adguard:scriptlet-close-window"));
15215+
};
15216+
15217+
window.addEventListener("adguard:subscribed-to-close-window", extCall, {
15218+
once: true
15219+
});
15220+
setTimeout(function () {
15221+
window.removeEventListener("adguard:subscribed-to-close-window", extCall, {
15222+
once: true
15223+
});
15224+
}, 5e3);
15225+
};
15226+
15227+
var shouldClose = function shouldClose() {
15228+
if (path === "") {
15229+
return true;
15230+
}
15231+
1519015232
var pathRegexp = toRegExp(path);
1519115233
var currentPath = "".concat(window.location.pathname).concat(window.location.search);
15234+
return pathRegexp.test(currentPath);
15235+
};
15236+
15237+
if (shouldClose()) {
15238+
closeImmediately();
1519215239

15193-
if (pathRegexp.test(currentPath)) {
15194-
closeImmediately();
15240+
if (navigator.userAgent.indexOf("Chrome") > -1) {
15241+
closeByExtension();
1519515242
}
1519615243
}
1519715244
}

dist/umd/scriptlets.umd.js

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

22
/**
33
* AdGuard Scriptlets
4-
* Version 1.6.18
4+
* Version 1.6.20
55
*/
66

77
(function (factory) {
@@ -5650,6 +5650,9 @@
56505650
* @description
56515651
* Closes the browser tab immediately.
56525652
*
5653+
* > `window.close()` usage is restricted in Chrome. In this case
5654+
* tab will only be closed if using AdGuard browser extension.
5655+
*
56535656
* **Syntax**
56545657
* ```
56555658
* example.org#%#//scriptlet('close-window'[, path])
@@ -5693,14 +5696,36 @@
56935696
}
56945697
};
56955698

5696-
if (path === '') {
5697-
closeImmediately();
5698-
} else {
5699+
var closeByExtension = function closeByExtension() {
5700+
var extCall = function extCall() {
5701+
dispatchEvent(new Event('adguard:scriptlet-close-window'));
5702+
};
5703+
5704+
window.addEventListener('adguard:subscribed-to-close-window', extCall, {
5705+
once: true
5706+
});
5707+
setTimeout(function () {
5708+
window.removeEventListener('adguard:subscribed-to-close-window', extCall, {
5709+
once: true
5710+
});
5711+
}, 5000);
5712+
};
5713+
5714+
var shouldClose = function shouldClose() {
5715+
if (path === '') {
5716+
return true;
5717+
}
5718+
56995719
var pathRegexp = toRegExp(path);
57005720
var currentPath = "".concat(window.location.pathname).concat(window.location.search);
5721+
return pathRegexp.test(currentPath);
5722+
};
57015723

5702-
if (pathRegexp.test(currentPath)) {
5703-
closeImmediately();
5724+
if (shouldClose()) {
5725+
closeImmediately();
5726+
5727+
if (navigator.userAgent.indexOf('Chrome') > -1) {
5728+
closeByExtension();
57045729
}
57055730
}
57065731
}
@@ -15186,14 +15211,36 @@
1518615211
}
1518715212
};
1518815213

15189-
if (path === "") {
15190-
closeImmediately();
15191-
} else {
15214+
var closeByExtension = function closeByExtension() {
15215+
var extCall = function extCall() {
15216+
dispatchEvent(new Event("adguard:scriptlet-close-window"));
15217+
};
15218+
15219+
window.addEventListener("adguard:subscribed-to-close-window", extCall, {
15220+
once: true
15221+
});
15222+
setTimeout(function () {
15223+
window.removeEventListener("adguard:subscribed-to-close-window", extCall, {
15224+
once: true
15225+
});
15226+
}, 5e3);
15227+
};
15228+
15229+
var shouldClose = function shouldClose() {
15230+
if (path === "") {
15231+
return true;
15232+
}
15233+
1519215234
var pathRegexp = toRegExp(path);
1519315235
var currentPath = "".concat(window.location.pathname).concat(window.location.search);
15236+
return pathRegexp.test(currentPath);
15237+
};
15238+
15239+
if (shouldClose()) {
15240+
closeImmediately();
1519415241

15195-
if (pathRegexp.test(currentPath)) {
15196-
closeImmediately();
15242+
if (navigator.userAgent.indexOf("Chrome") > -1) {
15243+
closeByExtension();
1519715244
}
1519815245
}
1519915246
}

wiki/about-scriptlets.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,9 @@ defaults to match all callbacks; invalid regular expression will cause exit and
297297
298298
Closes the browser tab immediately.
299299
300+
> `window.close()` usage is restricted in Chrome. In this case
301+
tab will only be closed if using AdGuard browser extension.
302+
300303
**Syntax**
301304
```
302305
example.org#%#//scriptlet('close-window'[, path])

0 commit comments

Comments
 (0)