! Title: Intentional: LinkedIn (AdGuard) ! Description: Removes LinkedIn'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 ! ===== LinkedIn ===== ! LinkedIn: see site.yaml for the policy and tests.yaml for what each rule must do. ! --- Home feed: the feed root (/feed/, with or without a query) --- ! Redirects send it to Notifications; this is the fallback without redirects. Single posts ! (/feed/update/…) are another path. Links that highlight a post keep the feed so the post shows. [$path=/^\\/feed\\/?(\\?(?!.*highlightedUpdateUrns).*)?$/]www.linkedin.com##main [$path=/^\\/feed\\/?(\\?(?!.*highlightedUpdateUrns).*)?$/]www.linkedin.com##aside ! --- Feed: no further pages load --- ! Lowercase on purpose: patterns match case-insensitively, and uBO reports them lowercased. ||www.linkedin.com/flagship-web/rsc-action/actions/pagination?*sduiid=com.linkedin.sdui.pagers.feed.mainfeed$xmlhttprequest,~third-party ! --- Home nav item: it only leads to the feed --- ! New top bar (Home is a button), then the older one still used on some pages. www.linkedin.com##[data-testid="primary-nav"] li:has(button[aria-label^="Home"]) www.linkedin.com##li.global-nav__primary-item:has(a[href*="/feed/"]) ! --- Side rails: LinkedIn News and "Add to your feed" --- ! Older layout hooks. www.linkedin.com###feed-news-module www.linkedin.com##[data-view-name="feed-news-module"] www.linkedin.com##.feed-follows-module ! Promoted posts beside a public permalink, outside the post and comment thread. www.linkedin.com##.right-rail .promoted-contents-card ! New layout: no stable hook. From the module's heading (a

there), up to the closest ! module of the rail (never past the rail itself). www.linkedin.com#?#aside p:contains(/^\s*(LinkedIn News|Add to your feed)\s*$/):upward(aside [componentkey]) ! --- Side rails: "People you may know" next to profiles --- www.linkedin.com#?#aside :is(h2, h3):contains(/^\s*(People you may know|More profiles for you)/):upward(aside section) ! --- My Network: "People you may know" and other suggestion cards --- ! The page stays (invitations and your network are yours); its suggestion cards are found by ! their "Invite … to connect" and "Follow …" buttons. [$path=/^\\/mynetwork\\/(grow\\/?)?(\\?.*)?$/]www.linkedin.com#?#button[aria-label^="Invite "][aria-label$=" to connect"]:upward(:is(li, [role="listitem"])) [$path=/^\\/mynetwork\\/(grow\\/?)?(\\?.*)?$/]www.linkedin.com#?#button[aria-label^="Follow "]:upward(:is(li, [role="listitem"])) ! --- Promoted: ads in the side rails --- www.linkedin.com##aside div:has(> iframe[title="advertisement"]) www.linkedin.com##section:has(> iframe[data-ad-banner]) ! LinkedIn: redirects to the intentional view www.linkedin.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.linkedin.com":{redirects:[{from:"^/feed/?\\?(?:.*&)?highlightedUpdateUrns=(urn(?::|%3A)li(?::|%3A)[A-Za-z]+(?::|%3A)[0-9]+)",to:"/feed/update/$1/"},{from:"^/feed/?(\\?(?!(?:.*&)?highlightedUpdateUrns=urn(?::|%3A)li(?::|%3A)[A-Za-z]+(?::|%3A)[0-9]).*)?$",to:"/notifications/"}],select:[]}}[location.hostname];y&&E(y,window)})();