! Title: Intentional: Threads (AdGuard) ! Description: Removes Threads'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 ! ===== Threads ===== ! Threads: see site.yaml for the policy and tests.yaml for what each rule must do. ! --- For you feed --- ! Each column has a header whose title links to the column's own page, then a ! sibling holding the column body (role="region"). Hide the body of the column ! titled /for_you, wherever it is shown (home page, or pinned next to others). www.threads.com##div:not([role="region"] *):has(a[href="/for_you"][aria-label]) + div:has(> [role="region"]) ! Threads: redirects to the intentional view www.threads.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.threads.com":{redirects:[{from:"^/(for_you/?)?(\\?.*)?$",to:"/following"}],select:[]}}[location.hostname];y&&E(y,window)})();