+ "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)}}"
0 commit comments