! Title: Intentional: Reddit (AdGuard) ! Description: Removes Reddit's algorithmic feeds and infinite scrolling, so you only see what you came for. ! Homepage: https://aymericbeaumet.github.io/intentional/ ! License: MIT ! Version: 0.2.0 ! Expires: 1 day ! Redirects need this list to be added as Trusted ! ===== Reddit ===== ! Reddit: see site.yaml for the policy and tests.yaml for what each rule must do. ! --- r/popular, r/all, Explore, News: their feeds --- ! Redirects send these pages to Home; this is the fallback without redirects. ! The logged-out front page is r/popular too (pagetype="popular"). www.reddit.com##shreddit-app[pagetype="popular"] #main-content www.reddit.com##shreddit-app[pagetype="all"] #main-content www.reddit.com##shreddit-app[pagetype="explore"] #main-content www.reddit.com##shreddit-app[pagetype="news"] #main-content ! --- Entry points to those feeds --- ! The left menu draws Popular and Explore in its shadow root, switched on by these attributes. www.reddit.com#%#//scriptlet('ubo-remove-attr', 'popular|explore|news', 'left-nav-top-section, asap stay') ! Sidebar and footer links. www.reddit.com##faceplate-tracker:is([noun="popular_menu"], [noun="explore_menu"], [noun="news_menu"]) ! Old Reddit's top bar. old.reddit.com##.sr-bar > li:has(> a[href$="/r/popular/"]) old.reddit.com##.sr-bar > li:has(> a[href$="/r/all/"]) ! --- Feeds: posts Reddit recommends instead of what you joined --- ! Recommended posts name why they were picked in recommendation-source. www.reddit.com##shreddit-feed > article:has(> shreddit-post[recommendation-source]:not([recommendation-source=""])) ! In Home, a Join button means the post comes from a community you haven't joined. www.reddit.com##shreddit-feed[reload-url*="home-feed"] > article:has(shreddit-join-button) ! --- Suggested communities --- www.reddit.com##in-feed-community-recommendations www.reddit.com##aside.right-rail-popular-communities ! --- Next to a post: related posts, "People also ask about", video end screens --- www.reddit.com##aside:has(> pdp-right-rail) www.reddit.com###mosaic-pdp-feed [id$="_related"]:has(reddit-pdp-right-rail-post) www.reddit.com###answers-suggested-queries-pdp www.reddit.com##shreddit-player [slot="recommendation-overlay"] ! --- Search box: trending searches and trending communities --- ! They render in the search box's shadow root, so block the request that loads them: ! the typeahead with an empty query. Typing still gets suggestions. ||www.reddit.com/svc/shreddit/search-typeahead?query=&$xmlhttprequest,~third-party ! Reddit: redirects to the intentional view www.reddit.com#%#(function(){function g(a,t){for(const f of t){const p=new RegExp(f.from).exec(a);if(!p)continue;const i=f.to.replace(/\$(\d)/g,(h,s)=>p[Number(s)]??"");return i===a?null:i}return null}function v(a,t){const f=a&&new RegExp(a.path),p=e=>{const n=t.document;if(f?.test(t.location.pathname)){const u=a?.viewer;if(!u||u==="*")return n.body;const l=e.closest(u)||Array.from(n.querySelectorAll(u)).find(b=>b.getClientRects().length>0);if(l)return l}if(n.fullscreenElement?.querySelector("video"))return n.fullscreenElement;let o=!1,c=e===n.body||e===n.documentElement?n.elementFromPoint(t.innerWidth/2,t.innerHeight/2):e;for(;c;c=c.parentElement){const u=t.getComputedStyle(c);if(o&&/^(y|block) (mandatory|proximity)$/.test(u.scrollSnapType)&&c.scrollHeight>c.clientHeight)return c;!o&&u.scrollSnapAlign!=="none"&&(c.matches("video")||c.querySelector("video"))&&(o=!0)}return null},i={capture:!0,passive:!1},h=e=>{const n=e.target,o=n instanceof t.Element?n:t.document.body;if(!o)return;const c=p(o),u=c?.querySelector("video")??(c&&c!==t.document.body?c.querySelector("img"):null);if(!c||!u||o.closest('input, textarea, select, [contenteditable]:not([contenteditable="false"]), [role="slider"]'))return;let l=o;for(;l&&l!==t.document.body;l=l.parentElement)if(l.scrollHeight>l.clientHeight&&/^(auto|scroll)$/.test(t.getComputedStyle(l).overflowY)&&!l.contains(u)){l instanceof t.HTMLElement&&t.getComputedStyle(l).overscrollBehaviorY==="auto"&&(l.style.overscrollBehaviorY="contain"),e.stopImmediatePropagation();return}!c.contains(o)&&o!==t.document.body&&o!==t.document.documentElement||(e.preventDefault(),e.stopImmediatePropagation())};t.addEventListener("wheel",e=>{!e.ctrlKey&&Math.abs(e.deltaY)>Math.abs(e.deltaX)&&h(e)},i),t.addEventListener("keydown",e=>{!e.ctrlKey&&!e.metaKey&&!e.altKey&&["ArrowUp","ArrowDown","PageUp","PageDown"].includes(e.key)&&h(e)},i);let s;t.addEventListener("touchstart",e=>{const n=e.touches[0];s=n&&e.touches.length===1?{x:n.clientX,y:n.clientY}:void 0},{capture:!0,passive:!0});const m=e=>{const n=e.changedTouches[0];if(s&&n&&e.touches.length<=1){const o=Math.abs(n.clientY-s.y);o>8&&o>Math.abs(n.clientX-s.x)&&h(e)}e.type==="touchend"&&(s=void 0)};t.addEventListener("touchmove",m,i),t.addEventListener("touchend",m,i),t.addEventListener("touchcancel",()=>{s=void 0},!0);let r;t.addEventListener("pointerdown",e=>{r=e.pointerType==="touch"&&e.isPrimary?{id:e.pointerId,x:e.clientX,y:e.clientY}:void 0},!0);const d=e=>{if(!r||r.id!==e.pointerId)return;const n=Math.abs(e.clientY-r.y);n>8&&n>Math.abs(e.clientX-r.x)&&h(e),e.type==="pointerup"&&(r=void 0)};t.addEventListener("pointermove",d,i),t.addEventListener("pointerup",d,i),t.addEventListener("pointercancel",()=>{r=void 0},!0)}function E(a,t){v(a.singleVideo,t);const f=t.document;let p=0,i=!1;const h=()=>{try{const r="intentional:redirects",d=Date.now(),e=JSON.parse(t.sessionStorage.getItem(r)||"[]").filter(n=>d-n<1e4);if(e.length>=3)return!1;e.push(d),t.sessionStorage.setItem(r,JSON.stringify(e))}catch{}return!0},s=()=>{i=!1;const r=t.location.pathname+t.location.search,d=g(r,a.redirects);if(d!==null){h()&&t.location.replace(d);return}for(const e of a.select){if(!new RegExp(e.when).test(r)||f.querySelector(e.selected))continue;const n=f.querySelector(e.click),o=Date.now();n instanceof t.HTMLElement&&o-p>1e3&&(p=o,n.click())}},m=()=>{i||(i=!0,t.setTimeout(s,50))};for(const r of["pushState","replaceState"]){const d=t.history[r];t.history[r]=function(...e){const n=d.apply(this,e);return s(),n}}t.addEventListener("popstate",s),a.select.length>0&&new t.MutationObserver(m).observe(f,{childList:!0,subtree:!0}),t.setInterval(s,1e3),s()}var y={"www.reddit.com":{redirects:[{from:"^/r/([Pp]opular|[Aa]ll)(/|\\?|$)",to:"/"},{from:"^/(explore|news)(/|\\?|$)",to:"/"}],select:[]}}[location.hostname];y&&E(y,window)})();