forked from SukkaW/Surge
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
141 changed files
with
429,006 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
(function () { | ||
'use strict'; | ||
|
||
const noopfn = function () { | ||
}; | ||
window.addthis = { | ||
addEventListener: noopfn, | ||
button: noopfn, | ||
counter: noopfn, | ||
init: noopfn, | ||
layers: noopfn, | ||
ready: noopfn, | ||
sharecounters: { | ||
getShareCounts: noopfn | ||
}, | ||
toolbox: noopfn, | ||
update: noopfn | ||
}; | ||
}()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
(function () { | ||
'use strict'; | ||
|
||
const head = document.head; | ||
if (!head) { return; } | ||
const style = document.createElement('style'); | ||
style.textContent = [ | ||
'body {', | ||
' animation: none !important;', | ||
' overflow: unset !important;', | ||
'}' | ||
].join('\n'); | ||
head.appendChild(style); | ||
}()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
window.google_ad_status = 1; |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
(function () { | ||
'use strict'; | ||
|
||
// https://developers.google.com/analytics/devguides/collection/analyticsjs/ | ||
const noopfn = function () { | ||
}; | ||
// | ||
const Tracker = function () { | ||
}; | ||
const p = Tracker.prototype; | ||
p.get = noopfn; | ||
p.set = noopfn; | ||
p.send = noopfn; | ||
// | ||
const w = window; | ||
const gaName = w.GoogleAnalyticsObject || 'ga'; | ||
const gaQueue = w[gaName]; | ||
const ga = function (...args) { | ||
const len = args.length; | ||
if (len === 0) { return; } | ||
let fn; | ||
const a = args[len - 1]; | ||
if (typeof a === 'object' && typeof a.hitCallback === 'function') { | ||
fn = a.hitCallback; | ||
} else if (typeof a === 'function') { | ||
fn = () => { a(ga.create()); }; | ||
} else { | ||
const pos = args.indexOf('hitCallback'); | ||
if (pos !== -1 && typeof args[pos + 1] === 'function') { | ||
fn = args[pos + 1]; | ||
} | ||
} | ||
if (typeof fn !== 'function') { return; } | ||
try { | ||
fn(); | ||
} catch { | ||
} | ||
}; | ||
ga.create = function () { | ||
return new Tracker(); | ||
}; | ||
ga.getByName = function () { | ||
return new Tracker(); | ||
}; | ||
ga.getAll = function () { | ||
return [new Tracker()]; | ||
}; | ||
ga.remove = noopfn; | ||
// https://github.com/uBlockOrigin/uAssets/issues/2107 | ||
ga.loaded = true; | ||
w[gaName] = ga; | ||
// https://github.com/gorhill/uBlock/issues/3075 | ||
const dl = w.dataLayer; | ||
if (typeof dl === 'object') { | ||
if (typeof dl.hide === 'object' && typeof dl.hide.end === 'function') { | ||
dl.hide.end(); | ||
dl.hide.end = () => { }; | ||
} | ||
if (typeof dl.push === 'function') { | ||
const doCallback = function (item) { | ||
if (typeof item === 'object' === false) { return; } | ||
if (typeof item.eventCallback !== 'function') { return; } | ||
// eslint-disable-next-line sukka/prefer-timer-id -- deliberate use of setTimeout | ||
setTimeout(item.eventCallback, 1); | ||
item.eventCallback = () => { }; | ||
}; | ||
dl.push = new Proxy(dl.push, { | ||
apply(target, thisArg, args) { | ||
doCallback(args[0]); | ||
return Reflect.apply(target, thisArg, args); | ||
} | ||
}); | ||
if (Array.isArray(dl)) { | ||
const q = dl.slice(); | ||
for (const item of q) { | ||
doCallback(item); | ||
} | ||
} | ||
} | ||
} | ||
// empty ga queue | ||
if (typeof gaQueue === 'function' && Array.isArray(gaQueue.q)) { | ||
const q = gaQueue.q.slice(); | ||
gaQueue.q.length = 0; | ||
for (const entry of q) { | ||
ga(...entry); | ||
} | ||
} | ||
}()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
(function () { | ||
'use strict'; | ||
|
||
const noopfn = function () { | ||
}; | ||
window.cxApi = { | ||
chooseVariation() { | ||
return 0; | ||
}, | ||
getChosenVariation: noopfn, | ||
setAllowHash: noopfn, | ||
setChosenVariation: noopfn, | ||
setCookiePath: noopfn, | ||
setDomainName: noopfn | ||
}; | ||
}()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
(function () { | ||
'use strict'; | ||
|
||
const noopfn = function () { | ||
}; | ||
// | ||
const Gaq = function () { | ||
}; | ||
Gaq.prototype.Na = noopfn; | ||
Gaq.prototype.O = noopfn; | ||
Gaq.prototype.Sa = noopfn; | ||
Gaq.prototype.Ta = noopfn; | ||
Gaq.prototype.Va = noopfn; | ||
Gaq.prototype._createAsyncTracker = noopfn; | ||
Gaq.prototype._getAsyncTracker = noopfn; | ||
Gaq.prototype._getPlugin = noopfn; | ||
Gaq.prototype.push = function (a) { | ||
if (typeof a === 'function') { | ||
a(); return; | ||
} | ||
if (Array.isArray(a) === false) { return; } | ||
// https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiDomainDirectory#_gat.GA_Tracker_._link | ||
if ( | ||
typeof a[0] === 'string' | ||
&& /(^|\.)_link$/.test(a[0]) | ||
&& typeof a[1] === 'string' | ||
) { | ||
try { | ||
window.location.assign(a[1]); | ||
} catch { | ||
} | ||
} | ||
if (a[0] === '_set' && a[1] === 'hitCallback' && typeof a[2] === 'function') { | ||
a[2](); | ||
} | ||
}; | ||
// | ||
const tracker = (function () { | ||
const out = {}; | ||
const api = [ | ||
'_addIgnoredOrganic _addIgnoredRef _addItem _addOrganic', | ||
'_addTrans _clearIgnoredOrganic _clearIgnoredRef _clearOrganic', | ||
'_cookiePathCopy _deleteCustomVar _getName _setAccount', | ||
'_getAccount _getClientInfo _getDetectFlash _getDetectTitle', | ||
'_getLinkerUrl _getLocalGifPath _getServiceMode _getVersion', | ||
'_getVisitorCustomVar _initData _linkByPost', | ||
'_setAllowAnchor _setAllowHash _setAllowLinker _setCampContentKey', | ||
'_setCampMediumKey _setCampNameKey _setCampNOKey _setCampSourceKey', | ||
'_setCampTermKey _setCampaignCookieTimeout _setCampaignTrack _setClientInfo', | ||
'_setCookiePath _setCookiePersistence _setCookieTimeout _setCustomVar', | ||
'_setDetectFlash _setDetectTitle _setDomainName _setLocalGifPath', | ||
'_setLocalRemoteServerMode _setLocalServerMode _setReferrerOverride _setRemoteServerMode', | ||
'_setSampleRate _setSessionTimeout _setSiteSpeedSampleRate _setSessionCookieTimeout', | ||
'_setVar _setVisitorCookieTimeout _trackEvent _trackPageLoadTime', | ||
'_trackPageview _trackSocial _trackTiming _trackTrans', | ||
'_visitCode' | ||
].join(' ').split(/\s+/); | ||
for (const method of api) { | ||
out[method] = noopfn; | ||
} | ||
out._getLinkerUrl = function (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 { | ||
} | ||
}; | ||
return out; | ||
}()); | ||
// | ||
const Gat = function () { | ||
}; | ||
Gat.prototype._anonymizeIP = noopfn; | ||
Gat.prototype._createTracker = noopfn; | ||
Gat.prototype._forceSSL = noopfn; | ||
Gat.prototype._getPlugin = noopfn; | ||
Gat.prototype._getTracker = function () { | ||
return tracker; | ||
}; | ||
Gat.prototype._getTrackerByName = function () { | ||
return tracker; | ||
}; | ||
Gat.prototype._getTrackers = noopfn; | ||
Gat.prototype.aa = noopfn; | ||
Gat.prototype.ab = noopfn; | ||
Gat.prototype.hb = noopfn; | ||
Gat.prototype.la = noopfn; | ||
Gat.prototype.oa = noopfn; | ||
Gat.prototype.pa = noopfn; | ||
Gat.prototype.u = noopfn; | ||
const gat = new Gat(); | ||
window._gat = gat; | ||
// | ||
const gaq = new Gaq(); | ||
(function () { | ||
const aa = window._gaq || []; | ||
if (Array.isArray(aa)) { | ||
while (aa[0]) { | ||
gaq.push(aa.shift()); | ||
} | ||
} | ||
}()); | ||
gaq.qf = gaq; | ||
window._gaq = gaq; | ||
}()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
(function () { | ||
'use strict'; | ||
|
||
window._gaq = window._gaq || { | ||
push() { | ||
} | ||
}; | ||
}()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
(function () { | ||
'use strict'; | ||
|
||
const init = () => { | ||
window.adsbygoogle = { | ||
loaded: true, | ||
push() { | ||
} | ||
}; | ||
const phs = document.querySelectorAll('.adsbygoogle'); | ||
const css = 'height:1px!important;max-height:1px!important;max-width:1px!important;width:1px!important;'; | ||
for (let i = 0; i < phs.length; i++) { | ||
const id = `aswift_${i}`; | ||
if (document.querySelector(`iframe#${id}`) !== null) { continue; } | ||
const fr = document.createElement('iframe'); | ||
fr.id = id; | ||
fr.style = css; | ||
const cfr = document.createElement('iframe'); | ||
cfr.id = `google_ads_frame${i}`; | ||
fr.appendChild(cfr); | ||
phs[i].appendChild(fr); | ||
} | ||
}; | ||
if ( | ||
document.querySelectorAll('.adsbygoogle').length === 0 | ||
&& document.readyState === 'loading' | ||
) { | ||
window.addEventListener('DOMContentLoaded', init, { once: true }); | ||
} else { | ||
init(); | ||
} | ||
}()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
(function () { | ||
'use strict'; | ||
|
||
const noopfn = function () { | ||
}; | ||
const w = window; | ||
w.ga = w.ga || noopfn; | ||
const dl = w.dataLayer; | ||
if (typeof dl !== 'object') { return; } | ||
if (typeof dl.hide === 'object' && typeof dl.hide.end === 'function') { | ||
dl.hide.end(); | ||
} | ||
if (typeof dl.push === 'function') { | ||
dl.push = function (o) { | ||
if ( | ||
typeof o === 'object' | ||
&& typeof o.eventCallback === 'function' | ||
) { | ||
// eslint-disable-next-line sukka/prefer-timer-id -- deliberately use setTimeout | ||
setTimeout(o.eventCallback, 1); | ||
} | ||
}; | ||
} | ||
}()); |
Oops, something went wrong.