Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update google-analytics_analytics.js from https://github.com/gorhill/uBlock/commit/8a1a8b103f5 #58

Merged
merged 1 commit into from Dec 11, 2019
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Update google-analytics_analytics.js from gorhill/uBlock@8a1a8b1

  • Loading branch information
ryanbr committed Dec 2, 2019
commit 3eb80b208a3d87376bc53a379a3a1eab9f6e7940
@@ -37,17 +37,24 @@
//
const w = window;
const gaName = w.GoogleAnalyticsObject || 'ga';
const gaQueue = w[gaName];
const ga = function() {
var len = arguments.length;
if ( len === 0 ) {
return;
}
var f = arguments[len-1];
if ( typeof f !== 'object' || f === null || typeof f.hitCallback !== 'function' ) {
return;
const len = arguments.length;
if ( len === 0 ) { return; }
const args = Array.from(arguments);
let fn;
let a = args[len-1];
if ( a instanceof Object && a.hitCallback instanceof Function ) {
fn = a.hitCallback;
} else {
const pos = args.indexOf('hitCallback');
if ( pos !== -1 && args[pos+1] instanceof Function ) {
fn = args[pos+1];
}
}
if ( fn instanceof Function === false ) { return; }
try {
f.hitCallback();
fn();
} catch (ex) {
}
};
@@ -67,4 +74,10 @@
if ( dl instanceof Object && dl.hide instanceof Object && typeof dl.hide.end === 'function' ) {
dl.hide.end();
}
// empty ga queue
if ( gaQueue instanceof Function && Array.isArray(gaQueue.q) ) {
for ( const entry of gaQueue.q ) {
ga(...entry);
}
}
})();
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.