mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-02 00:42:45 +01:00
Further improve GA's surrogate script
Related issue: - https://github.com/AdguardTeam/Scriptlets/issues/154 Related discussion: - https://github.com/uBlockOrigin/uBlock-issues/issues/1807
This commit is contained in:
parent
8378baa894
commit
3b53c3a3e3
@ -46,7 +46,10 @@
|
|||||||
/(^|\.)_link$/.test(a[0]) &&
|
/(^|\.)_link$/.test(a[0]) &&
|
||||||
typeof a[1] === 'string'
|
typeof a[1] === 'string'
|
||||||
) {
|
) {
|
||||||
|
try {
|
||||||
window.location.assign(a[1]);
|
window.location.assign(a[1]);
|
||||||
|
} catch(ex) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// https://github.com/gorhill/uBlock/issues/2162
|
// https://github.com/gorhill/uBlock/issues/2162
|
||||||
if ( a[0] === '_set' && a[1] === 'hitCallback' && typeof a[2] === 'function' ) {
|
if ( a[0] === '_set' && a[1] === 'hitCallback' && typeof a[2] === 'function' ) {
|
||||||
@ -62,7 +65,7 @@
|
|||||||
'_cookiePathCopy _deleteCustomVar _getName _setAccount',
|
'_cookiePathCopy _deleteCustomVar _getName _setAccount',
|
||||||
'_getAccount _getClientInfo _getDetectFlash _getDetectTitle',
|
'_getAccount _getClientInfo _getDetectFlash _getDetectTitle',
|
||||||
'_getLinkerUrl _getLocalGifPath _getServiceMode _getVersion',
|
'_getLinkerUrl _getLocalGifPath _getServiceMode _getVersion',
|
||||||
'_getVisitorCustomVar _initData _link _linkByPost',
|
'_getVisitorCustomVar _initData _linkByPost',
|
||||||
'_setAllowAnchor _setAllowHash _setAllowLinker _setCampContentKey',
|
'_setAllowAnchor _setAllowHash _setAllowLinker _setCampContentKey',
|
||||||
'_setCampMediumKey _setCampNameKey _setCampNOKey _setCampSourceKey',
|
'_setCampMediumKey _setCampNameKey _setCampNOKey _setCampSourceKey',
|
||||||
'_setCampTermKey _setCampaignCookieTimeout _setCampaignTrack _setClientInfo',
|
'_setCampTermKey _setCampaignCookieTimeout _setCampaignTrack _setClientInfo',
|
||||||
@ -74,13 +77,20 @@
|
|||||||
'_trackPageview _trackSocial _trackTiming _trackTrans',
|
'_trackPageview _trackSocial _trackTiming _trackTrans',
|
||||||
'_visitCode'
|
'_visitCode'
|
||||||
].join(' ').split(/\s+/);
|
].join(' ').split(/\s+/);
|
||||||
let i = api.length;
|
for ( const method of api ) {
|
||||||
while ( i-- ) {
|
out[method] = noopfn;
|
||||||
out[api[i]] = noopfn;
|
|
||||||
}
|
}
|
||||||
out._getLinkerUrl = function(a) {
|
out._getLinkerUrl = function(a) {
|
||||||
return a;
|
return a;
|
||||||
};
|
};
|
||||||
|
// https://github.com/AdguardTeam/Scriptlets/issues/154
|
||||||
|
out._link = function(a) {
|
||||||
|
if ( typeof a !== 'string' ) { return; }
|
||||||
|
try {
|
||||||
|
window.location.assign(a);
|
||||||
|
} catch(ex) {
|
||||||
|
}
|
||||||
|
};
|
||||||
return out;
|
return out;
|
||||||
})();
|
})();
|
||||||
//
|
//
|
||||||
|
Loading…
Reference in New Issue
Block a user