Last active
September 26, 2021 17:55
-
-
Save aluxian/090326a5cdc2af46620a9e4f81b62830 to your computer and use it in GitHub Desktop.
AdGuard user scripts and filters
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
! Title: Facebook | |
! Expires: 60 days (update frequency) | |
! Homepage: https://gist.github.com/aluxian/090326a5cdc2af46620a9e4f81b62830 | |
! Source: https://gist.githubusercontent.com/aluxian/090326a5cdc2af46620a9e4f81b62830/raw/filter-facebookdrama.txt | |
! Licence: https://opensource.org/licenses/MIT | |
facebook.com##div#stream_pagelet | |
facebook.com##div#pagelet_trending_tags_and_topics | |
facebook.com##span.uiSideNavCount | |
facebook.com##div.home_right_column | |
facebook.com##div#pagelet_sidebar |
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
! Title: Twitter | |
! Expires: 60 days (update frequency) | |
! Homepage: https://gist.github.com/aluxian/090326a5cdc2af46620a9e4f81b62830 | |
! Source: https://gist.githubusercontent.com/aluxian/090326a5cdc2af46620a9e4f81b62830/raw/filter-twitterdrama.txt | |
! Licence: https://opensource.org/licenses/MIT | |
twitter.com##div.module.Footer | |
twitter.com##div.module.enhanced-media-thumbnails | |
twitter.com##div.trends | |
twitter.com##div.wrapper-discover | |
twitter.com##div.wrapper-home | |
twitter.com##div.wtf-module | |
twitter.com##li#global-nav-home | |
twitter.com##li.topics |
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
// ==UserScript== | |
// @run-at document-start | |
// @name General URL Cleaner | |
// @namespace https://greasyfork.org/en/scripts/10096-general-url-cleaner | |
// @description Cleans URL's from various popular sites. | |
// @downloadURL https://gist.github.com/aluxian/090326a5cdc2af46620a9e4f81b62830/raw/GeneralURLCleaner.user.js | |
// @updateURL https://gist.github.com/aluxian/090326a5cdc2af46620a9e4f81b62830/raw/GeneralURLCleaner.user.js | |
// @include https://www.youtube.com/* | |
// @include https://www.imdb.com/* | |
// @include https://www.facebook.com/* | |
// @include https://disqus.com/embed/comments/* | |
// @include /^https://(www|smile)\.amazon(\.com?)?(\.co\.uk?)?\.\w{2,3}/.*$/ | |
// @include /^https?://\w+\.google(\.com?)?(\.co\.uk?)?\.\w{2,3}/.*$/ | |
// @include /^https://[\w.]+\.ebay(desc)?(\.com?)?(\.co\.uk?)?\.\w{2,3}/.*$/ | |
// @include /^https://[\w\d.]*twitter.com/.*$/ | |
// @exclude https://apis.google.com/* | |
// @exclude https://accounts.google.com/* | |
// @exclude https://support.google.com/* | |
// @exclude https://www.google.com/recaptcha/* | |
// @exclude https://hangouts.google.com/webchat/* | |
// @version 3.3 | |
// @license GPL version 3 or any later version; http://www.gnu.org/copyleft/gpl.html | |
// ==/UserScript== | |
/* | |
* Vars | |
*/ | |
var ebay = /\.ebay(desc)?(\.com?)?\.\w{2,3}$/; | |
var google = /\.google\.com?(\.\w{2,3})?$/; | |
var amazon = /^(www|smile)\.amazon?\.com?(\.\w{2,3})?$/; | |
var amazonAd = /\.amazon-adsystem\.com?(\.\w{2,3})?$/; | |
var utmParams = /&utm_[^&]+/g; | |
var imdbParams = /&(p\w_rd_\w+|ref_)=[^&#]*/g; | |
var bingParams = /&(go|qs|form|FORM|filt|pq|s[cpk]|qpvt|cvid)=[^&#]*/g; | |
var youtubeParams = /&(feature|src_vid|annotation_id|[gh]l)=[^&#]*/g; | |
var ebayParams = /&(_(o?sacat|odkw|from|trksid|trkparms)|frcectupt|rt|epid|amp;[^=]+)=[^&#]*/g; | |
var amazonParams = /&(url|ie|th|psc|p\w_rd_\w\w?|bbn|rw_html_to_wsrp|ref_?|_encoding|refRID)=[^&#]*/g; | |
var googleParams = /&(sa(fe)?|ved|source(id)?|s?ei|tab|tbo|h[ls]|authuser|n?um|ie|aqs|as_qdr|bav|bi[wh]|bs|bvm|cad|channel|complete|cp|s?client|d[pc]r|e(ch|msg|s_sm)|g(fe|ws)_rd|gpsrc|noj|btnG|o[eq]|p(si|bx|f|q)|rct|rlz|site|spell|tbas|usg|xhr|gs_\w+)=[^&#]*/g; | |
var youtubeRedir = /[?&]q=([^&]+)/; | |
var genericRedir1 = /[?&](new|img)?u(rl)?=([^&]+)/i; | |
var genericRedir2 = /[?&]\w*url=([^&]+)/i; | |
let currHost = location.host; | |
let currPath = location.pathname; | |
let currSearch = location.search; | |
/* | |
* Main | |
*/ | |
if (currHost === 'www.bing.com') { | |
cleanCurrParams(bingParams); | |
cleanLinks(parserAll); | |
return; | |
} | |
if (currHost === 'www.youtube.com') { | |
if (currPath === '/redirect') | |
cleanRedir(location, youtureRedir); | |
if (currPath === '/watch') | |
cleanCurrParams(youtubeParams); | |
cleanLinks(parserYoutube); | |
return; | |
} | |
if (currHost === 'www.imdb.com') { | |
cleanCurrParams(imdbParams); | |
cleanLinks(parserIMDB); | |
onhashchange = deleteHash(); | |
return; | |
} | |
if (google.test(currHost)) { | |
if (currPath === '/url' || currPath === '/imgres') | |
cleanRedir(location, googleParams); | |
if (!currSearch && !/[&#]q=/.test(location.hash)) | |
return; | |
cleanCurrParams(googleParams); | |
changeState(googleInstant); | |
if (currSearch.includes('tbm=isch')) | |
cleanLinksAlways(parserGoogleImages); | |
else | |
cleanLinks(parserGoogle); | |
return; | |
} | |
if (ebay.test(currHost)) { | |
if (currPath.includes('/itm/')) { | |
let item = currPath.match(/\/\d{12}/); | |
let origList = currSearch.replace(/\?.*&?(orig_cvip=[^&]+).*/, '?$1'); | |
setCurrUrl('/itm' + item + origList + location.hash); | |
} | |
else if (currPath.startsWith('/p/')) { | |
if (currSearch.includes('iid=')) | |
setCurrUrl('/itm/' + currSearch.match(/[?&]iid=(\d{12})/).pop()); | |
else | |
setCurrUrl(currPath); | |
} | |
cleanCurrParams(ebayParams); | |
cleanLinks(parserEbay); | |
onhashchange = deleteHash; | |
return; | |
} | |
if (amazon.test(currHost)) { | |
let item = location.pathname.match(/\/[A-Z\d]{10}(?=\/|$)/); | |
if (currPath.includes('/dp/')) | |
setCurrUrl('/dp' + item); | |
else if (currPath.includes('/gp/product')) | |
setCurrUrl('/gp/product' + item); | |
else if (currSearch) | |
cleanCurrParams(amazonParams);; | |
cleanLinks(parserAmazon); | |
onhashchange = deleteHash; | |
return; | |
} | |
if (currHost=='twitter.com') { | |
cleanLinks(parserTwitter); | |
return; | |
} | |
if(currHost=='www.facebook.com') { | |
cleanLinks(parserFacebook); | |
return; | |
} | |
if (currHost=='disqus.com') { | |
cleanLinks(parserDisqus); | |
return; | |
} | |
/* | |
* Boilerplate functions | |
*/ | |
function setCurrUrl(url) { | |
history.replaceState(null, null, url); | |
} | |
function cleanCurrParams(params) { | |
let search = location.search.replace('?','?&').replace(params,'').replace('&','').replace(/\?$/,''); | |
if (search.length<2) | |
setCurrUrl(location.pathname); | |
else | |
setCurrUrl(search); | |
} | |
function deleteHash() { | |
history.replaceState(null, null, ' '); | |
} | |
function observe(func) { | |
new MutationObserver(func).observe(document, {childList:true, subtree:true}); | |
} | |
// Clean links once, mark as cleaned, then ignore them | |
function cleanLinks(linkParser) { | |
observe(function() { | |
for (let a of document.links) { | |
if (a.cleaned) | |
continue; | |
if (a.protocol && a.protocol.startsWith('http')) | |
linkParser(a); | |
a.cleaned = 1; | |
} | |
}); | |
} | |
// Always clean links | |
function cleanLinksAlways(linkParser) { | |
observe(function() { | |
for (let a of document.links) | |
if (a.protocol && a.protocol.startsWith('http')) | |
linkParser(a); | |
}); | |
} | |
function googleInstant(url) { | |
let parts = url.split('#'); | |
if (parts.length !== 2) | |
return url; | |
let hash = parts[1]; | |
if (hash === 'imgrc=_') | |
return ' '; | |
if (/(^|&)q=/.test(hash)) | |
return '?' + hash; | |
return '#' + hash; | |
} | |
// Intercept & modify url passed into history.replaceState/pushState | |
function changeState(mod) { | |
history.realPushState = history.pushState; | |
history.realReplaceState = history.replaceState; | |
history.pushState = function() { | |
history.realPushState(null, null, mod(arguments[2])); | |
}; | |
history.replaceState = function() { | |
history.realReplaceState(null, null, mod(arguments[2])); | |
}; | |
} | |
/* | |
* Link parsing functions | |
*/ | |
function parserAll(a) { | |
let host = a.host; | |
let path = a.pathname; | |
if (google.test(host)) { | |
if (path === '/imgres' || path === '/url') | |
cleanRedir(a,genericRedir1); | |
else | |
cleanParams(a,googleParams); | |
return; | |
} | |
if (host === 'www.youtube.com') { | |
if (path === '/watch') | |
cleanParams(a,youtubeParams); | |
else if (path === '/redirect') | |
cleanRedir(a,youtubeRedir); | |
} | |
if (a.host.endsWith('.bing.com')) | |
cleanParams(a,bingParams); | |
parserAmazon(a); | |
parserEbay(a); | |
parserIMDB(a); | |
cleanParams(a,utmParams); | |
} | |
function parserGoogle(a) { | |
a.removeAttribute('onmousedown'); | |
parserAll(a); | |
} | |
function parserGoogleImages(a) { | |
let jsaction = a.getAttribute('jsaction'); | |
if (jsaction && jsaction.includes('down:irc.rl')) | |
a.removeAttribute('jsaction'); | |
a.removeAttribute('onmousedown'); | |
parserAll(a); | |
} | |
function parserYoutube(a) { | |
parserAll(a); | |
let text = a.innerText; | |
let href = a.href; | |
if (text === href || text.endsWith('...') && href.startsWith(text.slice(0,-3))) | |
a.innerText = href; | |
} | |
function parserAmazon(a) { | |
if (amazonAd.test(a.host)) | |
a.href = 'https:' + a.pathname.split('/https:').pop() + a.search; | |
if (!amazon.test(a.host)) | |
return; | |
if (a.pathname.includes('/picassoRedirect')) | |
cleanRedir(a,genericRedir1); | |
if (a.pathname.includes('/dp/')) { | |
a.pathname = '/dp' + a.pathname.match(/\/[A-Z\d]{10}(?=\/|$)/); | |
a.search = ''; | |
} | |
else if (a.pathname.includes('/gp/product')) { | |
a.pathname = '/gp/product' + a.pathname.match(/\/[A-Z\d]{10}(?=\/|$)/); | |
a.search = ''; | |
} | |
else if (a.pathname.includes('/ref=')) | |
a.pathname = a.pathname.replace(/\/ref=[^\/]+/,''); | |
cleanParams(a,amazonParams); | |
} | |
function parserEbay(a) { | |
if (!ebay.test(a.host)) | |
return; | |
if (a.pathname.includes('/itm/')) { | |
a.pathname = '/itm' + a.pathname.match(/\/\d{12}/); | |
a.search = ''; | |
} | |
else if (a.pathname.startsWith('/p/') && a.search.includes('iid=')) { | |
a.pathname = '/itm/' + a.search.match(/[?&]iid=(\d{12})/).pop(); | |
a.search = ''; | |
} | |
else if (a.host.startsWith('pulsar.')) { | |
a.pathname = '/itm/' + a.search.match(/%7B%22mecs%22%3A%22(\d{12})/).pop(); | |
a.host = location.host; | |
a.search = ''; | |
} | |
cleanParams(a,ebayParams); | |
a.removeAttribute('data-navsrc-tracking'); | |
if (a.hash && a.pathname===location.pathname) | |
a.href = a.hash; | |
} | |
function parserIMDB(a) { | |
if (a.host === 'www.imdb.com') | |
cleanParams(a,imdbParams); | |
} | |
function parserTwitter(a) { | |
if (a.host !== 't.co') | |
return; | |
let fake = 't.co' + a.pathname; | |
let real = a.getAttribute('data-expanded-url'); | |
if (real) { | |
a.href = real; | |
a.removeAttribute('data-expanded-url'); | |
sessionStorage.setItem(fake, real); | |
return; | |
} | |
if (!a.classList.contains('TwitterCard-container')) | |
return; | |
real = sessionStorage.getItem(fake); | |
if (real) | |
a.href = real; | |
} | |
function parserFacebook(a) { | |
let onclick = a.getAttribute('onclick'); | |
if (!onclick || !onclick.startsWith('LinkshimAsyncLink')) | |
return; | |
if (a.host !== 'l.facebook.com') | |
return; | |
cleanRedir(a,genericRedir1); | |
a.removeAttribute('onclick'); | |
a.removeAttribute('onmouseover'); | |
} | |
function parserDisqus(a) { | |
if (a.host === 'disq.us' && a.pathname === '/url') | |
cleanRedir(a,genericRedir1); | |
parserAll(a); | |
} | |
/* | |
* URL string functions | |
*/ | |
function cleanRedir(a, param) { | |
a.href = decodeURIComponent(a.search.match(param).pop()); | |
} | |
function cleanParams(a, params) { | |
if (a.search) | |
a.search = a.search.replace('?','?&').replace(params,'').replace('&','').replace(/\?$/,''); | |
if (a.hash) | |
a.hash = a.hash.replace('#','#&').replace(params,'').replace('&','').replace(/#$/,''); | |
} |
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
! Title: Remove "People also search for" from Google SERP | |
! Last modified: 14 Sep 2019 | |
! Expires: 60 days (update frequency) | |
! Homepage: https://gist.github.com/aluxian/090326a5cdc2af46620a9e4f81b62830 | |
! Source: https://gist.githubusercontent.com/aluxian/090326a5cdc2af46620a9e4f81b62830/raw/google_serp.filter.txt | |
! Licence: https://opensource.org/licenses/MIT | |
||google.com##.AUiS2 | |
||google.com##.exp-outline | |
||google.co.uk##.AUiS2 | |
||google.co.uk##.exp-outline | |
www.google.*##div[jscontroller]:if(h4:has-text(People also search for)) |
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
! Title: Hide LinkedIn Ads | |
! Last modified: 19 Sep 2019 | |
! Expires: 20 days (update frequency) | |
! Homepage: https://gist.github.com/jhult/802e89c64c4b6f27a3a9 | |
! Source: https://gist.githubusercontent.com/aluxian/090326a5cdc2af46620a9e4f81b62830/raw/linkedin.filter.txt | |
! Licence: https://opensource.org/licenses/MIT | |
! Ad Banner | |
linkedin.com##.ad-banner-container | |
! Navigation - Try Premium for Free | |
linkedin.com##.nav-item__try-premium | |
! Homepage T - Like article / Like and comment | |
linkedin.com##LI.member-comment-share | |
linkedin.com##LI.member-like-share | |
linkedin.com##LI.member-like-poncho-post | |
! Homepage Feed - People like you are watching | |
linkedin.com##LI.lyndaCourse-singleton | |
! Homepage Feed - Is now following | |
linkedin.com##LI.member-follow-company | |
! Homepage Feed - People in your network have new connections | |
linkedin.com##LI.many-members-connect-members-rollup | |
! Homepage Feed - Sponsored Updates | |
linkedin.com##LI.linkedin-sponsor | |
! Homepage Feed - Reconnect with your colleagues | |
linkedin.com##OL.promo | |
! Homepage Feed - Influencers / Recommended | |
linkedin.com##LI.people-follow-recommend | |
linkedin.com##LI.people-connect-recommend | |
! Homepage Feed - Now Following | |
linkedin.com##LI.member-people-follow-member | |
linkedin.com##LI.member-follow-channel | |
linkedin.com##LI.member-follow-company-digest | |
! Homepage Feed - Joined group | |
linkedin.com##LI.member-join-group | |
! Homepage Feed - Pulse | |
linkedin.com##LI.linkedin-recommend-pulse | |
! Homepage Feed - Jobs recommended for you | |
linkedin.com##.jymbii-update | |
! Homepage Feed - People You May Know | |
linkedin.com##LI.linkedin-recommend-pymk | |
! Homepage Sidebar - People You May Know | |
linkedin.com##LI#pymk-container | |
linkedin.com##LI.props-container | |
! Homepage Sidebar - You Recently Visited | |
linkedin.com##DIV#recent-activities-widget | |
! Homepage Sidebar - Your LinkedIn Network | |
linkedin.com##DIV#network-stat-widget | |
! Homepage Sidebar - Jobs You May Be Interested In | |
linkedin.com##DIV#jobsForYou | |
! Homepage Sidebar - Companies You May Want To Follow | |
linkedin.com##DIV#companiesForYou | |
! Homepage Sidebar - Groups You May Like | |
linkedin.com##DIV#groupsForYou | |
! Homepage Sidebar - Ads | |
linkedin.com##LI.ad-container | |
linkedin.com##DIV#topTextAd | |
! Homepage Sidebar - Upsell | |
linkedin.com##DIV.wvmp-upsell | |
! Homepage Sidebar - Notify your network? | |
linkedin.com##DIV#edit-notify-network | |
! Homepage Sidebar - Add new skills with these courses | |
linkedin.com##DIV#course-recommendations | |
! View Profile - People also viewed | |
linked.com##DIV#siteflow-widget-next.snug-fit | |
! People You May Know - Hide non-members | |
linkedin.com##DIV#pymk_cards_container LI.card.guest | |
! Sidebar - Footer | |
linkedin.com##DIV#rr-footer | |
linkedin.com##LI.sidebar-footer-container | |
! Sidebar - How You’re Connected - Upgrade | |
linkedin.com##DIV#annotations-2 | |
! Upsell Premium | |
linkedin.com##DIV.upsell | |
linkedin.com##.premium-upsell-link | |
! Upsell Company Insights | |
linkedin.com##DIV#insights-upsell | |
! Jobs - See jobs where you'd be a top applicant | |
linkedin.com##.jymbii-top-applicant-jobs-upsell | |
! Jobs - Get ahead with Premium Career | |
linkedin.com##.jobs-upsell | |
! Let recruiters know that you're open to new opportunities | |
linkedin.com##LI.ic-upsell | |
! Get ahead with Job Seeker Premium | |
linkedin.com##DIV.fast-growing-companies-upsell | |
! Privately tell recruiters you are open to new opportunities | |
! Get ahead with Job Seeker Premium | |
linkedin.com##SECTION.right-rail-upsell | |
linkedin.com##DIV.premium-insights | |
linkedin.com##DIV.feed-shared-promo | |
! See how you compare to the competition | |
linkedin.com##DIV.insights-upsell-premium-button-container | |
! Try Premium for free | |
linkedin.com##DIV.insights-upsell-value-description-container | |
! People You May Know - Invite Your Contacts | |
linkedin.com##LI.pymk-card.promo | |
! Remove further sponsored | |
linkedin.com##[class*='--is-sponsored'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment