mirror of https://github.com/gorhill/uBlock.git
Fix local Google Analytics replacement script
Related issue: - https://github.com/uBlockOrigin/uAssets/pull/4115
This commit is contained in:
parent
62c985fe4c
commit
30c38de9bc
|
@ -38,6 +38,7 @@
|
|||
const w = window;
|
||||
const gaName = w.GoogleAnalyticsObject || 'ga';
|
||||
const gaQueue = w[gaName];
|
||||
// https://github.com/uBlockOrigin/uAssets/pull/4115
|
||||
const ga = function() {
|
||||
const len = arguments.length;
|
||||
if ( len === 0 ) { return; }
|
||||
|
@ -46,6 +47,8 @@
|
|||
let a = args[len-1];
|
||||
if ( a instanceof Object && a.hitCallback instanceof Function ) {
|
||||
fn = a.hitCallback;
|
||||
} else if ( a instanceof Function ) {
|
||||
fn = ( ) => { a(ga.create()); };
|
||||
} else {
|
||||
const pos = args.indexOf('hitCallback');
|
||||
if ( pos !== -1 && args[pos+1] instanceof Function ) {
|
||||
|
@ -54,7 +57,7 @@
|
|||
}
|
||||
if ( fn instanceof Function === false ) { return; }
|
||||
try {
|
||||
fn();
|
||||
setTimeout(fn, 1);
|
||||
} catch (ex) {
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue