mirror of
https://gitlab.com/SukkaW/ruleset.skk.moe.git
synced 2026-04-18 17:54:26 +00:00
deploy: SukkaW/Surge@5724a3b5f1
This commit is contained in:
@@ -1,4 +1,11 @@
|
||||
(function(source, args) {
|
||||
const flag = "done";
|
||||
const uniqueIdentifier = source.uniqueId + source.name + "_" + (Array.isArray(args) ? args.join("_") : "");
|
||||
if (source.uniqueId) {
|
||||
if (Window.prototype.toString[uniqueIdentifier] === flag) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
function GoogleAnalytics(source) {
|
||||
var _window$googleAnalyti;
|
||||
var Tracker = function Tracker() {};
|
||||
@@ -85,30 +92,28 @@
|
||||
hit(source);
|
||||
}
|
||||
function hit(source) {
|
||||
if (source.verbose !== true) {
|
||||
var ADGUARD_PREFIX = "[AdGuard]";
|
||||
if (!source.verbose) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
var log = console.log.bind(console);
|
||||
var trace = console.trace.bind(console);
|
||||
var prefix = source.ruleText || "";
|
||||
if (source.domainName) {
|
||||
var AG_SCRIPTLET_MARKER = "#%#//";
|
||||
var UBO_SCRIPTLET_MARKER = "##+js";
|
||||
var ruleStartIndex;
|
||||
if (source.ruleText.includes(AG_SCRIPTLET_MARKER)) {
|
||||
ruleStartIndex = source.ruleText.indexOf(AG_SCRIPTLET_MARKER);
|
||||
} else if (source.ruleText.includes(UBO_SCRIPTLET_MARKER)) {
|
||||
ruleStartIndex = source.ruleText.indexOf(UBO_SCRIPTLET_MARKER);
|
||||
var label = "".concat(ADGUARD_PREFIX, " ");
|
||||
if (source.engine === "corelibs") {
|
||||
label += source.ruleText;
|
||||
} else {
|
||||
if (source.domainName) {
|
||||
label += "".concat(source.domainName);
|
||||
}
|
||||
if (source.args) {
|
||||
label += "#%#//scriptlet('".concat(source.name, "', '").concat(source.args.join("', '"), "')");
|
||||
} else {
|
||||
label += "#%#//scriptlet('".concat(source.name, "')");
|
||||
}
|
||||
var rulePart = source.ruleText.slice(ruleStartIndex);
|
||||
prefix = "".concat(source.domainName).concat(rulePart);
|
||||
}
|
||||
log("".concat(prefix, " trace start"));
|
||||
if (trace) {
|
||||
trace();
|
||||
trace(label);
|
||||
}
|
||||
log("".concat(prefix, " trace end"));
|
||||
} catch (e) {}
|
||||
if (typeof window.__debug === "function") {
|
||||
window.__debug(source);
|
||||
@@ -124,6 +129,14 @@
|
||||
const updatedArgs = args ? [].concat(source).concat(args) : [ source ];
|
||||
try {
|
||||
GoogleAnalytics.apply(this, updatedArgs);
|
||||
if (source.uniqueId) {
|
||||
Object.defineProperty(Window.prototype.toString, uniqueIdentifier, {
|
||||
value: flag,
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
configurable: false
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user