mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-10 17:17:57 +01:00
Fix local Google Analytics replacement script
Related issue: - https://github.com/uBlockOrigin/uAssets/pull/4115
This commit is contained in:
parent
62c985fe4c
commit
30c38de9bc
1 changed files with 4 additions and 1 deletions
|
@ -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 a new issue