A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/gorhill/uBlock/commit/8a1a8b103f56e4fcef1264e02dfd718a29bda006 below:

Improve neutered Google Analytics replacement scriptlet · gorhill/uBlock@8a1a8b1 · GitHub

File tree Expand file treeCollapse file tree 1 file changed

+21

-8

lines changed

Filter options

Expand file treeCollapse file tree 1 file changed

+21

-8

lines changed Original file line number Diff line number Diff line change

@@ -37,17 +37,24 @@

37 37

//

38 38

const w = window;

39 39

const gaName = w.GoogleAnalyticsObject || 'ga';

40 +

const gaQueue = w[gaName];

40 41

const ga = function() {

41 -

var len = arguments.length;

42 -

if ( len === 0 ) {

43 -

return;

44 -

}

45 -

var f = arguments[len-1];

46 -

if ( typeof f !== 'object' || f === null || typeof f.hitCallback !== 'function' ) {

47 -

return;

42 +

const len = arguments.length;

43 +

if ( len === 0 ) { return; }

44 +

const args = Array.from(arguments);

45 +

let fn;

46 +

let a = args[len-1];

47 +

if ( a instanceof Object && a.hitCallback instanceof Function ) {

48 +

fn = a.hitCallback;

49 +

} else {

50 +

const pos = args.indexOf('hitCallback');

51 +

if ( pos !== -1 && args[pos+1] instanceof Function ) {

52 +

fn = args[pos+1];

53 +

}

48 54

}

55 +

if ( fn instanceof Function === false ) { return; }

49 56

try {

50 -

f.hitCallback();

57 +

fn();

51 58

} catch (ex) {

52 59

}

53 60

};

@@ -67,4 +74,10 @@

67 74

if ( dl instanceof Object && dl.hide instanceof Object && typeof dl.hide.end === 'function' ) {

68 75

dl.hide.end();

69 76

}

77 +

// empty ga queue

78 +

if ( gaQueue instanceof Function && Array.isArray(gaQueue.q) ) {

79 +

for ( const entry of gaQueue.q ) {

80 +

ga(...entry);

81 +

}

82 +

}

70 83

})();

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4