diff --git a/dist/assets/ModalDisplay.js b/dist/assets/ModalDisplay.js index 6b1f33e..7a9d8ff 100644 --- a/dist/assets/ModalDisplay.js +++ b/dist/assets/ModalDisplay.js @@ -1 +1 @@ -import{r as l,j as e,e as t,t as a,f as i,p as h,h as x}from"./index.js";const m=()=>{const[n,c]=l.useState(!1),[d,o]=l.useState(!1);l.useEffect(()=>{(async()=>{try{const s=await h();c(s),o(s)}catch(s){console.error("Error fetching switch data:",s)}})()},[]);const r=()=>{x(),o(!1)};return n&&e.jsxs(t,{closeButton:!0,blur:!0,"aria-labelledby":"modal-title",open:d,onClose:r,className:"max-h-[330px]",children:[e.jsxs(t.Header,{className:"absolute flex flex-col items-start top-0",children:[e.jsx(a,{className:"font-semibold",size:16,children:"What's New In 1.6.11"}),e.jsx(a,{className:"text-[12px]",children:"June 13, 2023"})]}),e.jsxs(t.Body,{className:"mt-[50px]",children:[e.jsx(a,{className:"added mb-4",children:"Support On Discord"}),e.jsxs(a,{className:"text-[13px] mb-2",children:["HYS now has a Discord server for support, suggestions, and feedback. You can join via the settings menu or by ",e.jsx("a",{href:"https://discord.gg/HAFP4P7Dfr",target:"_blank",children:"clicking here"})]})]}),e.jsx(t.Footer,{children:e.jsx(i,{flat:!0,color:"none",className:"w-full",onPress:r,children:"Close"})})]})};export{m as default}; +import{r as l,j as e,e as t,t as a,f as i,p as h,h as x}from"./index.js";const m=()=>{const[n,c]=l.useState(!1),[d,o]=l.useState(!1);l.useEffect(()=>{(async()=>{try{const s=await h();c(s),o(s)}catch(s){console.error("Error fetching switch data:",s)}})()},[]);const r=()=>{x(),o(!1)};return n&&e.jsxs(t,{closeButton:!0,blur:!0,"aria-labelledby":"modal-title",open:d,onClose:r,className:"max-h-[330px]",children:[e.jsxs(t.Header,{className:"absolute flex flex-col items-start top-0",children:[e.jsx(a,{className:"font-semibold",size:16,children:"What's New In 1.6.12"}),e.jsx(a,{className:"text-[12px]",children:"June 13, 2023"})]}),e.jsxs(t.Body,{className:"mt-[50px]",children:[e.jsx(a,{className:"added mb-4",children:"Support On Discord"}),e.jsxs(a,{className:"text-[13px] mb-2",children:["HYS now has a Discord server for support, suggestions, and feedback. You can join via the settings menu or by ",e.jsx("a",{href:"https://discord.gg/HAFP4P7Dfr",target:"_blank",children:"clicking here"})]})]}),e.jsx(t.Footer,{children:e.jsx(i,{flat:!0,color:"none",className:"w-full",onPress:r,children:"Close"})})]})};export{m as default}; diff --git a/dist/assets/main.js b/dist/assets/main.js index c031e60..120d098 100644 --- a/dist/assets/main.js +++ b/dist/assets/main.js @@ -1 +1 @@ -let m=!1,F=!1;function d(){location.href==="https://www.youtube.com/feed/subscriptions"?document.readyState==="complete"?(m=!0,setTimeout(()=>{const o=document.querySelector("#contents");getComputedStyle(o).width==="90%"&&m&&F?location.reload():setTimeout(d,1e3)},1e3)):setTimeout(d,1e3):(m&&location.href!=="https://www.youtube.com/"&&(F=!0),setTimeout(d,1e3))}d();function v(){return chrome.runtime.id?chrome.storage.sync.get(["toggleState","toggleNavState","toggleHomeFeedState","toggleHomeFeedStateLives","toggleHomeFeedStatePremieres","toggleSubscriptionFeedState","toggleSubscriptionFeedStateLives","toggleSubscriptionFeedStatePremieres","toggleTrendingFeedState","toggleSearchState","toggleRecommendedState","toggleTabState","toggleHomeTabState","toggleTurboState","toggleRegularState","toggleNotificationState"]):location.reload()}async function u(){if(!chrome.runtime.id)return;const o=await v();if(!o.toggleState)return;const r=location.href.includes("https://m.youtube.com/");o.toggleNavState&&C(r),o.toggleHomeFeedState&&(H(r),P(r)),o.toggleHomeFeedStateLives&&G(r),o.toggleHomeFeedStatePremieres&&V(r),o.toggleSubscriptionFeedState&&x(r),o.toggleSubscriptionFeedStateLives&&D(r),o.toggleSubscriptionFeedStatePremieres&&O(r),o.toggleTrendingFeedState&&I(r),o.toggleSearchState&&M(r),o.toggleRecommendedState&&k(r),o.toggleTabState&&B(r),o.toggleHomeTabState&&j(r),o.toggleRegularState&&z(),o.toggleNotificationState&&Y(r)}let g=0,p=0,N=0,l=0,f=0,h=0,S=0,b=0,E=0,w=0;function C(o){if(o)document.querySelectorAll(".pivot-shorts").forEach(n=>{const e=n.parentNode;e.style.display="none"});else if(document.querySelector('#endpoint[title="Shorts"]')){document.querySelectorAll('#endpoint[title="Shorts"]').forEach(e=>{const t=e.parentNode;t.parentNode.removeChild(t),g++}),i("navButton",g),g=0;return}else setTimeout(function(){C(o)},1e3)}function H(o){o?location.href==="https://m.youtube.com/"&&document.querySelectorAll(".reel-shelf-items").forEach(n=>{const e=n.parentNode.parentNode.parentNode;e.style.display="none"}):location.href==="https://www.youtube.com/"&&(document.querySelectorAll(".style-scope ytd-rich-shelf-renderer").forEach(e=>{const t=e.parentNode;t.parentNode.removeChild(t),p++}),document.querySelectorAll(".style-scope ytd-reel-shelf-renderer").forEach(e=>{const t=e.parentNode;t.parentNode.removeChild(t),p++}),i("shortsShelf",p),p=0)}function P(o){o?location.href==="https://m.youtube.com/"&&document.querySelectorAll('[href^="/shorts/"]').forEach(n=>{if(n.classList.contains("ytd-notification-renderer"))return;const e=n.parentNode.parentNode.parentNode;e.style.display="none"}):location.href==="https://www.youtube.com/"&&(document.querySelectorAll('[href^="/shorts/"]').forEach(n=>{if(n.classList.contains("ytd-notification-renderer"))return;const e=n.parentNode,t=e.parentNode.parentNode;e.hasAttribute("rich-grid-thumbnail")&&t.style.display!=="none"&&N++,e.hasAttribute("rich-grid-thumbnail")&&(t.style.display="none")}),i("homeFeedShorts",N),N=0)}function G(o){o||location.href==="https://www.youtube.com/"&&document.querySelectorAll("ytd-badge-supported-renderer").forEach(n=>{if(n.innerText.replace(/\s/g,"").replace(/\n/g,"")==="LIVE"){const e=n.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;(e.classList.contains("ytd-rich-grid-row")||e.classList.contains("ytd-rich-item-renderer"))&&(e.style.display="none")}})}function V(o){o||location.href==="https://www.youtube.com/"&&document.querySelectorAll("ytd-badge-supported-renderer").forEach(n=>{if(n.innerText.replace(/\s/g,"").replace(/\n/g,"")==="PREMIERE"){const e=n.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;(e.classList.contains("ytd-rich-grid-row")||e.classList.contains("ytd-rich-item-renderer"))&&(e.style.display="none")}})}function x(o){o?location.href.includes("youtube.com/feed/subscriptions")&&document.querySelectorAll('[href^="/shorts/"]').forEach(n=>{if(n.classList.contains("ytd-notification-renderer"))return;const e=n.parentNode.parentNode.parentNode;e.style.display="none"}):location.href.includes("youtube.com/feed/subscriptions")&&(document.querySelectorAll('[href^="/shorts/"]').forEach(n=>{if(n.classList.contains("ytd-notification-renderer"))return;const e=n.parentNode.parentNode.parentNode,t=e.parentNode.parentNode,s=e.parentNode.parentNode.parentNode.parentNode.parentNode;t.style.display!=="none"&&l++,(t.classList.contains("ytd-rich-grid-row")||t.classList.contains("ytd-rich-item-renderer"))&&t.style.display!=="none"&&(t.style.display="none"),!(t.classList.contains("ytd-rich-grid-row")||t.classList.contains("ytd-rich-item-renderer"))&&((t.nodeName==="YTD-GRID-VIDEO-RENDERER"||t.classList.contains("ytd-shelf-renderer"))&&(e.style.display!=="none"&&l++,e.style.display="none"),s.nodeName==="YTD-EXPANDED-SHELF-CONTENTS-RENDERER"&&(e.style.display!=="none"&&l++,s.parentNode.parentNode.style.display="none"))}),i("subFeedShorts",l),l=0)}function D(o){o||location.href.includes("youtube.com/feed/subscriptions")&&document.querySelectorAll("ytd-badge-supported-renderer").forEach(n=>{if(n.innerText.replace(/\s/g,"").replace(/\n/g,"")==="LIVE"){const e=n.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode,t=n.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;(e.classList.contains("ytd-rich-grid-row")||e.classList.contains("ytd-rich-item-renderer"))&&(e.style.display="none"),t.classList.contains("ytd-shelf-renderer")&&(t.style.display="none")}})}function O(o){o||location.href.includes("youtube.com/feed/subscriptions")&&document.querySelectorAll("ytd-badge-supported-renderer").forEach(n=>{if(n.innerText.replace(/\s/g,"").replace(/\n/g,"")==="PREMIERE"){const e=n.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode,t=n.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;(e.classList.contains("ytd-rich-grid-row")||e.classList.contains("ytd-rich-item-renderer"))&&(e.style.display="none"),t.classList.contains("ytd-shelf-renderer")&&(t.style.display="none")}})}function I(o){o?(location.href.includes("youtube.com/feed/explore")||location.href.includes("youtube.com/gaming"))&&(document.querySelectorAll('[href^="/shorts/"]').forEach(e=>{const t=e.parentNode.parentNode.parentNode;t.style.display="none"}),document.querySelectorAll(".reel-shelf-items").forEach(e=>{const t=e.parentNode.parentNode.parentNode;t.style.display="none"})):(location.href.includes("youtube.com/feed/trending")||location.href.includes("youtube.com/gaming"))&&(document.querySelectorAll('[href^="/shorts/"]').forEach(e=>{if(e.classList.contains("ytd-notification-renderer"))return;const t=e.parentNode.parentNode.parentNode;t.style.display!=="none"&&f++,t.style.display="none"}),document.querySelectorAll(".style-scope ytd-reel-shelf-renderer").forEach(e=>{const t=e.parentNode;t.parentNode.removeChild(t),f++}),i("trendFeedShorts",f),f=0)}function M(o){if(o){if(!document.querySelector("ytm-search"))return;document.querySelectorAll(".reel-shelf-items").forEach(t=>{const s=t.parentNode;s.style.display="none"}),document.querySelectorAll('[aria-label="Shorts"]').forEach(t=>{if(t.classList.contains("ytd-notification-renderer"))return;const s=t.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;s.style.display="none"})}else{if(!document.querySelector(".style-scope ytd-two-column-search-results-renderer"))return;document.querySelectorAll(".style-scope yt-horizontal-list-renderer").forEach(t=>{const s=t.parentNode.parentNode;s.style.display!=="none"&&h++,s.style.display="none"}),document.querySelectorAll('[href^="/shorts/"]').forEach(t=>{if(t.classList.contains("ytd-notification-renderer"))return;const s=t.parentNode.parentNode.parentNode;s.style.display!=="none"&&h++,s.style.display="none"}),i("searchResultShorts",h),h=0}}function k(o){o?location.href.includes("youtube.com/watch")&&document.querySelectorAll('[href^="/shorts/"]').forEach(n=>{if(n.classList.contains("ytd-notification-renderer"))return;const e=n.parentNode.parentNode;e.style.display="none"}):location.href.includes("youtube.com/watch")&&(document.querySelectorAll('[href^="/shorts/"]').forEach(n=>{if(n.classList.contains("ytd-notification-renderer"))return;const e=n.parentNode.parentNode;e.style.display!=="none"&&S++,e.style.display="none"}),i("recommendedShorts",S),S=0)}function B(o){if(o){const r=document.querySelectorAll(".scbrr-tab.center");Array.from(r).filter(e=>e.innerText.toLowerCase()==="shorts").forEach(e=>{e.parentNode.removeChild(e)})}else{const r=document.querySelectorAll(".tab-content");Array.from(r).filter(e=>e.textContent.replace(/\s/g,"").replace(/\n/g,"")==="Shorts").forEach(e=>{const t=e.parentNode;t.parentNode.removeChild(t),b++}),i("channelTabs",b),b=0}}function Y(o){o||document.querySelectorAll('[href^="/shorts/"]').forEach(n=>{if(n.classList.contains("ytd-notification-renderer")){const e=n.parentNode;e.style.display="none"}})}function j(o){o?(location.href.includes("/channel/")||location.href.includes("@")||location.href.includes("/user/")||location.href.includes("/c/"))&&(document.querySelectorAll(".reel-shelf-items").forEach(e=>{const t=e.parentNode.parentNode.parentNode;t.style.display="none"}),document.querySelectorAll(".scbrr-tab.center").forEach(e=>{e.getAttribute("role")==="tab"&&e.getAttribute("aria-selected")==="true"&&e.innerText.toLowerCase()!=="shorts"&&document.querySelectorAll('[href^="/shorts/"]').forEach(s=>{if(s.classList.contains("ytd-notification-renderer"))return;const a=s.parentNode;a.style.display="none"})})):(location.href.includes("/channel/")||location.href.includes("@")||location.href.includes("/user/")||location.href.includes("/c/"))&&document.querySelectorAll(".ytd-c4-tabbed-header-renderer").forEach(n=>{n.getAttribute("role")==="tab"&&n.getAttribute("aria-selected")==="true"&&n.innerText.toLowerCase()!=="shorts"&&(document.querySelectorAll('[href^="/shorts/"]').forEach(t=>{if(t.classList.contains("ytd-notification-renderer"))return;const s=t.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;s.style.display!=="none"&&E++,s.style.display="none"}),i("channelShorts",E),E=0)})}function z(){function o(r){const n=/\/shorts\/([^/]+)/,e=r.match(n);return e?e[1]:null}o(location.href)&&(location.href=`https://youtube.com/watch?v=${o(location.href)}`,w++,i("playedAsRegular",w),w=0)}async function i(o,r){const n=await chrome.storage.sync.get([o]),e=n[o]?n[o]:0,t=r/2,s=Math.ceil(e+t);chrome.storage.sync.set({[o]:s})}let y,R;async function L(o){const r=await v();if(!r.toggleState)return;const n=document.body;if(n!=null){if(o&&u(),setTimeout(()=>{u()},1500),r.toggleTurboState)R=setInterval(()=>{u()},500);else{let t=function(s,a){let A,c;return function(){const T=this,q=arguments;c?(clearTimeout(A),A=setTimeout(function(){Date.now()-c>=a&&(s.apply(T,q),c=Date.now())},a-(Date.now()-c))):(s.apply(T,q),c=Date.now())}};var e=t;y=new MutationObserver(t(async function(s,a){setTimeout(()=>{u()},1500)},3e3)),y.observe(n,{childList:!0,subtree:!0})}return}else setTimeout(function(){L()},1e3)}window.addEventListener("load",async function(){L()});chrome.runtime.onMessage.addListener(async function(o,r,n){o.checkStates&&(y&&y.disconnect(),clearInterval(R),L(!0))}); +let m=!1,F=!1;function u(){location.href==="https://www.youtube.com/feed/subscriptions"?document.readyState==="complete"?(m=!0,setTimeout(()=>{const o=document.querySelector("#contents");getComputedStyle(o).width==="90%"&&m&&F?location.reload():setTimeout(u,1e3)},1e3)):setTimeout(u,1e3):(m&&location.href!=="https://www.youtube.com/"&&(F=!0),setTimeout(u,1e3))}u();function v(){return chrome.runtime.id?chrome.storage.sync.get(["toggleState","toggleNavState","toggleHomeFeedState","toggleHomeFeedStateLives","toggleHomeFeedStatePremieres","toggleSubscriptionFeedState","toggleSubscriptionFeedStateLives","toggleSubscriptionFeedStatePremieres","toggleTrendingFeedState","toggleSearchState","toggleRecommendedState","toggleTabState","toggleHomeTabState","toggleTurboState","toggleRegularState","toggleNotificationState"]):location.reload()}async function p(){if(!chrome.runtime.id)return;const o=await v();if(!o.toggleState)return;const r=location.href.includes("https://m.youtube.com/");o.toggleNavState&&C(r),o.toggleHomeFeedState&&(P(r),G(r)),o.toggleHomeFeedStateLives&&x(r),o.toggleHomeFeedStatePremieres&&V(r),o.toggleSubscriptionFeedState&&(R(r),D(r)),o.toggleSubscriptionFeedStateLives&&O(r),o.toggleSubscriptionFeedStatePremieres&&I(r),o.toggleTrendingFeedState&&M(r),o.toggleSearchState&&k(r),o.toggleRecommendedState&&B(r),o.toggleTabState&&Y(r),o.toggleHomeTabState&&z(r),o.toggleRegularState&&X(),o.toggleNotificationState&&j(r)}let g=0,a=0,N=0,d=0,f=0,h=0,S=0,b=0,E=0,w=0;function C(o){if(o)document.querySelectorAll(".pivot-shorts").forEach(n=>{const e=n.parentNode;e.style.display="none"});else if(document.querySelector('#endpoint[title="Shorts"]')){document.querySelectorAll('#endpoint[title="Shorts"]').forEach(e=>{const t=e.parentNode;t.parentNode.removeChild(t),g++}),i("navButton",g),g=0;return}else setTimeout(function(){C(o)},1e3)}function P(o){o?location.href==="https://m.youtube.com/"&&document.querySelectorAll(".reel-shelf-items").forEach(n=>{const e=n.parentNode.parentNode.parentNode;e.style.display="none"}):location.href==="https://www.youtube.com/"&&(document.querySelectorAll(".style-scope ytd-rich-shelf-renderer").forEach(e=>{const t=e.parentNode;t.parentNode.removeChild(t),a++}),document.querySelectorAll(".style-scope ytd-reel-shelf-renderer").forEach(e=>{const t=e.parentNode;t.parentNode.removeChild(t),a++}),i("shortsShelf",a),a=0)}function R(o){o?location.href==="https://m.youtube.com/"&&document.querySelectorAll(".reel-shelf-items").forEach(n=>{const e=n.parentNode;e.parentNode.parentNode.style.display="none"}):location.href==="https://www.youtube.com/feed/subscriptions"&&(document.querySelectorAll(".style-scope ytd-rich-shelf-renderer").forEach(e=>{const t=e.parentNode;t.parentNode.removeChild(t),a++}),document.querySelectorAll(".style-scope ytd-reel-shelf-renderer").forEach(e=>{const t=e.parentNode;t.parentNode.removeChild(t),a++}),i("shortsShelf",a),a=0)}function G(o){o?location.href==="https://m.youtube.com/"&&document.querySelectorAll('[href^="/shorts/"]').forEach(n=>{if(n.classList.contains("ytd-notification-renderer"))return;const e=n.parentNode.parentNode.parentNode;e.style.display="none"}):location.href==="https://www.youtube.com/"&&(document.querySelectorAll('[href^="/shorts/"]').forEach(n=>{if(n.classList.contains("ytd-notification-renderer"))return;const e=n.parentNode,t=e.parentNode.parentNode;e.hasAttribute("rich-grid-thumbnail")&&t.style.display!=="none"&&N++,e.hasAttribute("rich-grid-thumbnail")&&(t.style.display="none")}),i("homeFeedShorts",N),N=0)}function x(o){o||location.href==="https://www.youtube.com/"&&document.querySelectorAll("ytd-badge-supported-renderer").forEach(n=>{if(n.innerText.replace(/\s/g,"").replace(/\n/g,"")==="LIVE"){const e=n.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;(e.classList.contains("ytd-rich-grid-row")||e.classList.contains("ytd-rich-item-renderer"))&&(e.style.display="none")}})}function V(o){o||location.href==="https://www.youtube.com/"&&document.querySelectorAll("ytd-badge-supported-renderer").forEach(n=>{if(n.innerText.replace(/\s/g,"").replace(/\n/g,"")==="PREMIERE"){const e=n.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;(e.classList.contains("ytd-rich-grid-row")||e.classList.contains("ytd-rich-item-renderer"))&&(e.style.display="none")}})}function D(o){o?location.href.includes("youtube.com/feed/subscriptions")&&document.querySelectorAll('[href^="/shorts/"]').forEach(n=>{if(n.classList.contains("ytd-notification-renderer"))return;const e=n.parentNode.parentNode.parentNode;e.style.display="none"}):location.href.includes("youtube.com/feed/subscriptions")&&(document.querySelectorAll('[href^="/shorts/"]').forEach(n=>{if(n.classList.contains("ytd-notification-renderer"))return;const e=n.parentNode.parentNode.parentNode,t=e.parentNode.parentNode,s=e.parentNode.parentNode.parentNode.parentNode.parentNode;t.style.display!=="none"&&d++,(t.classList.contains("ytd-rich-grid-row")||t.classList.contains("ytd-rich-item-renderer"))&&t.style.display!=="none"&&(t.style.display="none"),!(t.classList.contains("ytd-rich-grid-row")||t.classList.contains("ytd-rich-item-renderer"))&&((t.nodeName==="YTD-GRID-VIDEO-RENDERER"||t.classList.contains("ytd-shelf-renderer"))&&(e.style.display!=="none"&&d++,e.style.display="none"),s.nodeName==="YTD-EXPANDED-SHELF-CONTENTS-RENDERER"&&(e.style.display!=="none"&&d++,s.parentNode.parentNode.style.display="none"))}),i("subFeedShorts",d),d=0)}function O(o){o||location.href.includes("youtube.com/feed/subscriptions")&&document.querySelectorAll("ytd-badge-supported-renderer").forEach(n=>{if(n.innerText.replace(/\s/g,"").replace(/\n/g,"")==="LIVE"){const e=n.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode,t=n.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;(e.classList.contains("ytd-rich-grid-row")||e.classList.contains("ytd-rich-item-renderer"))&&(e.style.display="none"),t.classList.contains("ytd-shelf-renderer")&&(t.style.display="none")}})}function I(o){o||location.href.includes("youtube.com/feed/subscriptions")&&document.querySelectorAll("ytd-badge-supported-renderer").forEach(n=>{if(n.innerText.replace(/\s/g,"").replace(/\n/g,"")==="PREMIERE"){const e=n.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode,t=n.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;(e.classList.contains("ytd-rich-grid-row")||e.classList.contains("ytd-rich-item-renderer"))&&(e.style.display="none"),t.classList.contains("ytd-shelf-renderer")&&(t.style.display="none")}})}function M(o){o?(location.href.includes("youtube.com/feed/explore")||location.href.includes("youtube.com/gaming"))&&(document.querySelectorAll('[href^="/shorts/"]').forEach(e=>{const t=e.parentNode.parentNode.parentNode;t.style.display="none"}),document.querySelectorAll(".reel-shelf-items").forEach(e=>{const t=e.parentNode.parentNode.parentNode;t.style.display="none"})):(location.href.includes("youtube.com/feed/trending")||location.href.includes("youtube.com/gaming"))&&(document.querySelectorAll('[href^="/shorts/"]').forEach(e=>{if(e.classList.contains("ytd-notification-renderer"))return;const t=e.parentNode.parentNode.parentNode;t.style.display!=="none"&&f++,t.style.display="none"}),document.querySelectorAll(".style-scope ytd-reel-shelf-renderer").forEach(e=>{const t=e.parentNode;t.parentNode.removeChild(t),f++}),i("trendFeedShorts",f),f=0)}function k(o){if(o){if(!document.querySelector("ytm-search"))return;document.querySelectorAll(".reel-shelf-items").forEach(t=>{const s=t.parentNode;s.style.display="none"}),document.querySelectorAll('[aria-label="Shorts"]').forEach(t=>{if(t.classList.contains("ytd-notification-renderer"))return;const s=t.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;s.style.display="none"})}else{if(!document.querySelector(".style-scope ytd-two-column-search-results-renderer"))return;document.querySelectorAll(".style-scope yt-horizontal-list-renderer").forEach(t=>{const s=t.parentNode.parentNode;s.style.display!=="none"&&h++,s.style.display="none"}),document.querySelectorAll('[href^="/shorts/"]').forEach(t=>{if(t.classList.contains("ytd-notification-renderer"))return;const s=t.parentNode.parentNode.parentNode;s.style.display!=="none"&&h++,s.style.display="none"}),i("searchResultShorts",h),h=0}}function B(o){o?location.href.includes("youtube.com/watch")&&document.querySelectorAll('[href^="/shorts/"]').forEach(n=>{if(n.classList.contains("ytd-notification-renderer"))return;const e=n.parentNode.parentNode;e.style.display="none"}):location.href.includes("youtube.com/watch")&&(document.querySelectorAll('[href^="/shorts/"]').forEach(n=>{if(n.classList.contains("ytd-notification-renderer"))return;const e=n.parentNode.parentNode;e.style.display!=="none"&&S++,e.style.display="none"}),i("recommendedShorts",S),S=0)}function Y(o){if(o){const r=document.querySelectorAll(".scbrr-tab.center");Array.from(r).filter(e=>e.innerText.toLowerCase()==="shorts").forEach(e=>{e.parentNode.removeChild(e)})}else{const r=document.querySelectorAll(".tab-content");Array.from(r).filter(e=>e.textContent.replace(/\s/g,"").replace(/\n/g,"")==="Shorts").forEach(e=>{const t=e.parentNode;t.parentNode.removeChild(t),b++}),i("channelTabs",b),b=0}}function j(o){o||document.querySelectorAll('[href^="/shorts/"]').forEach(n=>{if(n.classList.contains("ytd-notification-renderer")){const e=n.parentNode;e.style.display="none"}})}function z(o){o?(location.href.includes("/channel/")||location.href.includes("@")||location.href.includes("/user/")||location.href.includes("/c/"))&&(document.querySelectorAll(".reel-shelf-items").forEach(e=>{const t=e.parentNode.parentNode.parentNode;t.style.display="none"}),document.querySelectorAll(".scbrr-tab.center").forEach(e=>{e.getAttribute("role")==="tab"&&e.getAttribute("aria-selected")==="true"&&e.innerText.toLowerCase()!=="shorts"&&document.querySelectorAll('[href^="/shorts/"]').forEach(s=>{if(s.classList.contains("ytd-notification-renderer"))return;const l=s.parentNode;l.style.display="none"})})):(location.href.includes("/channel/")||location.href.includes("@")||location.href.includes("/user/")||location.href.includes("/c/"))&&document.querySelectorAll(".ytd-c4-tabbed-header-renderer").forEach(n=>{n.getAttribute("role")==="tab"&&n.getAttribute("aria-selected")==="true"&&n.innerText.toLowerCase()!=="shorts"&&(document.querySelectorAll('[href^="/shorts/"]').forEach(t=>{if(t.classList.contains("ytd-notification-renderer"))return;const s=t.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;s.style.display!=="none"&&E++,s.style.display="none"}),i("channelShorts",E),E=0)})}function X(){function o(r){const n=/\/shorts\/([^/]+)/,e=r.match(n);return e?e[1]:null}o(location.href)&&(location.href=`https://youtube.com/watch?v=${o(location.href)}`,w++,i("playedAsRegular",w),w=0)}async function i(o,r){const n=await chrome.storage.sync.get([o]),e=n[o]?n[o]:0,t=r/2,s=Math.ceil(e+t);chrome.storage.sync.set({[o]:s})}let y,H;async function A(o){const r=await v();if(!r.toggleState)return;const n=document.body;if(n!=null){if(o&&p(),setTimeout(()=>{p()},1500),r.toggleTurboState)H=setInterval(()=>{p()},500);else{let t=function(s,l){let L,c;return function(){const T=this,q=arguments;c?(clearTimeout(L),L=setTimeout(function(){Date.now()-c>=l&&(s.apply(T,q),c=Date.now())},l-(Date.now()-c))):(s.apply(T,q),c=Date.now())}};var e=t;y=new MutationObserver(t(async function(s,l){setTimeout(()=>{p()},1500)},3e3)),y.observe(n,{childList:!0,subtree:!0})}return}else setTimeout(function(){A()},1e3)}window.addEventListener("load",async function(){A()});chrome.runtime.onMessage.addListener(async function(o,r,n){o.checkStates&&(y&&y.disconnect(),clearInterval(H),A(!0))}); diff --git a/dist/manifest.json b/dist/manifest.json index ff41caa..adfd679 100644 --- a/dist/manifest.json +++ b/dist/manifest.json @@ -1,7 +1,7 @@ { "name": "Hide YouTube Shorts", "manifest_version": 3, - "version": "1.6.11", + "version": "1.6.12", "description": "Block YouTube Shorts effortlessly with this powerful browser extension", "permissions": [ "storage" diff --git a/public/manifest.json b/public/manifest.json index ff41caa..adfd679 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -1,7 +1,7 @@ { "name": "Hide YouTube Shorts", "manifest_version": 3, - "version": "1.6.11", + "version": "1.6.12", "description": "Block YouTube Shorts effortlessly with this powerful browser extension", "permissions": [ "storage" diff --git a/src/components/ModalDisplay.jsx b/src/components/ModalDisplay.jsx index 13a8c82..217dafb 100644 --- a/src/components/ModalDisplay.jsx +++ b/src/components/ModalDisplay.jsx @@ -38,7 +38,7 @@ const ModalDisplay = () => { > - What's New In 1.6.11 + What's New In 1.6.12 June 13, 2023