Last active
September 25, 2020 01:09
-
-
Save dmattera/c47b3ecc3432ffa32ccaef5e4c246940 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# Resources to be used as redirect destinations. | |
# | |
# http://probablyprogramming.com/2009/03/15/the-tiniest-gif-ever | |
1x1-transparent.gif image/gif;base64 | |
R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== | |
2x2-transparent.png image/png;base64 | |
iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAC0lEQVQI12NgQAcAABIAAe+JVKQAAAAA | |
SUVORK5CYII= | |
3x2-transparent.png image/png;base64 | |
iVBORw0KGgoAAAANSUhEUgAAAAMAAAACCAYAAACddGYaAAAAC0lEQVQI12NgwAUAABoAASRETuUAAAAA | |
SUVORK5CYII= | |
32x32-transparent.png image/png;base64 | |
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAGklEQVRYw+3BAQEAAACCIP+vbkhAAQAA | |
AO8GECAAAZf3V9cAAAAASUVORK5CYII= | |
nooptext text/plain | |
noopcss text/css | |
noopjs application/javascript | |
(function() { | |
; | |
})(); | |
noopframe text/html | |
<!DOCTYPE html> | |
<html> | |
<head><title></title></head> | |
<body></body> | |
</html> | |
################################################################################################################################## | |
remove-lazy.js application/javascript | |
(function() { | |
var img = document.images; | |
for (i = 0; i < img.length; i++) { | |
var elm = img[i]; | |
var attr = "data-src"; | |
if ( elm.getAttribute(attr) && elm.src != elm.getAttribute(attr) ) { | |
elm.classList.remove("lazy"); | |
elm.classList.remove("lazyload"); | |
elm.src = elm.getAttribute(attr); | |
} | |
} | |
})(); | |
insta_button.js application/javascript | |
(function(){ | |
function openUrl(){ | |
var count = 0; | |
var selected = 0; | |
var dot_elms = document.querySelectorAll(".Yi5aA "); | |
Array.prototype.forEach.call(dot_elms, function(elm) { | |
var class_name = elm.className; | |
switch (class_name) { | |
case "Yi5aA ": | |
count = count + 1; | |
break; | |
case "Yi5aA XCodT": | |
selected = count; | |
break; | |
} | |
}); | |
var node = window.__additionalData[window.location.pathname]["data"]["graphql"]["shortcode_media"]["edge_sidecar_to_children"]["edges"][selected]["node"]["display_resources"]; | |
var url = node[(node.length - 1)]["src"]; | |
window.open(url); | |
} | |
// Little UI overlay | |
var style = ""; | |
style += "#lokl_guiContainer {bottom: 50px; width: 80px; right: 5px; "; | |
style += " font-family: -apple-system,BlinkMacSystemFont,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif; font-size: 14px; font-weight: 600; border: solid 1px rgb(22, 22, 22); border-radius: 3px;} "; | |
style += "#lokl_toggleScroll {padding: 2px 2px; border-radius: 3px; text-align: center; background-color: #323232; color: white;}"; | |
style += "#lokl_toggleScroll:hover {background-color: #1e1c1e; cursor: pointer;}"; | |
style += "#lokl_toggleScroll.active {background-color: #333133; }"; | |
style += "#lokl_toggleScroll.active:hover {background-color: #262526; }"; | |
var styleEl = document.createElement("style"); | |
styleEl.innerHTML = style; | |
document.body.appendChild(styleEl); | |
var guiContainer = document.createElement('div'); | |
document.getElementsByClassName("EcJQs")[0].append(guiContainer); | |
guiContainer.id = 'lokl_guiContainer'; | |
var btnToggle = document.createElement('a'); | |
guiContainer.append(btnToggle); | |
btnToggle.id = 'lokl_toggleScroll'; | |
btnToggle.innerHTML = 'i'; | |
btnToggle.addEventListener('click', function(){ | |
openUrl() | |
}); | |
})(); | |
################################################################################################################################## | |
hd-main.js application/javascript | |
(function(){ | |
var l = {}; | |
var noopfn = function() { | |
; | |
}; | |
var props = [ | |
"$j","Ad","Bd","Cd","Dd","Ed","Fd","Gd","Hd","Id","Jd","Nj","Oc","Pc","Pe", | |
"Qc","Qe","Rc","Re","Ri","Sc","Tc","Uc","Vc","Wc","Wg","Xc","Xg","Yc","Yd", | |
"ad","ae","bd","bf","cd","dd","ed","ef","ek","fd","fg","fh","fk","gd","hd", | |
"ig","ij","jd","kd","ke","ld","md","mi","nd","od","oh","pd","pf","qd","rd", | |
"sd","td","ud","vd","wd","wg","xd","xh","yd","zd", | |
"$d","$e","$k","Ae","Af","Aj","Be","Ce","De","Ee","Ek","Eo","Ep","Fe","Fo", | |
"Ge","Gh","Hk","Ie","Ip","Je","Ke","Kk","Kq","Le","Lh","Lk","Me","Mm","Ne", | |
"Oe","Pe","Qe","Re","Rp","Se","Te","Ue","Ve","Vp","We","Xd","Xe","Yd","Ye", | |
"Zd","Ze","Zf","Zk","ae","af","al","be","bf","bg","ce","cp","df","di","ee", | |
"ef","fe","ff","gf","gm","he","hf","ie","je","jf","ke","kf","kl","le","lf", | |
"lk","mf","mg","mn","nf","oe","of","pe","pf","pg","qe","qf","re","rf","se", | |
"sf","te","tf","ti","ue","uf","ve","vf","we","wf","wg","wi","xe","ye","yf", | |
"yk","yl","ze","zf","zk" | |
]; | |
for (var i = 0; i < props.length; i++) { | |
l[props[i]] = noopfn; | |
} | |
window.L = window.J = l; | |
})(); | |
# fuckadblock defuser | |
fuckadblock.js-3.2.0 application/javascript | |
(function() { | |
var noopfn = function() { | |
; | |
}; | |
// | |
var Fab = function() {}; | |
Fab.prototype.check = noopfn; | |
Fab.prototype.clearEvent = noopfn; | |
Fab.prototype.emitEvent = noopfn; | |
Fab.prototype.on = function(a, b) { | |
if ( !a ) { b(); } | |
return this; | |
}; | |
Fab.prototype.onDetected = function() { | |
return this; | |
}; | |
Fab.prototype.onNotDetected = function(a) { | |
a(); | |
return this; | |
}; | |
Fab.prototype.setOption = noopfn; | |
var fab = new Fab(), | |
getSetFab = { | |
get: function() { return Fab; }, | |
set: function() {} | |
}, | |
getsetfab = { | |
get: function() { return fab; }, | |
set: function() {} | |
}; | |
if ( window.hasOwnProperty('FuckAdBlock') ) { window.FuckAdBlock = Fab; } | |
else { Object.defineProperty(window, 'FuckAdBlock', getSetFab); } | |
if ( window.hasOwnProperty('BlockAdBlock') ) { window.BlockAdBlock = Fab; } | |
else { Object.defineProperty(window, 'BlockAdBlock', getSetFab); } | |
if ( window.hasOwnProperty('SniffAdBlock') ) { window.SniffAdBlock = Fab; } | |
else { Object.defineProperty(window, 'SniffAdBlock', getSetFab); } | |
if ( window.hasOwnProperty('fuckAdBlock') ) { window.fuckAdBlock = fab; } | |
else { Object.defineProperty(window, 'fuckAdBlock', getsetfab); } | |
if ( window.hasOwnProperty('blockAdBlock') ) { window.blockAdBlock = fab; } | |
else { Object.defineProperty(window, 'blockAdBlock', getsetfab); } | |
if ( window.hasOwnProperty('sniffAdBlock') ) { window.sniffAdBlock = fab; } | |
else { Object.defineProperty(window, 'sniffAdBlock', getsetfab); } | |
})(); | |
# To neutralize GA scripts. The goal is to provide the minimal API | |
# expected by clients of these scripts so that the end users are able | |
# to wholly block GA while minimizing risks of page breakage. | |
# Test cases (need way more): | |
# - https://github.com/chrisaljoudi/uBlock/issues/119 | |
# Reference API: | |
# - https://developers.google.com/analytics/devguides/collection/gajs/ | |
google-analytics.com/ga.js application/javascript | |
(function() { | |
var noopfn = function() { | |
; | |
}; | |
// | |
var 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://twitter.com/catovitch/status/776442930345218048 | |
// https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiDomainDirectory#_gat.GA_Tracker_._link | |
if ( a[0] === '_link' && typeof a[1] === 'string' ) { | |
window.location.assign(a[1]); | |
} | |
// https://github.com/gorhill/uBlock/issues/2162 | |
if ( a[0] === '_set' && a[1] === 'hitCallback' && typeof a[2] === 'function' ) { | |
a[2](); | |
} | |
}; | |
// | |
var tracker = (function() { | |
var out = {}; | |
var api = [ | |
'_addIgnoredOrganic _addIgnoredRef _addItem _addOrganic', | |
'_addTrans _clearIgnoredOrganic _clearIgnoredRef _clearOrganic', | |
'_cookiePathCopy _deleteCustomVar _getName _setAccount', | |
'_getAccount _getClientInfo _getDetectFlash _getDetectTitle', | |
'_getLinkerUrl _getLocalGifPath _getServiceMode _getVersion', | |
'_getVisitorCustomVar _initData _link _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+/); | |
var i = api.length; | |
while ( i-- ) { | |
out[api[i]] = noopfn; | |
} | |
out._getLinkerUrl = function(a) { | |
return a; | |
}; | |
return out; | |
})(); | |
// | |
var 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; | |
var gat = new Gat(); | |
window._gat = gat; | |
// | |
var gaq = new Gaq(); | |
(function() { | |
var aa = window._gaq || []; | |
if ( Array.isArray(aa) ) { | |
while ( aa[0] ) { | |
gaq.push(aa.shift()); | |
} | |
} | |
})(); | |
window._gaq = gaq.qf = gaq; | |
})(); | |
google-analytics.com/analytics.js application/javascript | |
(function() { | |
// https://developers.google.com/analytics/devguides/collection/analyticsjs/ | |
var noopfn = function() { | |
; | |
}; | |
var noopnullfn = function() { | |
return null; | |
}; | |
// | |
var Tracker = function() { | |
; | |
}; | |
var p = Tracker.prototype; | |
p.get = noopfn; | |
p.set = noopfn; | |
p.send = noopfn; | |
// | |
var w = window, | |
gaName = w.GoogleAnalyticsObject || 'ga'; | |
var 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; | |
} | |
try { | |
f.hitCallback(); | |
} catch (ex) { | |
} | |
}; | |
ga.create = function() { | |
return new Tracker(); | |
}; | |
ga.getByName = noopnullfn; | |
ga.getAll = function() { | |
return []; | |
}; | |
ga.remove = noopfn; | |
// https://github.com/uBlockOrigin/uAssets/issues/2107 | |
ga.loaded = true; | |
w[gaName] = ga; | |
// https://github.com/gorhill/uBlock/issues/3075 | |
var dl = w.dataLayer; | |
if ( dl instanceof Object && dl.hide instanceof Object && typeof dl.hide.end === 'function' ) { | |
dl.hide.end(); | |
} | |
})(); | |
google-analytics.com/inpage_linkid.js application/javascript | |
(function() { | |
window._gaq = window._gaq || { | |
push: function() { | |
; | |
} | |
}; | |
})(); | |
# https://github.com/gorhill/uBlock/issues/2480 | |
# https://developers.google.com/analytics/devguides/collection/gajs/experiments#cxjs | |
google-analytics.com/cx/api.js application/javascript | |
(function() { | |
var noopfn = function() { | |
}; | |
window.cxApi = { | |
chooseVariation: function() { | |
return 0; | |
}, | |
getChosenVariation: noopfn, | |
setAllowHash: noopfn, | |
setChosenVariation: noopfn, | |
setCookiePath: noopfn, | |
setDomainName: noopfn | |
}; | |
})(); | |
# Ubiquitous googletagservices.com: not blocked by EasyPrivacy. | |
# "Tags are tiny bits of website code that let you measure traffic and | |
# "visitor behavior" | |
googletagservices.com/gpt.js application/javascript | |
(function() { | |
var p; | |
// https://developers.google.com/doubleclick-gpt/reference | |
var noopfn = function() { | |
; | |
}.bind(); | |
var noopthisfn = function() { | |
return this; | |
}; | |
var noopnullfn = function() { | |
return null; | |
}; | |
var nooparrayfn = function() { | |
return []; | |
}; | |
var noopstrfn = function() { | |
return ''; | |
}; | |
// | |
var companionAdsService = { | |
addEventListener: noopthisfn, | |
enableSyncLoading: noopfn, | |
setRefreshUnfilledSlots: noopfn | |
}; | |
var contentService = { | |
addEventListener: noopthisfn, | |
setContent: noopfn | |
}; | |
var PassbackSlot = function() { | |
; | |
}; | |
p = PassbackSlot.prototype; | |
p.display = noopfn; | |
p.get = noopnullfn; | |
p.set = noopthisfn; | |
p.setClickUrl = noopthisfn; | |
p.setTagForChildDirectedTreatment = noopthisfn; | |
p.setTargeting = noopthisfn; | |
p.updateTargetingFromMap = noopthisfn; | |
var pubAdsService = { | |
addEventListener: noopthisfn, | |
clear: noopfn, | |
clearCategoryExclusions: noopthisfn, | |
clearTagForChildDirectedTreatment: noopthisfn, | |
clearTargeting: noopthisfn, | |
collapseEmptyDivs: noopfn, | |
defineOutOfPagePassback: function() { return new PassbackSlot(); }, | |
definePassback: function() { return new PassbackSlot(); }, | |
disableInitialLoad: noopfn, | |
display: noopfn, | |
enableAsyncRendering: noopfn, | |
enableSingleRequest: noopfn, | |
enableSyncRendering: noopfn, | |
enableVideoAds: noopfn, | |
get: noopnullfn, | |
getAttributeKeys: nooparrayfn, | |
getTargeting: noopfn, | |
getTargetingKeys: nooparrayfn, | |
getSlots: nooparrayfn, | |
refresh: noopfn, | |
set: noopthisfn, | |
setCategoryExclusion: noopthisfn, | |
setCentering: noopfn, | |
setCookieOptions: noopthisfn, | |
setForceSafeFrame: noopthisfn, | |
setLocation: noopthisfn, | |
setPublisherProvidedId: noopthisfn, | |
setRequestNonPersonalizedAds: noopthisfn, | |
setSafeFrameConfig: noopthisfn, | |
setTagForChildDirectedTreatment: noopthisfn, | |
setTargeting: noopthisfn, | |
setVideoContent: noopthisfn, | |
updateCorrelator: noopfn | |
}; | |
var SizeMappingBuilder = function() { | |
; | |
}; | |
p = SizeMappingBuilder.prototype; | |
p.addSize = noopthisfn; | |
p.build = noopnullfn; | |
var Slot = function() { | |
; | |
}; | |
p = Slot.prototype; | |
p.addService = noopthisfn; | |
p.clearCategoryExclusions = noopthisfn; | |
p.clearTargeting = noopthisfn; | |
p.defineSizeMapping = noopthisfn; | |
p.get = noopnullfn; | |
p.getAdUnitPath = nooparrayfn; | |
p.getAttributeKeys = nooparrayfn; | |
p.getCategoryExclusions = nooparrayfn; | |
p.getDomId = noopstrfn; | |
p.getSlotElementId = noopstrfn; | |
p.getSlotId = noopthisfn; | |
p.getTargeting = nooparrayfn; | |
p.getTargetingKeys = nooparrayfn; | |
p.set = noopthisfn; | |
p.setCategoryExclusion = noopthisfn; | |
p.setClickUrl = noopthisfn; | |
p.setCollapseEmptyDiv = noopthisfn; | |
p.setTargeting = noopthisfn; | |
// | |
var gpt = window.googletag || {}; | |
var cmd = gpt.cmd || []; | |
gpt.apiReady = true; | |
gpt.cmd = []; | |
gpt.cmd.push = function(a) { | |
try { | |
a(); | |
} catch (ex) { | |
} | |
return 1; | |
}; | |
gpt.companionAds = function() { return companionAdsService; }; | |
gpt.content = function() { return contentService; }; | |
gpt.defineOutOfPageSlot = function() { return new Slot(); }; | |
gpt.defineSlot = function() { return new Slot(); }; | |
gpt.destroySlots = noopfn; | |
gpt.disablePublisherConsole = noopfn; | |
gpt.display = noopfn; | |
gpt.enableServices = noopfn; | |
gpt.getVersion = noopstrfn; | |
gpt.pubads = function() { return pubAdsService; }; | |
gpt.pubadsReady = true; | |
gpt.setAdIframeTitle = noopfn; | |
gpt.sizeMapping = function() { return new SizeMappingBuilder(); }; | |
window.googletag = gpt; | |
while ( cmd.length !== 0 ) { | |
gpt.cmd.push(cmd.shift()); | |
} | |
})(); | |
# Obviously more work needs to be done, but at least for now it takes care of: | |
# See related filter in assets/ublock/privacy.txt | |
# Also: | |
# - https://github.com/gorhill/uBlock/issues/2569 | |
# - https://github.com/uBlockOrigin/uAssets/issues/420 | |
googletagmanager.com/gtm.js application/javascript | |
(function() { | |
var noopfn = function() { | |
}; | |
var w = window; | |
w.ga = w.ga || noopfn; | |
var dl = w.dataLayer; | |
if ( dl instanceof Object === false ) { return; } | |
if ( dl.hide instanceof Object && typeof dl.hide.end === 'function' ) { | |
dl.hide.end(); | |
} | |
if ( typeof dl.push === 'function' ) { | |
dl.push = function(o) { | |
if ( | |
o instanceof Object && | |
typeof o.eventCallback === 'function' | |
) { | |
setTimeout(o.eventCallback, 1); | |
} | |
}; | |
} | |
})(); | |
# https://github.com/uBlockOrigin/uAssets/issues/282 | |
# https://github.com/uBlockOrigin/uAssets/issues/418 | |
googlesyndication.com/adsbygoogle.js application/javascript | |
(function() { | |
window.adsbygoogle = window.adsbygoogle || { | |
length: 0, | |
loaded: true, | |
push: function Si(a) { | |
/* | |
client = client || google_ad_client || google_ad_client; | |
slotname = slotname || google_ad_slot; | |
tag_origin = tag_origin || google_tag_origin | |
*/ | |
this.length += 1; | |
} | |
}; | |
var phs = document.querySelectorAll('.adsbygoogle'); | |
var css = 'height:1px!important;max-height:1px!important;max-width:1px!important;width:1px!important;'; | |
for ( var i = 0; i < phs.length; i++ ) { | |
var fr = document.createElement('iframe'); | |
fr.id = 'aswift_' + (i+1); | |
fr.style = css; | |
var cfr = document.createElement('iframe'); | |
cfr.id = 'google_ads_frame' + i; | |
fr.appendChild(cfr); | |
document.body.appendChild(fr); | |
} | |
})(); | |
# https://forums.lanik.us/viewtopic.php?f=91&t=27188 | |
# https://forums.lanik.us/viewtopic.php?f=91&t=29609 | |
ligatus.com/*/angular-tag.js application/javascript | |
(function() { | |
self.adProtect = true; | |
Object.defineProperties(window, { | |
uabpdl: { value: true }, | |
uabDetect: { value: true } | |
}); | |
})(); | |
bab-defuser.js application/javascript | |
(function() { | |
var sto = window.setTimeout, | |
re = /\.bab_elementid.$/; | |
window.setTimeout = function(a, b) { | |
if ( typeof a !== 'string' || !re.test(a) ) { | |
return sto.apply(this, arguments); | |
} | |
}.bind(window); | |
var signatures = [ | |
['blockadblock'], | |
['babasbm'], | |
[/getItem\('babn'\)/], | |
['getElementById','String.fromCharCode','ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789','charAt','DOMContentLoaded','AdBlock','addEventListener','doScroll','fromCharCode','<<2|r>>4','sessionStorage','clientWidth','localStorage','Math','random'] | |
]; | |
var check = function(s) { | |
var tokens, match, j, token, pos; | |
for ( var i = 0; i < signatures.length; i++ ) { | |
tokens = signatures[i]; | |
match = 0; | |
for ( j = 0, pos = 0; j < tokens.length; j++ ) { | |
token = tokens[j]; | |
pos = token instanceof RegExp ? s.search(token) : s.indexOf(token); | |
if ( pos !== -1 ) { match += 1; } | |
} | |
if ( (match / tokens.length) >= 0.8 ) { return true; } | |
} | |
return false; | |
}; | |
var realEval = window.eval; | |
window.eval = function(a) { | |
if ( typeof a !== 'string' || !check(a) ) { | |
return realEval(a); | |
} | |
var el = document.body; | |
if ( el ) { | |
el.style.removeProperty('visibility'); | |
} | |
el = document.getElementById('babasbmsgx'); | |
if ( el ) { | |
el.parentNode.removeChild(el); | |
} | |
}.bind(window); | |
})(); | |
scorecardresearch.com/beacon.js application/javascript | |
(function() { | |
window.COMSCORE = { | |
purge: function() { | |
_comscore = []; | |
}, | |
beacon: function() { | |
; | |
} | |
}; | |
})(); | |
# https://github.com/gorhill/uBlock/issues/1250#issuecomment-173533894 | |
widgets.outbrain.com/outbrain.js application/javascript | |
(function() { | |
var noopfn = function() { | |
; | |
}; | |
var obr = {}; | |
var methods = [ | |
'callClick', 'callLoadMore', 'callRecs', 'callUserZapping', | |
'callWhatIs', 'cancelRecommendation', 'cancelRecs', 'closeCard', | |
'closeModal', 'closeTbx', 'errorInjectionHandler', 'getCountOfRecs', | |
'getStat', 'imageError', 'manualVideoClicked', 'onOdbReturn', | |
'onVideoClick', 'pagerLoad', 'recClicked', 'refreshSpecificWidget', | |
'refreshWidget', 'reloadWidget', 'researchWidget', 'returnedError', | |
'returnedHtmlData', 'returnedIrdData', 'returnedJsonData', 'scrollLoad', | |
'showDescription', 'showRecInIframe', 'userZappingMessage', 'zappingFormAction' | |
]; | |
obr.extern = { | |
video: { | |
getVideoRecs: noopfn, | |
videoClicked: noopfn | |
} | |
}; | |
methods.forEach(function(a) { | |
obr.extern[a] = noopfn; | |
}); | |
window.OBR = window.OBR || obr; | |
})(); | |
# https://github.com/gorhill/uBlock/issues/1228 | |
window.name-defuser application/javascript | |
if ( window === window.top ) { | |
window.name = ''; | |
} | |
# https://github.com/gorhill/uBlock/issues/897#issuecomment-180871042 | |
doubleclick.net/instream/ad_status.js application/javascript | |
window.google_ad_status = 1; | |
# https://github.com/gorhill/uBlock/issues/1384 | |
addthis.com/addthis_widget.js application/javascript | |
(function() { | |
var noopfn = function() { | |
; | |
}; | |
window.addthis = { | |
addEventListener: noopfn, | |
button: noopfn, | |
init: noopfn, | |
layers: noopfn, | |
ready: noopfn, | |
sharecounters: { | |
getShareCounts: noopfn | |
}, | |
toolbox: noopfn, | |
update: noopfn | |
}; | |
})(); | |
# Completely experimental: load Disqus on demand only. Purpose is to avoid | |
# connecting to Disqus' servers, unless the user explicitly asks for the | |
# comments to be loaded. | |
# Works with following filters: | |
# ||disqus.com/forums/*/embed.js$script,redirect=disqus.com/forums/*/embed.js | |
# ||disqus.com/embed.js$script,redirect=disqus.com/embed.js | |
# ||disqus.com/count.js$script | |
# @@||disqus.com/embed.js?_=1457540*$script | |
# If you want a site you regularly visit to always have the comment loaded, | |
# just use an exception static filter. Example for wired.com: | |
# @@||wired.disqus.com/embed.js | |
# Sometimes a site will use this one script: | |
disqus.com/forums/*/embed.js application/javascript | |
(function() { | |
var ee = document.getElementsByTagName('script'); | |
var i = ee.length, src; | |
while ( i-- ) { | |
src = ee[i].src || ''; | |
if ( src === '' ) { | |
continue; | |
} | |
if ( src.lastIndexOf('disqus.com/embed.js') === (src.length - 19) ) { | |
return; | |
} | |
} | |
var e = document.createElement('script'); | |
e.async = true; | |
e.src = '//' + window.disqus_shortname + '.disqus.com/embed.js'; | |
document.body.appendChild(e); | |
})(); | |
# Most use this one though: | |
disqus.com/embed.js application/javascript | |
(function() { | |
var p = document.getElementById(window.disqus_container_id || 'disqus_thread'); | |
if ( p === null ) { | |
return; | |
} | |
var b = document.createElement('button'); | |
b.textContent = 'Disqus blocked by uBlock Origin: click to unblock'; | |
b.type = 'button'; | |
p.appendChild(b); | |
var loadDisqus = function(ev) { | |
b.removeEventListener('click', loadDisqus); | |
p.removeChild(b); | |
var script = document.createElement('script'); | |
script.async = true; | |
var t = Date.now().toString(); | |
script.src = '//' + window.disqus_shortname + '.disqus.com/embed.js?_=1457540' + t.slice(-6); | |
document.body.appendChild(script); | |
ev.preventDefault(); | |
ev.stopPropagation(); | |
}; | |
b.addEventListener('click', loadDisqus); | |
})(); | |
amazon-adsystem.com/aax2/amzn_ads.js application/javascript | |
(function() { | |
if ( amznads ) { | |
return; | |
} | |
var w = window; | |
var noopfn = function() { | |
; | |
}.bind(); | |
var amznads = { | |
appendScriptTag: noopfn, | |
appendTargetingToAdServerUrl: noopfn, | |
appendTargetingToQueryString: noopfn, | |
clearTargetingFromGPTAsync: noopfn, | |
doAllTasks: noopfn, | |
doGetAdsAsync: noopfn, | |
doTask: noopfn, | |
detectIframeAndGetURL: noopfn, | |
getAds: noopfn, | |
getAdsAsync: noopfn, | |
getAdForSlot: noopfn, | |
getAdsCallback: noopfn, | |
getDisplayAds: noopfn, | |
getDisplayAdsAsync: noopfn, | |
getDisplayAdsCallback: noopfn, | |
getKeys: noopfn, | |
getReferrerURL: noopfn, | |
getScriptSource: noopfn, | |
getTargeting: noopfn, | |
getTokens: noopfn, | |
getValidMilliseconds: noopfn, | |
getVideoAds: noopfn, | |
getVideoAdsAsync: noopfn, | |
getVideoAdsCallback: noopfn, | |
handleCallBack: noopfn, | |
hasAds: noopfn, | |
renderAd: noopfn, | |
saveAds: noopfn, | |
setTargeting: noopfn, | |
setTargetingForGPTAsync: noopfn, | |
setTargetingForGPTSync: noopfn, | |
tryGetAdsAsync: noopfn, | |
updateAds: noopfn | |
}; | |
w.amznads = amznads; | |
w.amzn_ads = w.amzn_ads || noopfn; | |
w.aax_write = w.aax_write || noopfn; | |
w.aax_render_ad = w.aax_render_ad || noopfn; | |
})(); | |
# Experimental: Generic nuisance overlay buster. | |
# if this works well and proves to be useful, this may end up as a stock tool | |
# in uBO's popup panel. | |
overlay-buster.js application/javascript | |
(function() { | |
if ( window !== window.top ) { | |
return; | |
} | |
var tstart; | |
var ttl = 30000; | |
var delay = 0; | |
var delayStep = 50; | |
var buster = function(mutations) { | |
var docEl = document.documentElement, | |
bodyEl = document.body, | |
vw = Math.min(docEl.clientWidth, window.innerWidth), | |
vh = Math.min(docEl.clientHeight, window.innerHeight), | |
tol = Math.min(vw, vh) * 0.05, | |
el = document.elementFromPoint(vw/2, vh/2), | |
style, rect; | |
for (;;) { | |
if ( el === null || el.parentNode === null || el === bodyEl ) { | |
break; | |
} | |
style = window.getComputedStyle(el); | |
if ( parseInt(style.zIndex, 10) >= 1000 || style.position === 'fixed' ) { | |
rect = el.getBoundingClientRect(); | |
if ( rect.left <= tol && rect.top <= tol && (vw - rect.right) <= tol && (vh - rect.bottom) < tol ) { | |
el.parentNode.removeChild(el); | |
tstart = Date.now(); | |
el = document.elementFromPoint(vw/2, vh/2); | |
bodyEl.style.setProperty('overflow', 'auto', 'important'); | |
docEl.style.setProperty('overflow', 'auto', 'important'); | |
continue; | |
} | |
} | |
el = el.parentNode; | |
} | |
if ( (Date.now() - tstart) < ttl ) { | |
delay = Math.min(delay + delayStep, 1000); | |
setTimeout(buster, delay); | |
} | |
}; | |
var domReady = function(ev) { | |
if ( ev ) { | |
document.removeEventListener(ev.type, domReady); | |
} | |
tstart = Date.now(); | |
setTimeout(buster, delay); | |
}; | |
if ( document.readyState === 'loading' ) { | |
document.addEventListener('DOMContentLoaded', domReady); | |
} else { | |
domReady(); | |
} | |
})(); | |
# https://github.com/uBlockOrigin/uAssets/issues/8 | |
alert-buster.js application/javascript | |
(function() { | |
window.alert = function(a) { | |
console.info(a); | |
}; | |
})(); | |
# https://github.com/uBlockOrigin/uAssets/issues/58 | |
gpt-defuser.js application/javascript | |
(function() { | |
var noopfn = function() { | |
; | |
}; | |
var props = '_resetGPT resetGPT resetAndLoadGPTRecovery _resetAndLoadGPTRecovery setupGPT setupGPTuo'; | |
props = props.split(/\s+/); | |
while ( props.length ) { | |
var prop = props.pop(); | |
if ( typeof window[prop] === 'function' ) { | |
window[prop] = noopfn; | |
} else { | |
Object.defineProperty(window, prop, { | |
get: function() { return noopfn; }, | |
set: noopfn | |
}); | |
} | |
} | |
})(); | |
# Prevent web pages from using eval(), and report attempts in console. | |
noeval.js application/javascript | |
(function() { | |
window.eval = function(s) { | |
console.log('Document tried to eval... \n' + s); | |
}.bind(window); | |
})(); | |
silent-noeval.js application/javascript | |
(function() { | |
window.eval = function(s) { | |
; | |
}.bind(window); | |
})(); | |
noeval-if.js application/javascript | |
(function() { | |
var needle = '{{1}}'; | |
if ( needle === '' || needle === '{{1}}' ) { | |
needle = '.?'; | |
} else if ( needle.slice(0,1) === '/' && needle.slice(-1) === '/' ) { | |
needle = needle.slice(1,-1); | |
} else { | |
needle = needle.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); | |
} | |
needle = new RegExp(needle); | |
realNoEval = window.eval; | |
window.eval = function(a) { | |
if ( !needle.test(a.toString()) ) { | |
realNoEval.call(window, a); | |
} | |
}.bind(window); | |
})(); | |
# Prevent web pages from using RTCPeerConnection(), and report attempts in console. | |
nowebrtc.js application/javascript | |
(function() { | |
var rtcName = window.RTCPeerConnection ? 'RTCPeerConnection' : ( | |
window.webkitRTCPeerConnection ? 'webkitRTCPeerConnection' : '' | |
); | |
if ( rtcName === '' ) { return; } | |
var log = console.log.bind(console); | |
var pc = function(cfg) { | |
log('Document tried to create an RTCPeerConnection: %o', cfg); | |
}; | |
var noop = function() { | |
; | |
}; | |
pc.prototype = { | |
close: noop, | |
createDataChannel: noop, | |
createOffer: noop, | |
setRemoteDescription: noop, | |
toString: function() { | |
return '[object RTCPeerConnection]'; | |
} | |
}; | |
var z = window[rtcName]; | |
window[rtcName] = pc.bind(window); | |
if ( z.prototype ) { | |
z.prototype.createDataChannel = function(a, b) { | |
return { | |
close: function() {}, | |
send: function() {} | |
}; | |
}.bind(null); | |
} | |
})(); | |
# https://github.com/uBlockOrigin/uAssets/issues/88 | |
golem.de.js application/javascript | |
(function() { | |
const rael = window.addEventListener; | |
window.addEventListener = function(a, b) { | |
rael(...arguments); | |
let haystack; | |
try { | |
haystack = b.toString(); | |
} catch(ex) { | |
} | |
if ( | |
typeof haystack === 'string' && | |
/^\s*function\s*\(\)\s*\{\s*window\.clearTimeout\(r\)\s*\}\s*$/.test(haystack) | |
) { | |
b(); | |
} | |
}.bind(window); | |
})(); | |
# https://www.reddit.com/r/firefox/comments/4wpd23/popads_just_announced_that_they_have_a_new_method/ | |
popads.net.js application/javascript | |
(function() { | |
var magic = String.fromCharCode(Date.now() % 26 + 97) + | |
Math.floor(Math.random() * 982451653 + 982451653).toString(36), | |
oe = window.onerror; | |
window.onerror = function(msg, src, line, col, error) { | |
if ( typeof msg === 'string' && msg.indexOf(magic) !== -1 ) { return true; } | |
if ( oe instanceof Function ) { | |
return oe(msg, src, line, col, error); | |
} | |
}.bind(); | |
var throwMagic = function() { throw magic; }; | |
delete window.PopAds; | |
delete window.popns; | |
Object.defineProperties(window, { | |
PopAds: { set: throwMagic }, | |
popns: { set: throwMagic } | |
}); | |
})(); | |
# https://github.com/uBlockOrigin/uAssets/issues/503 | |
popads-dummy.js application/javascript | |
(function() { | |
delete window.PopAds; | |
delete window.popns; | |
Object.defineProperties(window, { | |
PopAds: { value: {} }, | |
popns: { value: {} } | |
}); | |
})(); | |
# https://forums.lanik.us/viewtopic.php?f=64&t=32278 | |
# https://www.reddit.com/r/chrome/comments/58eix6/ublock_origin_not_working_on_certain_sites/ | |
upmanager-defuser.js application/javascript | |
(function() { | |
var onerror = window.onerror; | |
window.onerror = function(msg, source, lineno, colno, error) { | |
if ( typeof msg === 'string' && msg.indexOf('upManager') !== -1 ) { | |
return true; | |
} | |
if ( onerror instanceof Function ) { | |
onerror.call(window, msg, source, lineno, colno, error); | |
} | |
}; | |
Object.defineProperty(window, 'upManager', { value: function() {} }); | |
})(); | |
# https://github.com/uBlockOrigin/uAssets/issues/110 | |
smartadserver.com.js application/javascript | |
Object.defineProperties(window, { | |
SmartAdObject: { value: function(){} }, | |
SmartAdServerAjax: { value: function(){} }, | |
smartAd: { value: { LoadAds: function() {}, Register: function() {} } } | |
}); | |
# https://github.com/uBlockOrigin/uAssets/issues/125 | |
d3pkae9owd2lcf.cloudfront.net/mb105.js application/javascript | |
(function() { | |
var noopfn = function(){}; | |
window.pbjs = { libLoaded: true }; | |
var mb = window.MonkeyBroker || { | |
addAttribute: noopfn, | |
addSlot: function(a) { | |
this.slots[a.slot] = {}; | |
}, | |
defineSlot: noopfn, | |
fillSlot: noopfn, | |
go: noopfn, | |
inventoryConditionalPlacement: noopfn, | |
registerSizeCallback: noopfn, | |
registerSlotCallback: noopfn, | |
slots: {}, | |
version: '' | |
}; | |
mb.regSlotsMap = mb.slots; | |
window.MonkeyBroker = mb; | |
})(); | |
# https://twitter.com/Scarbir/status/785551814460571648 | |
static.chartbeat.com/chartbeat.js application/javascript | |
(function() { | |
var noopfn = function(){}; | |
window.pSUPERFLY = { | |
activity: noopfn, | |
virtualPage: noopfn | |
}; | |
})(); | |
# https://github.com/gorhill/uBlock/issues/2132 | |
abort-on-property-write.js application/javascript | |
(function() { | |
var magic = String.fromCharCode(Date.now() % 26 + 97) + | |
Math.floor(Math.random() * 982451653 + 982451653).toString(36); | |
var prop = '{{1}}', | |
owner = window, | |
pos; | |
for (;;) { | |
pos = prop.indexOf('.'); | |
if ( pos === -1 ) { break; } | |
owner = owner[prop.slice(0, pos)]; | |
if ( owner instanceof Object === false ) { return; } | |
prop = prop.slice(pos + 1); | |
} | |
delete owner[prop]; | |
Object.defineProperty(owner, prop, { | |
set: function() { | |
throw new ReferenceError(magic); | |
} | |
}); | |
var oe = window.onerror; | |
window.onerror = function(msg, src, line, col, error) { | |
if ( typeof msg === 'string' && msg.indexOf(magic) !== -1 ) { | |
return true; | |
} | |
if ( oe instanceof Function ) { | |
return oe(msg, src, line, col, error); | |
} | |
}.bind(); | |
})(); | |
abort-on-property-read.js application/javascript | |
(function() { | |
var magic = String.fromCharCode(Date.now() % 26 + 97) + | |
Math.floor(Math.random() * 982451653 + 982451653).toString(36); | |
var abort = function() { | |
throw new ReferenceError(magic); | |
}; | |
var chain = '{{1}}', owner = window, pos, desc; | |
var makeProxy = function(owner, chain) { | |
pos = chain.indexOf('.'); | |
if ( pos === -1 ) { | |
desc = Object.getOwnPropertyDescriptor(owner, chain); | |
if ( !desc || desc.get !== abort ) { | |
Object.defineProperty(owner, chain, { get: abort, set: function(){} }); | |
} | |
return; | |
} | |
var prop = chain.slice(0, pos), | |
v = owner[prop]; | |
chain = chain.slice(pos + 1); | |
if ( v ) { | |
makeProxy(v, chain); | |
return; | |
} | |
desc = Object.getOwnPropertyDescriptor(owner, prop); | |
if ( desc && desc.set && desc.set.hasOwnProperty(magic) ) { | |
return; | |
} | |
var setter = function(a) { | |
v = a; | |
if ( a instanceof Object ) { | |
makeProxy(a, chain); | |
} | |
}; | |
setter[magic] = undefined; | |
Object.defineProperty(owner, prop, { | |
get: function() { return v; }, | |
set: setter | |
}); | |
}; | |
makeProxy(owner, chain); | |
var oe = window.onerror; | |
window.onerror = function(msg, src, line, col, error) { | |
if ( typeof msg === 'string' && msg.indexOf(magic) !== -1 ) { | |
return true; | |
} | |
if ( oe instanceof Function ) { | |
return oe(msg, src, line, col, error); | |
} | |
}.bind(); | |
})(); | |
setTimeout-defuser.js application/javascript | |
(function() { | |
var z = window.setTimeout, | |
needle = '{{1}}', | |
delay = parseInt('{{2}}', 10); | |
if ( needle === '' || needle === '{{1}}' ) { | |
needle = '.?'; | |
} else if ( needle.slice(0,1) === '/' && needle.slice(-1) === '/' ) { | |
needle = needle.slice(1,-1); | |
} else { | |
needle = needle.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); | |
} | |
needle = new RegExp(needle); | |
window.setTimeout = function(a, b) { | |
if ( (isNaN(delay) || b == delay) && needle.test(a.toString()) ) { | |
return z(function(){}, b); | |
} | |
return z.apply(this, arguments); | |
}.bind(window); | |
})(); | |
setTimeout-logger.js application/javascript | |
(function() { | |
var z = window.setTimeout, | |
log = console.log.bind(console); | |
window.setTimeout = function(a, b) { | |
log('uBO: setTimeout("%s", %s)', a.toString(), b); | |
return z.apply(this, arguments); | |
}.bind(window); | |
})(); | |
setInterval-defuser.js application/javascript | |
(function() { | |
var w = window, | |
z = w.setInterval, | |
needle = '{{1}}', | |
delay = parseInt('{{2}}', 10); | |
if ( needle === '' || needle === '{{1}}' ) { | |
needle = '.?'; | |
} else if ( needle.slice(0,1) === '/' && needle.slice(-1) === '/' ) { | |
needle = needle.slice(1,-1); | |
} else { | |
needle = needle.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); | |
} | |
needle = new RegExp(needle); | |
w.setInterval = function(a, b) { | |
if ( (isNaN(delay) || b == delay) && needle.test(a.toString()) ) { | |
return z(function(){}, b); | |
} | |
return z.apply(this, arguments); | |
}.bind(w); | |
w.setInterval.toString = function() { return z.toString(); }; | |
})(); | |
setInterval-logger.js application/javascript | |
(function() { | |
var z = window.setInterval, | |
log = console.log.bind(console); | |
window.setInterval = function(a, b) { | |
log('uBO: setInterval("%s", %s)', a.toString(), b); | |
return z.apply(this, arguments); | |
}.bind(window); | |
})(); | |
# https://github.com/uBlockOrigin/uAssets/issues/521 | |
addEventListener-logger.js application/javascript | |
(function() { | |
var c = console, l = c.log; | |
var z = self.EventTarget.prototype.addEventListener; | |
self.EventTarget.prototype.addEventListener = function(a, b) { | |
l.call(c, 'addEventListener("%s", %s)', a, String(b)); | |
return z.apply(this, arguments); | |
}; | |
})(); | |
# https://github.com/uBlockOrigin/uAssets/issues/521 | |
addEventListener-defuser.js application/javascript | |
(function() { | |
var needle1 = '{{1}}', | |
needle2 = '{{2}}', | |
z = self.EventTarget.prototype.addEventListener; | |
if ( needle1 === '' || needle1 === '{{1}}' ) { | |
needle1 = '.?'; | |
} else if ( /^\/.+\/$/.test(needle1) ) { | |
needle1 = needle1.slice(1,-1); | |
} else { | |
needle1 = needle1.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); | |
} | |
needle1 = new RegExp(needle1); | |
if ( needle2 === '' || needle2 === '{{2}}' ) { | |
needle2 = '.?'; | |
} else if ( /^\/.+\/$/.test(needle2) ) { | |
needle2 = needle2.slice(1,-1); | |
} else { | |
needle2 = needle2.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); | |
} | |
needle2 = new RegExp(needle2); | |
self.EventTarget.prototype.addEventListener = function(a, b) { | |
if ( needle1.test(a.toString()) && needle2.test(String(b)) ) { | |
return; | |
} | |
return z.apply(this, arguments); | |
}; | |
})(); | |
# https://github.com/uBlockOrigin/uAssets/issues/618 | |
abort-current-inline-script.js application/javascript | |
(function() { | |
var target = '{{1}}'; | |
if ( target === '' || target === '{{1}}' ) { return; } | |
var needle = '{{2}}', reText = '.?'; | |
if ( needle !== '' && needle !== '{{2}}' ) { | |
reText = /^\/.+\/$/.test(needle) | |
? needle.slice(1,-1) | |
: needle.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); | |
} | |
var thisScript = document.currentScript; | |
var re = new RegExp(reText); | |
var chain = target.split('.'); | |
var owner = window, prop; | |
for (;;) { | |
prop = chain.shift(); | |
if ( chain.length === 0 ) { break; } | |
owner = owner[prop]; | |
if ( owner instanceof Object === false ) { return; } | |
} | |
var desc = Object.getOwnPropertyDescriptor(owner, prop); | |
if ( desc && desc.get !== undefined ) { return; } | |
var magic = String.fromCharCode(Date.now() % 26 + 97) + | |
Math.floor(Math.random() * 982451653 + 982451653).toString(36); | |
var value = owner[prop]; | |
var validate = function() { | |
var e = document.currentScript; | |
if ( | |
e instanceof HTMLScriptElement && | |
e.src === '' && | |
e !== thisScript && | |
re.test(e.textContent) | |
) { | |
throw new ReferenceError(magic); | |
} | |
}; | |
Object.defineProperty(owner, prop, { | |
get: function() { | |
validate(); | |
return value; | |
}, | |
set: function(a) { | |
validate(); | |
value = a; | |
} | |
}); | |
var oe = window.onerror; | |
window.onerror = function(msg) { | |
if ( typeof msg === 'string' && msg.indexOf(magic) !== -1 ) { | |
return true; | |
} | |
if ( oe instanceof Function ) { | |
return oe.apply(this, arguments); | |
} | |
}.bind(); | |
})(); | |
# https://github.com/uBlockOrigin/uAssets/commit/a6c77af4afb45800d4fd7c268a2a5eab5a64daf3#commitcomment-24611606 | |
window.open-defuser.js application/javascript | |
(function() { | |
var wo = window.open, | |
target = '{{1}}', | |
needle = '{{2}}'; | |
if ( target === '' || target === '{{1}}' ) { | |
target = false; | |
} else { | |
target = !(+target); | |
} | |
if ( needle === '' || needle === '{{2}}' ) { | |
needle = '.?'; | |
} else if ( /^\/.+\/$/.test(needle) ) { | |
needle = needle.slice(1,-1); | |
} else { | |
needle = needle.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); | |
} | |
needle = new RegExp(needle); | |
window.open = (function(a) { | |
if ( needle.test(a) === target ) { | |
return wo.apply(window, arguments); | |
} | |
}).bind(window); | |
})(); | |
# https://github.com/reek/anti-adblock-killer/issues/3774#issuecomment-348536138 | |
# https://github.com/uBlockOrigin/uAssets/issues/883 | |
adfly-defuser.js application/javascript | |
(function() { | |
// Based on AdsBypasser | |
// License: | |
// https://github.com/adsbypasser/adsbypasser/blob/master/LICENSE | |
var isDigit = /^\d$/; | |
var handler = function(encodedURL) { | |
var var1 = "", var2 = "", i; | |
for (i = 0; i < encodedURL.length; i++) { | |
if (i % 2 === 0) { | |
var1 = var1 + encodedURL.charAt(i); | |
} else { | |
var2 = encodedURL.charAt(i) + var2; | |
} | |
} | |
var data = (var1 + var2).split(""); | |
for (i = 0; i < data.length; i++) { | |
if (isDigit.test(data[i])) { | |
for (var ii = i + 1; ii < data.length; ii++) { | |
if (isDigit.test(data[ii])) { | |
var temp = parseInt(data[i],10) ^ parseInt(data[ii],10); | |
if (temp < 10) { | |
data[i] = temp.toString(); | |
} | |
i = ii; | |
break; | |
} | |
} | |
} | |
} | |
data = data.join(""); | |
var decodedURL = window.atob(data).slice(16, -16); | |
window.stop(); | |
window.onbeforeunload = null; | |
window.location.href = decodedURL; | |
}; | |
try { | |
var val; | |
var flag = true; | |
window.Object.defineProperty(window, "ysmm", { | |
configurable: false, | |
set: function(value) { | |
if (flag) { | |
flag = false; | |
try { | |
if (typeof value === "string") { | |
handler(value); | |
} | |
} catch (err) { } | |
} | |
val = value; | |
}, | |
get: function() { | |
return val; | |
} | |
}); | |
} catch (err) { | |
window.console.error("Failed to set up Adfly bypasser!"); | |
} | |
})(); | |
# https://github.com/uBlockOrigin/uAssets/issues/913 | |
disable-newtab-links.js application/javascript | |
(function() { | |
document.addEventListener('click', function(ev) { | |
var target = ev.target; | |
while ( target !== null ) { | |
if ( target.localName === 'a' && target.hasAttribute('target') ) { | |
ev.stopPropagation(); | |
ev.preventDefault(); | |
break; | |
} | |
target = target.parentNode; | |
} | |
}); | |
})(); | |
set-constant.js application/javascript | |
(function() { | |
var cValue = '{{2}}'; | |
if ( cValue === 'undefined' ) { | |
cValue = undefined; | |
} else if ( cValue === 'false' ) { | |
cValue = false; | |
} else if ( cValue === 'true' ) { | |
cValue = true; | |
} else if ( cValue === 'null' ) { | |
cValue = null; | |
} else if ( cValue === 'noopFunc' ) { | |
cValue = function(){}; | |
} else if ( cValue === 'trueFunc' ) { | |
cValue = function(){ return true; }; | |
} else if ( cValue === 'falseFunc' ) { | |
cValue = function(){ return false; }; | |
} else if ( /^\d+$/.test(cValue) ) { | |
cValue = parseFloat(cValue); | |
if ( isNaN(cValue) ) { return; } | |
if ( Math.abs(cValue) > 0x7FFF ) { return; } | |
} else if ( cValue === "''" ) { | |
cValue = ''; | |
} else { | |
return; | |
} | |
var aborted = false; | |
var mustAbort = function(v) { | |
if ( aborted ) { return true; } | |
aborted = v !== undefined && cValue !== undefined && typeof v !== typeof cValue; | |
return aborted; | |
}; | |
var chain = '{{1}}', owner = window; | |
var makeProxy = function(owner, chain) { | |
var desc; | |
var pos = chain.indexOf('.'); | |
if ( pos === -1 ) { | |
if ( mustAbort(owner[chain]) ) { return; } | |
desc = Object.getOwnPropertyDescriptor(owner, chain); | |
if ( desc === undefined || desc.get === undefined ) { | |
Object.defineProperty(owner, chain, { | |
get: function() { | |
return cValue; | |
}, | |
set: function(a) { | |
if ( mustAbort(a) ) { | |
cValue = a; | |
} | |
} | |
}); | |
} | |
return; | |
} | |
var prop = chain.slice(0, pos), | |
v = owner[prop]; | |
chain = chain.slice(pos + 1); | |
if ( v !== undefined ) { | |
makeProxy(v, chain); | |
return; | |
} | |
desc = Object.getOwnPropertyDescriptor(owner, prop); | |
if ( desc && desc.set ) { return; } | |
Object.defineProperty(owner, prop, { | |
get: function() { | |
return v; | |
}, | |
set: function(a) { | |
v = a; | |
if ( a instanceof Object ) { | |
makeProxy(a, chain); | |
} | |
} | |
}); | |
}; | |
makeProxy(owner, chain); | |
})(); | |
# Imported from: | |
# https://github.com/NanoAdblocker/NanoFilters/blob/1f3be7211bb0809c5106996f52564bf10c4525f7/NanoFiltersSource/NanoResources.txt#L82 | |
# | |
# Speed up or down setTimeout, 3 optional arguments. | |
# funcMatcher - The payload matcher, a string literal or a JavaScript RegExp, | |
# defaults to match all. | |
# delayMatcher - The delay matcher, an integer, defaults to 1000. | |
# boostRatio - The delay multiplier when there is a match, 0.5 speeds up by | |
# 2 times and 2 slows down by 2 times, defaults to 0.05 or speed up 20 times. | |
# Speed up and down both cap at 50 times. | |
nano-setTimeout-booster.js application/javascript | |
(function() { | |
// Based on uAssets | |
// License: https://github.com/uBlockOrigin/uAssets/blob/master/LICENSE | |
var z = window.setTimeout, | |
needle = '{{1}}', | |
delay = parseInt('{{2}}', 10), | |
boost = parseFloat('{{3}}'); | |
if ( needle === '' || needle === '{{1}}' ) { | |
needle = '.?'; | |
} else if ( needle.charAt(0) === '/' && needle.slice(-1) === '/' ) { | |
needle = needle.slice(1, -1); | |
} else { | |
needle = needle.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); | |
} | |
needle = new RegExp(needle); | |
if ( isNaN(delay) || !isFinite(delay) ) { | |
delay = 1000; | |
} | |
if ( isNaN(boost) || !isFinite(boost) ) { | |
boost = 0.05; | |
} | |
if ( boost < 0.02 ) { | |
boost = 0.02; | |
} | |
if ( boost > 50 ) { | |
boost = 50; | |
} | |
window.setTimeout = function(a, b) { | |
if ( b === delay && needle.test(a.toString()) ) { | |
b *= boost; | |
} | |
return z.apply(this, arguments); | |
}.bind(window); | |
})(); | |
# Imported from: | |
# https://github.com/NanoAdblocker/NanoFilters/blob/1f3be7211bb0809c5106996f52564bf10c4525f7/NanoFiltersSource/NanoResources.txt#L126 | |
# | |
# Same as the last one except it is for setInterval instead of setTimeout. | |
nano-setInterval-booster.js application/javascript | |
(function() { | |
// Based on uAssets | |
// License: https://github.com/uBlockOrigin/uAssets/blob/master/LICENSE | |
var z = window.setInterval, | |
needle = '{{1}}', | |
delay = parseInt('{{2}}', 10), | |
boost = parseFloat('{{3}}'); | |
if ( needle === '' || needle === '{{1}}' ) { | |
needle = '.?'; | |
} else if ( needle.charAt(0) === '/' && needle.slice(-1) === '/' ) { | |
needle = needle.slice(1, -1); | |
} else { | |
needle = needle.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); | |
} | |
needle = new RegExp(needle); | |
if ( isNaN(delay) || !isFinite(delay) ) { | |
delay = 1000; | |
} | |
if ( isNaN(boost) || !isFinite(boost) ) { | |
boost = 0.05; | |
} | |
if ( boost < 0.02 ) { | |
boost = 0.02; | |
} | |
if ( boost > 50 ) { | |
boost = 50; | |
} | |
window.setInterval = function(a, b) { | |
if ( b === delay && needle.test(a.toString()) ) { | |
b *= boost; | |
} | |
return z.apply(this, arguments); | |
}.bind(window); | |
})(); | |
remove-attr.js application/javascript | |
(function() { | |
var attr = '{{1}}'; | |
if ( attr === '' || attr === '{{1}}' ) { return; } | |
var attrs = attr.split(/\s*\|\s*/); | |
var selector = '{{2}}'; | |
if ( selector === '' || selector === '{{2}}' ) { | |
selector = '[' + attrs.join('],[') + ']'; | |
} | |
var rmattr = function(ev) { | |
if ( ev ) { window.removeEventListener(ev.type, rmattr, true); } | |
try { | |
var nodes = document.querySelectorAll(selector), i = nodes.length; | |
while ( i-- ) { | |
var node = nodes[i], j = attrs.length; | |
while ( j-- ) { node.removeAttribute(attrs[j]); } | |
} | |
} catch(ex) { | |
} | |
}; | |
if ( document.readyState === 'loading' ) { | |
window.addEventListener('DOMContentLoaded', rmattr, true); | |
} else { | |
rmattr(); | |
} | |
})(); | |
damoh-defuser.js application/javascript | |
(function() { | |
var handled = new WeakSet(); | |
var asyncTimer; | |
var cleanVideo = function() { | |
asyncTimer = undefined; | |
var v = document.querySelector('video'); | |
if ( v === null ) { return; } | |
if ( handled.has(v) ) { return; } | |
handled.add(v); | |
v.pause(); | |
v.controls = true; | |
var el = v.querySelector('meta[itemprop="contentURL"][content]'); | |
if ( el === null ) { return; } | |
v.src = el.getAttribute('content'); | |
el = v.querySelector('meta[itemprop="thumbnailUrl"][content]'); | |
if ( el !== null ) { v.poster = el.getAttribute('content'); } | |
}; | |
var cleanVideoAsync = function() { | |
if ( asyncTimer !== undefined ) { return; } | |
asyncTimer = window.requestAnimationFrame(cleanVideo); | |
}; | |
var observer = new MutationObserver(cleanVideoAsync); | |
observer.observe(document.documentElement, { childList: true, subtree: true }); | |
})(); | |
# https://github.com/uBlockOrigin/uAssets/pull/3517 | |
twitch-videoad.js application/javascript | |
(function() { | |
if ( /(^|\.)twitch\.tv$/.test(document.location.hostname) === false ) { return; } | |
var realFetch = window.fetch; | |
window.fetch = function(input, init) { | |
if ( arguments.length >= 2 && typeof input === 'string' && input.includes('/access_token') ) { | |
var url = new URL(arguments[0]); | |
url.searchParams.set('platform', '_'); | |
arguments[0] = url.href; | |
} | |
return realFetch.apply(this, arguments); | |
}; | |
})(); | |
# https://github.com/uBlockOrigin/uAssets/issues/2912 | |
fingerprint2.js application/javascript | |
(function() { | |
let fp2 = function(){}; | |
fp2.prototype = { | |
get: function(cb) { | |
setTimeout(function() { cb('', []); }, 1); | |
} | |
}; | |
window.Fingerprint2 = fp2; | |
})(); | |
# https://github.com/NanoAdblocker/NanoFilters/issues/149 | |
cookie-remover.js application/javascript | |
(function() { | |
let needle = '{{1}}', | |
reName = /./; | |
if ( /^\/.+\/$/.test(needle) ) { | |
reName = new RegExp(needle.slice(1,-1)); | |
} else if ( needle !== '' && needle !== '{{1}}' ) { | |
reName = new RegExp(needle.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')); | |
} | |
let removeCookie = function() { | |
document.cookie.split(';').forEach(cookieStr => { | |
let pos = cookieStr.indexOf('='); | |
if ( pos === -1 ) { return; } | |
let cookieName = cookieStr.slice(0, pos).trim(); | |
if ( !reName.test(cookieName) ) { return; } | |
let part1 = cookieName + '='; | |
let part2a = '; domain=' + document.location.hostname; | |
let part2b = '; domain=.' + document.location.hostname; | |
let domain = document.domain; | |
let part2c = domain && domain !== document.location.hostname ? '; domain=.' + domain : undefined; | |
let part3 = '; path=/'; | |
let part4 = '; Max-Age=-1000; expires=Thu, 01 Jan 1970 00:00:00 GMT'; | |
document.cookie = part1 + part4; | |
document.cookie = part1 + part2a + part4; | |
document.cookie = part1 + part2b + part4; | |
document.cookie = part1 + part3 + part4; | |
document.cookie = part1 + part2a + part3 + part4; | |
document.cookie = part1 + part2b + part3 + part4; | |
if ( part2c !== undefined ) { | |
document.cookie = part1 + part2c + part3 + part4; | |
} | |
}); | |
}; | |
removeCookie(); | |
window.addEventListener('beforeunload', removeCookie); | |
})(); | |
# https://www.reddit.com/r/firefox/comments/9dudod/the_mysterious_case_of_missing_urls_and_googles/e5kgkkh | |
ampproject.org/v0.js application/javascript | |
(function() { | |
let head = document.head; | |
if ( !head ) { return; } | |
let style = document.createElement('style'); | |
style.textContent = [ | |
'body {', | |
' animation: none !important;', | |
' overflow: unset !important;', | |
'}' | |
].join('\n'); | |
head.appendChild(style); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment