Skip to content

Instantly share code, notes, and snippets.

@MohamedElashri
Last active November 26, 2024 08:20
Show Gist options
  • Save MohamedElashri/96efd778bb55847d0459349506658c13 to your computer and use it in GitHub Desktop.
Save MohamedElashri/96efd778bb55847d0459349506658c13 to your computer and use it in GitHub Desktop.
My custom uBlock origin
#ignore top span results
google.*##.g:has(a[href*="thetopsites.com"])
duckduckgo.*##.results > div:has(a[href*="thetopsites.com"])
## Facebook
facebook.com##div[role="feed"] div > span > span > a > span:upward(div[role="feed"] > div:not([data-pagelet*="group" i]))
facebook.com##div[data-pagelet*="FeedUnit"]:has(div:not([class]):not([id]):empty ~ div:not([class]):not([id]) > div:not([class]):not([id]) > div:not([class]):not([id]):first-child:has(span[dir="auto"]:only-child) + div:not([class]):not([id]) + div:not([class]):not([id]) + div:not([class]):not([id]):last-child)
facebook.com##div[data-pagelet="RightRail"] > div:not([data-visualcompletion]) > div > div[class]:has(> div[class] > div[class] div[class] > a[aria-label][href^="https://l.facebook.com/l.php?u="][target="_blank"])
facebook.com##[aria-label*="Marketplace"] object > a[href^="/ads/"] > span:not(:empty):upward(11)
facebook.com##[aria-label*="Marketplace"] object:has(> a[href^="/ads/"] > span:has-text(/^Sponsored$/)):upward(a):upward(3)
! Removes FB's "Related discussions" panel:
facebook.com##div[role=article] span:not(>*):has-text(/^Related discussions$/):upward(span)
! FB - news and group feeds - related discussions - hide the "# related" link/button
facebook.com##div[role=button] > span:not(>*):has-text(/related/i):upward(4)
facebook.com##:xpath(//div[starts-with(@id, 'pagelet') and (.//a[.='Sponsored'])] )
facebook.com###pagelet_ego_pane
facebook.com###pagelet_video_home_watch_list_rhc
facebook.com##.userContentWrapper:if(span:matches-css-after(content: "Suggested post";))
facebook.com###pagelet_marketplace_recently_viewed_rhc
facebook.com###pagelet_ego_contextual_group
facebook.com##div[data-pagelet^="FeedUnit"]:has-text(/Suggested Events|Suggested for you/)
facebook.com##div[data-pagelet="FeedUnit_}"]:has-text(/Suggested Events|Suggested for you/)
facebook.com##[role="feed"] span[id] a[href="#"] :matches-css(display: none):remove()
facebook.com##[role="feed"] span[id] a[href="#"] :matches-css(position: absolute):remove()
facebook.com##[role="feed"]>div:has-text(Sponsored)
facebook.com##[role="feed"]>div:has-text(Shop)
! FB Sponsored posts - language-neutral solution / TEST version (dot selection) / Remove the `:style()` ending if no false positives found.
facebook.com##[role="feed"] span[id] a[href="#"]:not(:has-text(/(\s|\d|^$)/)):upward([role="feed"]>div):style(border: 8px dotted yellow !important)
! The 2 lines below are supplementary to the one above, but might be needed to make it work:
facebook.com##[role="feed"] span[id] a[href="#"] :matches-css(display: none):remove()
facebook.com##[role="feed"] span[id] a[href="#"] :matches-css(position: absolute):remove()
! The "Paid for by" type of sponsored post:
facebook.com##[role="feed"] span[id]>[role=button]:has-text(/^Sponsored|Paid for by/):upward([role="feed"]>div)
! Probably unnecessary, but you can also try:
facebook.com##[role="feed"] span[id] a[href^="/ads/about/"]:upward([role="feed"]>div)
## Google
! Google consent, "before you continue"
www.google.*##^script:has-text(consentCookiePayload)
www.google.*##+js(acis, document.cookie, YES+)
google.*##+js(aeld, DOMContentLoaded, CONSENT)
||consent.google.com^
# People also search for
google.*##[id^="eob_"]
#Google login dialogs on various pages
||accounts.google.com/gsi/*$xhr,script,3p
## Reddit
! Hide Reddit 'Top Broadcast Now' & 'Top livestream'
reddit.com##a[href^="/rpan/"] > h3:has-text(/Top (livestream|broadcast)/):upward(7)
! Block downloading. Please report back if does not work or causes issues
||redd.it/*.m3u8^$xhr,domain=reddit.com
||strapi.reddit.com^$xhr,domain=reddit.com
## Twitter
! My Timeline - no inserted sections (Who to follow/Topics to follow, etc.)
twitter.com##[aria-label="Timeline: Your Home Timeline"] div[style^="transform: translateY"][style*="position: absolute;"]:not(:first-child:has-text(/^Show \d\d? Tweets?$/)):not(:has(>div:only-child:empty, article, [href^="/i/status/"], [role="progressbar"]))
! Other Timelines - no inserted sections (Who to follow/Topics to follow, etc.)
twitter.com##[aria-label$="’s Tweets"] div[style^="transform: translateY"][style*="position: absolute;"]:not(:has(>div:only-child:empty, article, [href^="/i/status/"], [role="progressbar"]))
! [User] liked
twitter.com##article :not([role="button"]>div>div>svg>g>path)[d$="13.157H12z"]:upward(article)
! [User] Retweeted
twitter.com##:is([aria-label="Timeline: Your Home Timeline"], [aria-label$="’s Tweets"]) article [d^="M23.615 15.477c"]:upward(article)
! [User] received a reply
twitter.com##article [d$="43-7.787-7.8-7.788z"]:upward([style*="position: absolute"]):has([data-testid="socialContext"]:has-text(/reply$/))
twitter.com##article [d$="43-7.787-7.8-7.788z"]:upward([style*="position: absolute"]):has([data-testid="socialContext"]:has-text(/reply$/))+div
! [User] received replies
twitter.com##article [d$="43-7.787-7.8-7.788z"]:upward([style*="position: absolute"]):has([data-testid="socialContext"]:has-text(/replies$/))
twitter.com##article>div:first-child:not(:last-child):upward([style*="position: absolute"])
! [User] replied
twitter.com##article [d$="43-7.787-7.8-7.788z"]:upward([style*="position: absolute"]):has([data-testid="socialContext"]:has-text(/replied$/))
twitter.com##article [d$="43-7.787-7.8-7.788z"]:upward([style*="position: absolute"]):has([data-testid="socialContext"]:has-text(/replied$/))+div
! Follow/Recommended Topic | "[Name of Topic] See more"
twitter.com##article [aria-label^="Follow Topic"], [aria-label^="Recommended Topic" i]:upward(article)
! Like and Retweet counts | Remove ` [data-testid="app-text-transition-container"]` to hide entire buttons
twitter.com##[data-testid="retweet"] [data-testid="app-text-transition-container"], [data-testid="like"] [data-testid="app-text-transition-container"]
! [User] follows
twitter.com##article [d^="M12.225 12.165c-1.356"]:upward(article)
! More Tweets
twitter.com##[aria-label="Timeline: Conversation"] h2>div>span:has-text(/^More Tweets$/):upward([style^="transform"])
twitter.com##[aria-label="Timeline: Conversation"] h2>div>span:has-text(/^More Tweets$/):upward([style^="transform"])~div
! Sidebar - Topics to follow
twitter.com##[data-testid="sidebarColumn"] [href="/i/topics/picker/home"]:upward(section)
! Sidebar - Trending now/Trends for you
twitter.com##[aria-label$="trending now" i]
! Sidebar - Who to follow/You might like
twitter.com##[aria-label="who to follow" i]:upward(1)
## YouTube
! YT consent
youtube.com##+js(set, ytInitialData.topbar.desktopTopbarRenderer.interstitial.consentBumpRenderer.forceConsent, false)
youtube.com##+js(json-prune, [].response.topbar.desktopTopbarRenderer.interstitial.consentBumpRenderer)
youtube.com##+js(json-prune, topbar.desktopTopbarRenderer.interstitial.consentBumpRenderer)
youtube.com##+js(set, ytInitialData.onResponseReceivedEndpoints, undefined)
! YT consent v2
youtube.com##+js(set, ytInitialData.topbar.desktopTopbarRenderer.interstitial.consentBumpV2Renderer, undefined)
youtube.com##+js(json-prune, [].response.overlay.consentBumpV2Renderer topbar.desktopTopbarRenderer.interstitial.consentBumpV2Renderer overlay.consentBumpV2Renderer response.overlay.consentBumpV2Renderer)
! YT login
!These filters may cause issues (page does not load, only placeholders visible, ...). BlockTube can break execute property !json-prune.
youtube.com##+js(set, ytInitialPlayerResponse.auxiliaryUi.messageRenderers.upsellDialogRenderer.isVisible, false)
youtube.com##+js(set, ytInitialData.overlay.upsellDialogRenderer.isVisible, false)
youtube.com##+js(json-prune, [].playerResponse.auxiliaryUi.messageRenderers.upsellDialogRenderer)
! Removes Mixes from the Main Page
youtube.com##ytd-rich-item-renderer #video-title-link[title*="Mix"][href$="start_radio=1"]:upward(ytd-rich-item-renderer)
! Removes Mixes from the right side panel
youtube.com##ytd-compact-radio-renderer
! Removes Mixes from search results
youtube.com##ytd-radio-renderer
! Removes "YouTube" (Music) playlists from the right side panel
youtube.com##ytd-compact-playlist-renderer .ytd-channel-name:has-text(/^YouTube/):upward(ytd-compact-playlist-renderer)
! Suggested channels by name
youtube.com##ytd-rich-item-renderer:has(#byline-container:has-text(/BBC|CNN|FOX|NBC/))
!Recommend after pause
youtube-nocookie.com,youtube.com##.ytp-pause-overlay, .show-video-thumbnail-button
~youtube-nocookie.com,~youtube.com##iframe ~ #topvbar > #rvid
! People also search/watched (on YT search page)
! YT Search - just videos
youtube.com##ytd-search ytd-item-section-renderer>#contents>:not(ytd-video-renderer),ytd-secondary-search-container-renderer
! YT Search - just videos + channels
youtube.com##ytd-search ytd-item-section-renderer>#contents>:not(ytd-video-renderer,ytd-channel-renderer),ytd-secondary-search-container-renderer
!YT Home Ad placeholder
youtube.com##ytd-rich-grid-row:style(--ytd-rich-grid-items-per-row: 1 !important;)
youtube.com##ytd-rich-grid-row>#contents, ytd-rich-grid-row ytd-rich-grid-media:style(max-width: unset !important;)
! General Web Browsing Filters
#%#AG_onLoad(function(){(document.querySelector("[name='apple-itunes-app']") || {remove: () => 0}).remove()});
! Funimation
funimation.com##.v-dialog__content
funimation.com##div[class="smartbanner smartbanner--ios js_smartbanner"]
! Google
google.*###stUuGf
google.*##[data-it="rq"]
google.*##[id^="eob_"]
! Imgur
m.imgur.com###app > div.App > div.App-topSidebar:nth-child(2) > div:first-child
m.imgur.com###app > div.App > div.GalleryHandler:last-child > div.FloatingOIA-container:nth-child(3)
m.imgur.com###app > div.App > div.GalleryHandler:last-child > div.FooterOIA-container.sg_hide_element:nth-child(3)
m.imgur.com###app > div.App > div.GalleryHandler:last-child > div.SeeImgurOIA-container.SeeImgurOIA-container-visible:nth-child(4)
m.imgur.com###app > div.App > div.GalleryHandler:last-child > div.SeeImgurOIA-overlay.SeeImgurOIA-overlay-visible:nth-child(3)
m.imgur.com##.GalleryInfiniteScroll > div > .GalleryHandler-postContainer + div
m.imgur.com##.GalleryInfiniteScroll > div > div:not([class])
! Reddit
reddit.com###blocking-modal-blur-container:style(filter: none !important;)
reddit.com###container > div.app > div.appmainpage:first-child > div.navframe:nth-child(3) > div > div.navframe__below-top-nav.m-tall > div > div.subredditaboutpage > div.communityheader:first-child > div.communityheader-text-row.m-top-margin:nth-child(4) > ul.topiclist
reddit.com###container > div.app > div.appmainpage:first-child > div.navframe:nth-child(3) > div > div.navframe__below-top-nav.m-tall > div:first-child > div.postsfromsubredditpage > div.communityheader:first-child > div.communityheader-text-row.m-top-margin:nth-child(4) > ul.topiclist
reddit.com##._13GEaJc1u3mPvCCGhfLQG4
reddit.com##.communityheader-subscribe-button
reddit.com##.getappfooter
reddit.com##.joinbuttonfull
reddit.com##.lb-footer
reddit.com##.lb-header
reddit.com##.m-blurred:style(filter: none !important;)
reddit.com##.navframe:style(overflow: scroll !important;)
reddit.com##.postfooter__share
reddit.com##.previewdrawer
reddit.com##.scroll-disabled:style(overflow: scroll !important; position: static !important;)
reddit.com##.scroll-is-blocked:style(overflow: scroll !important;)
reddit.com##.topics-links-block
reddit.com##.topnav__promobutton
reddit.com##.topposts
reddit.com##.xpromoappstorefooter
reddit.com##.xpromoblockingmodal
reddit.com##.xpromochoicebanner
reddit.com##.xpromoinfeed
reddit.com##.xpromonsfwblocking__warning
reddit.com##.xpromonsfwblockingmodal
reddit.com##.xpromopill
reddit.com##.xpromopopup
reddit.com##[data-testid="bottom-cell-wrapper"]
reddit.com##article[style*="z-index: 1;"]
reddit.com##button[class="action last"]
reddit.com##shreddit-comments-page-ad
reddit.com##shreddit-experience-tree
reddit.com##shreddit-post[view-context="ListingBelowLinkedPosts"]
reddit.com##shreddit-post[view-context="ListingBelowSubredditPosts"]
reddit.com##shreddit-rereddit-promo
reddit.com##xpromo-footer
reddit.com##xpromo-nsfw-blocking-container
reddit.com##xpromo-nsfw-blocking-modal
reddit.com##xpromo-untagged-content-blocking-modal
@tacorporation
Copy link

Role=article means

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment