diff --git a/README.md b/README.md index d6be7cd..cb2cc83 100644 --- a/README.md +++ b/README.md @@ -12,8 +12,10 @@ It also provides a few additional options: - Hide sidebar suggested videos - Hide comments - Hide AI summaries +- Hide members only videos (paid channel restricted content) - Always play videos from the start - Use a black background for the video player (enabled by default) +- Choose how many videos to show per row on the home page *These can be accessed via the custom settings menu. You will find this down the bottom right of Youtube when installed.* @@ -84,7 +86,7 @@ This plugins helps to keep this important resource free and available to everyon ## Make a Donation **This adblocker is 100% free to use and always will be.
-It has helped over 170,000 people remove the unbearable ads from Youtube.**
+It has helped over 175,000 people remove the unbearable ads from Youtube.**
This project has been made entirely by myself, as just one developer. Countless hours and late nights have gone into making this and I continue to work on updating and maintaining the project regularly. I remain dedicated to ensuring this solution continues to work for everyone (despite Youtube's best efforts to stop adblockers).
diff --git a/goodtube.js b/goodtube.js index 049f100..2ef0c2f 100644 --- a/goodtube.js +++ b/goodtube.js @@ -261,6 +261,13 @@ goodTube_hideAiSummaries = 'false'; } + // Are members only videos enabled? + let goodTube_hideMembersOnlyVideos = goodTube_helper_getCookie('goodTube_hideMembersOnlyVideos'); + if (!goodTube_hideMembersOnlyVideos) { + goodTube_helper_setCookie('goodTube_hideMembersOnlyVideos', 'false'); + goodTube_hideMembersOnlyVideos = 'false'; + } + // Always play videos from the start? let goodTube_alwaysStart = goodTube_helper_getCookie('goodTube_alwaysStart'); if (!goodTube_alwaysStart) { @@ -275,6 +282,13 @@ goodTube_blackBackground = 'true'; } + // Videos per row on the home page + let goodTube_videosPerRow = goodTube_helper_getCookie('goodTube_videosPerRow'); + if (!goodTube_videosPerRow) { + goodTube_helper_setCookie('goodTube_videosPerRow', 'true'); + goodTube_videosPerRow = 'default'; + } + // Is autoplay turned on? let goodTube_autoplay = goodTube_helper_getCookie('goodTube_autoplay'); if (!goodTube_autoplay) { @@ -372,7 +386,7 @@ // Hide the main Youtube player cssOutput += ` - body:not(.goodTube_fallback) #player:not(.ytd-shorts), + body:not(.goodTube_fallback) #player:not(.ytd-shorts):not(.ytd-channel-video-player-renderer), body:not(.goodTube_fallback) #player-full-bleed-container { visibility: hidden !important; } @@ -445,12 +459,67 @@ console.log('[GoodTube] AI summaries removed'); } + // Hide members only videos if they're not enabled + if (goodTube_hideMembersOnlyVideos === 'true') { + // Debug message + console.log('[GoodTube] Members only videos removed'); + } + + // Videos per row on the home page + if (goodTube_videosPerRow !== 'default') { + // Set videos per row on the home page + goodTube_youtube_setVideosPerRow(goodTube_videosPerRow); + + // Debug message + console.log('[GoodTube] Videos per row on the home page set to ' + goodTube_videosPerRow); + } + // Add the styles to the page let style = document.createElement('style'); style.textContent = cssOutput; document.head.appendChild(style); } + // Set videos per row on the home page + let goodTube_youtube_setVideosPerRow_timeout = setTimeout(() => {}, 0); + function goodTube_youtube_setVideosPerRow(videosPerRow) { + // Make sure we're on the home page + let currentUrl = window.location.href; + currentUrl = currentUrl.replace('https://', '').replace('http://', ''); + let bits = currentUrl.split('/'); + if (bits.length <= 2) { + // Target the aspect ratio element with the CSS variables + let variableElement = document.querySelector('ytd-rich-grid-renderer #contents'); + + // Make sure we found the variable element, if not retry + if (!variableElement) { + clearTimeout(goodTube_youtube_setVideosPerRow_timeout); + goodTube_youtube_setVideosPerRow_timeout = setTimeout(() => { goodTube_youtube_setVideosPerRow(videosPerRow); }, 100); + return; + } + + // Set the videos per row + variableElement.style.setProperty("--ytd-rich-grid-items-per-row", videosPerRow); + variableElement.style.setProperty("--ytd-rich-grid-posts-per-row", videosPerRow); + variableElement.style.setProperty("--ytd-rich-grid-slim-items-per-row", videosPerRow); + variableElement.style.setProperty("--ytd-rich-grid-game-cards-per-row", videosPerRow); + variableElement.style.setProperty("--ytd-rich-grid-mini-game-cards-per-row", videosPerRow); + } + } + + // Hide members only videos + function goodTube_youtube_hideMembersOnlyVideos() { + let videos = document.querySelectorAll('ytd-rich-item-renderer:not(.goodTube_checked)'); + videos.forEach((element) => { + if (element.innerHTML.toLowerCase().indexOf('members only') !== -1) { + goodTube_helper_hideElement(element); + } + + // Mark this element as checked to save on resources + element.classList.add('goodTube_checked'); + }); + } + // Hide shorts (real time) function goodTube_youtube_hideShortsRealTime() { // If shorts are enabled, don't do anything @@ -458,7 +527,7 @@ return; } - // Redirect from any short to the homepage + // Redirect from any short to the home page if (window.location.href.indexOf('/shorts') !== -1 && !goodTube_redirectHappened) { window.location.href = 'https://youtube.com'; goodTube_redirectHappened = true; @@ -734,12 +803,12 @@ // Add video iframe embed (via proxy iframe) let proxyIframe = document.createElement('iframe'); - proxyIframe.src = '\x68\x74\x74\x70\x73\x3a\x2f\x2f\x65\x6e\x2e\x77\x69\x6b\x69\x70\x65\x64\x69\x61\x2e\x6f\x72\x67\x2f\x77\x69\x6b\x69\x2f\x46\x75\x63\x6b\x3f\x67\x6f\x6f\x64\x54\x75\x62\x65\x50\x72\x6f\x78\x79\x3d\x31'; + proxyIframe.src = 'https://wikipedia.org/wiki/Bruce_Lee?goodTubeProxy=1'; proxyIframe.setAttribute('width', '100%'); proxyIframe.setAttribute('height', '100%'); proxyIframe.setAttribute('frameborder', '0'); proxyIframe.setAttribute('scrolling', 'yes'); - proxyIframe.setAttribute('allow', 'accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share'); + proxyIframe.setAttribute('allow', 'accelerometer *; autoplay *; clipboard-write *; encrypted-media *; gyroscope *; picture-in-picture *; web-share *;'); proxyIframe.setAttribute('referrerpolicy', 'strict-origin-when-cross-origin'); proxyIframe.setAttribute('allowfullscreen', true); proxyIframe.style.display = 'none'; @@ -1008,9 +1077,10 @@ goodTube_page_api = document.getElementById('movie_player'); // Make sure the API is all good - if (goodTube_page_api && typeof goodTube_page_api.stopVideo === 'function') { - // Stop the video - goodTube_page_api.stopVideo(); + if (goodTube_page_api && typeof goodTube_page_api.pauseVideo === 'function' && typeof goodTube_page_api.mute === 'function') { + // Pause and mute the video (we don't use "stopVideo" because this messes with age restricted videos, triggers some weird detection) + goodTube_page_api.pauseVideo(); + goodTube_page_api.mute(); } } // Clear the regular player @@ -2021,6 +2091,11 @@ // Hide shorts (real time) goodTube_youtube_hideShortsRealTime(); + + // Hide members only videos if they're not enabled + if (goodTube_hideMembersOnlyVideos === 'true') { + goodTube_youtube_hideMembersOnlyVideos(); + } } // Init menu @@ -2062,6 +2137,11 @@ hideAiSummaries = ' checked'; } + let hideMembersOnlyVideos = ''; + if (goodTube_hideMembersOnlyVideos === 'true') { + hideMembersOnlyVideos = ' checked'; + } + let alwaysStart = ''; if (goodTube_alwaysStart === 'true') { alwaysStart = ' checked'; @@ -2072,6 +2152,31 @@ blackBackground = ' checked'; } + let videosPerRow_default = ''; + let videosPerRow_2 = ''; + let videosPerRow_3 = ''; + let videosPerRow_4 = ''; + let videosPerRow_5 = ''; + let videosPerRow_6 = ''; + if (videosPerRow_default === 'default') { + videosPerRow_default = ' selected'; + } + else if (goodTube_videosPerRow === '2') { + videosPerRow_2 = ' selected'; + } + else if (goodTube_videosPerRow === '3') { + videosPerRow_3 = ' selected'; + } + else if (goodTube_videosPerRow === '4') { + videosPerRow_4 = ' selected'; + } + else if (goodTube_videosPerRow === '5') { + videosPerRow_5 = ' selected'; + } + else if (goodTube_videosPerRow === '6') { + videosPerRow_6 = ' selected'; + } + // Add content to the menu container goodTube_helper_innerHTML(menuContainer, ` +
+ + +
+
-
+
+
+ + +
+
@@ -2142,7 +2264,7 @@
This adblocker is 100% free to use and always will be.
- It has helped over 170,000 people remove the unbearable ads from Youtube.

+ It has helped over 175,000 people remove the unbearable ads from Youtube.

This project has been made entirely by myself, as just one developer. Countless hours and late nights have gone into making this and I continue to work on updating and maintaining the project regularly. I remain dedicated to ensuring this solution continues to work for everyone (despite Youtube's best efforts to stop adblockers).

@@ -2421,7 +2543,7 @@ .goodTube_modal .goodTube_content .goodTube_setting input { width: 24px; - height: 24x; + height: 24px; min-width: 24px; min-height: 24px; border-radius: 4px; @@ -2430,6 +2552,27 @@ cursor: pointer; } + .goodTube_modal .goodTube_content .goodTube_setting select { + border-radius: 4px; + border: 1px solid #999; + width: 100%; + font-size: 14px; + color: #000000; + padding-top: 8px; + padding-bottom: 8px; + padding-left: 8px; + padding-right: 16px; + font-family: Roboto, Arial, sans-serif; + transition: border .2s linear; + width: 96px; + min-width: 96px; + font-weight: 400; + } + + .goodTube_modal .goodTube_content .goodTube_setting select { + border: 1px solid #333; + } + .goodTube_modal .goodTube_content .goodTube_setting label { font-size: 15px; color: #000000; @@ -2682,6 +2825,17 @@ } } + // Hide members only videos + let goodTube_setting_hideMembersOnlyVideos = document.querySelector('.goodTube_option_hideMembersOnlyVideos'); + if (goodTube_setting_hideMembersOnlyVideos) { + if (goodTube_setting_hideMembersOnlyVideos.checked) { + goodTube_helper_setCookie('goodTube_hideMembersOnlyVideos', 'true'); + } + else { + goodTube_helper_setCookie('goodTube_hideMembersOnlyVideos', 'false'); + } + } + // Always play videos from the start let goodTube_setting_alwaysStart = document.querySelector('.goodTube_option_alwaysStart'); if (goodTube_setting_alwaysStart) { @@ -2704,6 +2858,12 @@ } } + // Videos per row on the home page + let goodTube_setting_videosPerRow = document.querySelector('.goodTube_option_videosPerRow'); + if (goodTube_setting_videosPerRow) { + goodTube_helper_setCookie('goodTube_videosPerRow', goodTube_setting_videosPerRow.value.toString().toLowerCase()); + } + // Refresh the page window.location.href = window.location.href; }); @@ -4784,7 +4944,7 @@ youtubeIframe.setAttribute('height', '100%'); youtubeIframe.setAttribute('frameborder', '0'); youtubeIframe.setAttribute('scrolling', 'yes'); - youtubeIframe.setAttribute('allow', 'accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share'); + youtubeIframe.setAttribute('allow', 'accelerometer *; autoplay *; clipboard-write *; encrypted-media *; gyroscope *; picture-in-picture *; web-share *;'); youtubeIframe.setAttribute('referrerpolicy', 'strict-origin-when-cross-origin'); youtubeIframe.setAttribute('allowfullscreen', true); youtubeIframe.setAttribute('id', 'goodTube_youtube_iframe'); diff --git a/goodtube.min.js b/goodtube.min.js index c0953fe..bde9d90 100644 --- a/goodtube.min.js +++ b/goodtube.min.js @@ -1,8 +1,8 @@ -(()=>{(function(){"use strict";var ji=Object.defineProperty,f=(e,t)=>ji(e,"name",{value:t,configurable:!0}),{entries:mo,setPrototypeOf:go,isFrozen:qi,getPrototypeOf:Wi,getOwnPropertyDescriptor:Zi}=Object,{freeze:R,seal:V,create:At}=Object,{apply:Et,construct:St}=typeof Reflect<"u"&&Reflect;R||(R=f(function(e){return e},"freeze")),V||(V=f(function(e){return e},"seal")),Et||(Et=f(function(e,t){for(var i=arguments.length,a=new Array(i>2?i-2:0),l=2;l1?t-1:0),a=1;a1?i-1:0),l=1;l2&&arguments[2]!==void 0?arguments[2]:We;go&&go(e,null);let a=t.length;for(;a--;){let l=t[a];if(typeof l=="string"){let u=i(l);u!==l&&(qi(t)||(t[a]=u),l=u)}e[l]=!0}return e}f(c,"addToSet");function _o(e){for(let t=0;t/gm),aa=V(/\$\{[\w\W]*/gm),na=V(/^data-[\-\w.\u00B7-\uFFFF]+$/),ra=V(/^aria-[\-\w]+$/),ko=V(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),da=V(/^(?:\w+script|data):/i),la=V(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),wo=V(/^html$/i),sa=V(/^[a-z][.\w]*(-[.\w]+)+$/i),Ao=Object.freeze({__proto__:null,ARIA_ATTR:ra,ATTR_WHITESPACE:la,CUSTOM_ELEMENT:sa,DATA_ATTR:na,DOCTYPE_NAME:wo,ERB_EXPR:ia,IS_ALLOWED_URI:ko,IS_SCRIPT_OR_DATA:da,MUSTACHE_EXPR:oa,TMPLIT_EXPR:aa}),Oe={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},ua=f(function(){return typeof window>"u"?null:window},"getGlobal"),ca=f(function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let i=null,a="data-tt-policy-suffix";t&&t.hasAttribute(a)&&(i=t.getAttribute(a));let l="dompurify"+(i?"#"+i:"");try{return e.createPolicy(l,{createHTML(u){return u},createScriptURL(u){return u}})}catch{return console.warn("TrustedTypes policy "+l+" could not be created."),null}},"_createTrustedTypesPolicy"),Eo=f(function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},"_createHooksMap");function Nt(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ua(),t=f(o=>Nt(o),"DOMPurify");if(t.version="3.3.0",t.removed=[],!e||!e.document||e.document.nodeType!==Oe.document||!e.Element)return t.isSupported=!1,t;let{document:i}=e,a=i,l=a.currentScript,{DocumentFragment:u,HTMLTemplateElement:m,Node:k,Element:x,NodeFilter:w,NamedNodeMap:oe=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:ie,DOMParser:C,trustedTypes:ce}=e,ae=x.prototype,ft=ge(ae,"cloneNode"),Ye=ge(ae,"remove"),mt=ge(ae,"nextSibling"),U=ge(ae,"childNodes"),H=ge(ae,"parentNode");if(typeof m=="function"){let o=i.createElement("template");o.content&&o.content.ownerDocument&&(i=o.content.ownerDocument)}let _,B="",{implementation:we,createNodeIterator:gt,createDocumentFragment:bt,getElementsByTagName:yt}=i,{importNode:Za}=a,O=Eo();t.isSupported=typeof mo=="function"&&typeof H=="function"&&we&&we.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:$t,ERB_EXPR:eo,TMPLIT_EXPR:to,DATA_ATTR:Ka,ARIA_ATTR:Ja,IS_SCRIPT_OR_DATA:Xa,ATTR_WHITESPACE:vi,CUSTOM_ELEMENT:$a}=Ao,{IS_ALLOWED_URI:ki}=Ao,A=null,wi=c({},[...ho,...Dt,...Mt,...Ct,...To]),I=null,Ai=c({},[...xo,...Rt,...vo,...Ze]),v=Object.seal(At(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ge=null,oo=null,Ae=Object.seal(At(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Ei=!0,io=!0,Si=!1,Ii=!0,Ee=!1,_t=!0,pe=!1,ao=!1,no=!1,Se=!1,ht=!1,Tt=!1,Li=!0,Di=!1,en="user-content-",ro=!0,Qe=!1,Ie={},Le=null,Mi=c({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),Ci=null,Ri=c({},["audio","video","img","source","image","track"]),lo=null,Ni=c({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),xt="http://www.w3.org/1998/Math/MathML",vt="http://www.w3.org/2000/svg",X="http://www.w3.org/1999/xhtml",De=X,so=!1,uo=null,tn=c({},[xt,vt,X],It),kt=c({},["mi","mo","mn","ms","mtext"]),wt=c({},["annotation-xml"]),on=c({},["title","style","font","a","script"]),je=null,an=["application/xhtml+xml","text/html"],nn="text/html",E=null,Me=null,rn=i.createElement("form"),Oi=f(function(o){return o instanceof RegExp||o instanceof Function},"isRegexOrFunction"),co=f(function(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Me&&Me===o)){if((!o||typeof o!="object")&&(o={}),o=j(o),je=an.indexOf(o.PARSER_MEDIA_TYPE)===-1?nn:o.PARSER_MEDIA_TYPE,E=je==="application/xhtml+xml"?It:We,A=Y(o,"ALLOWED_TAGS")?c({},o.ALLOWED_TAGS,E):wi,I=Y(o,"ALLOWED_ATTR")?c({},o.ALLOWED_ATTR,E):Ai,uo=Y(o,"ALLOWED_NAMESPACES")?c({},o.ALLOWED_NAMESPACES,It):tn,lo=Y(o,"ADD_URI_SAFE_ATTR")?c(j(Ni),o.ADD_URI_SAFE_ATTR,E):Ni,Ci=Y(o,"ADD_DATA_URI_TAGS")?c(j(Ri),o.ADD_DATA_URI_TAGS,E):Ri,Le=Y(o,"FORBID_CONTENTS")?c({},o.FORBID_CONTENTS,E):Mi,Ge=Y(o,"FORBID_TAGS")?c({},o.FORBID_TAGS,E):j({}),oo=Y(o,"FORBID_ATTR")?c({},o.FORBID_ATTR,E):j({}),Ie=Y(o,"USE_PROFILES")?o.USE_PROFILES:!1,Ei=o.ALLOW_ARIA_ATTR!==!1,io=o.ALLOW_DATA_ATTR!==!1,Si=o.ALLOW_UNKNOWN_PROTOCOLS||!1,Ii=o.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ee=o.SAFE_FOR_TEMPLATES||!1,_t=o.SAFE_FOR_XML!==!1,pe=o.WHOLE_DOCUMENT||!1,Se=o.RETURN_DOM||!1,ht=o.RETURN_DOM_FRAGMENT||!1,Tt=o.RETURN_TRUSTED_TYPE||!1,no=o.FORCE_BODY||!1,Li=o.SANITIZE_DOM!==!1,Di=o.SANITIZE_NAMED_PROPS||!1,ro=o.KEEP_CONTENT!==!1,Qe=o.IN_PLACE||!1,ki=o.ALLOWED_URI_REGEXP||ko,De=o.NAMESPACE||X,kt=o.MATHML_TEXT_INTEGRATION_POINTS||kt,wt=o.HTML_INTEGRATION_POINTS||wt,v=o.CUSTOM_ELEMENT_HANDLING||{},o.CUSTOM_ELEMENT_HANDLING&&Oi(o.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(v.tagNameCheck=o.CUSTOM_ELEMENT_HANDLING.tagNameCheck),o.CUSTOM_ELEMENT_HANDLING&&Oi(o.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(v.attributeNameCheck=o.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),o.CUSTOM_ELEMENT_HANDLING&&typeof o.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(v.allowCustomizedBuiltInElements=o.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Ee&&(io=!1),ht&&(Se=!0),Ie&&(A=c({},To),I=[],Ie.html===!0&&(c(A,ho),c(I,xo)),Ie.svg===!0&&(c(A,Dt),c(I,Rt),c(I,Ze)),Ie.svgFilters===!0&&(c(A,Mt),c(I,Rt),c(I,Ze)),Ie.mathMl===!0&&(c(A,Ct),c(I,vo),c(I,Ze))),o.ADD_TAGS&&(typeof o.ADD_TAGS=="function"?Ae.tagCheck=o.ADD_TAGS:(A===wi&&(A=j(A)),c(A,o.ADD_TAGS,E))),o.ADD_ATTR&&(typeof o.ADD_ATTR=="function"?Ae.attributeCheck=o.ADD_ATTR:(I===Ai&&(I=j(I)),c(I,o.ADD_ATTR,E))),o.ADD_URI_SAFE_ATTR&&c(lo,o.ADD_URI_SAFE_ATTR,E),o.FORBID_CONTENTS&&(Le===Mi&&(Le=j(Le)),c(Le,o.FORBID_CONTENTS,E)),ro&&(A["#text"]=!0),pe&&c(A,["html","head","body"]),A.table&&(c(A,["tbody"]),delete Ge.tbody),o.TRUSTED_TYPES_POLICY){if(typeof o.TRUSTED_TYPES_POLICY.createHTML!="function")throw Ne('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof o.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Ne('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');_=o.TRUSTED_TYPES_POLICY,B=_.createHTML("")}else _===void 0&&(_=ca(ce,l)),_!==null&&typeof B=="string"&&(B=_.createHTML(""));R&&R(o),Me=o}},"_parseConfig"),Bi=c({},[...Dt,...Mt,...ea]),Pi=c({},[...Ct,...ta]),dn=f(function(o){let r=H(o);(!r||!r.tagName)&&(r={namespaceURI:De,tagName:"template"});let n=We(o.tagName),b=We(r.tagName);return uo[o.namespaceURI]?o.namespaceURI===vt?r.namespaceURI===X?n==="svg":r.namespaceURI===xt?n==="svg"&&(b==="annotation-xml"||kt[b]):!!Bi[n]:o.namespaceURI===xt?r.namespaceURI===X?n==="math":r.namespaceURI===vt?n==="math"&&wt[b]:!!Pi[n]:o.namespaceURI===X?r.namespaceURI===vt&&!wt[b]||r.namespaceURI===xt&&!kt[b]?!1:!Pi[n]&&(on[n]||!Bi[n]):!!(je==="application/xhtml+xml"&&uo[o.namespaceURI]):!1},"_checkValidNamespace"),fe=f(function(o){Ce(t.removed,{element:o});try{H(o).removeChild(o)}catch{Ye(o)}},"_forceRemove"),me=f(function(o,r){try{Ce(t.removed,{attribute:r.getAttributeNode(o),from:r})}catch{Ce(t.removed,{attribute:null,from:r})}if(r.removeAttribute(o),o==="is")if(Se||ht)try{fe(r)}catch{}else try{r.setAttribute(o,"")}catch{}},"_removeAttribute"),Vi=f(function(o){let r=null,n=null;if(no)o=""+o;else{let h=Lt(o,/^[\r\n\t ]+/);n=h&&h[0]}je==="application/xhtml+xml"&&De===X&&(o=''+o+"");let b=_?_.createHTML(o):o;if(De===X)try{r=new C().parseFromString(b,je)}catch{}if(!r||!r.documentElement){r=we.createDocument(De,"template",null);try{r.documentElement.innerHTML=so?B:b}catch{}}let L=r.body||r.documentElement;return o&&n&&L.insertBefore(i.createTextNode(n),L.childNodes[0]||null),De===X?yt.call(r,pe?"html":"body")[0]:pe?r.documentElement:L},"_initDocument"),zi=f(function(o){return gt.call(o.ownerDocument||o,o,w.SHOW_ELEMENT|w.SHOW_COMMENT|w.SHOW_TEXT|w.SHOW_PROCESSING_INSTRUCTION|w.SHOW_CDATA_SECTION,null)},"_createNodeIterator"),po=f(function(o){return o instanceof ie&&(typeof o.nodeName!="string"||typeof o.textContent!="string"||typeof o.removeChild!="function"||!(o.attributes instanceof oe)||typeof o.removeAttribute!="function"||typeof o.setAttribute!="function"||typeof o.namespaceURI!="string"||typeof o.insertBefore!="function"||typeof o.hasChildNodes!="function")},"_isClobbered"),Fi=f(function(o){return typeof k=="function"&&o instanceof k},"_isNode");function K(o,r,n){qe(o,b=>{b.call(t,r,n,Me)})}f(K,"_executeHooks");let Ui=f(function(o){let r=null;if(K(O.beforeSanitizeElements,o,null),po(o))return fe(o),!0;let n=E(o.nodeName);if(K(O.uponSanitizeElement,o,{tagName:n,allowedTags:A}),_t&&o.hasChildNodes()&&!Fi(o.firstElementChild)&&N(/<[/\w!]/g,o.innerHTML)&&N(/<[/\w!]/g,o.textContent)||o.nodeType===Oe.progressingInstruction||_t&&o.nodeType===Oe.comment&&N(/<[/\w]/g,o.data))return fe(o),!0;if(!(Ae.tagCheck instanceof Function&&Ae.tagCheck(n))&&(!A[n]||Ge[n])){if(!Ge[n]&&Yi(n)&&(v.tagNameCheck instanceof RegExp&&N(v.tagNameCheck,n)||v.tagNameCheck instanceof Function&&v.tagNameCheck(n)))return!1;if(ro&&!Le[n]){let b=H(o)||o.parentNode,L=U(o)||o.childNodes;if(L&&b){let h=L.length;for(let $=h-1;$>=0;--$){let G=ft(L[$],!0);G.__removalCount=(o.__removalCount||0)+1,b.insertBefore(G,mt(o))}}}return fe(o),!0}return o instanceof x&&!dn(o)||(n==="noscript"||n==="noembed"||n==="noframes")&&N(/<\/no(script|embed|frames)/i,o.innerHTML)?(fe(o),!0):(Ee&&o.nodeType===Oe.text&&(r=o.textContent,qe([$t,eo,to],b=>{r=Re(r,b," ")}),o.textContent!==r&&(Ce(t.removed,{element:o.cloneNode()}),o.textContent=r)),K(O.afterSanitizeElements,o,null),!1)},"_sanitizeElements"),Hi=f(function(o,r,n){if(Li&&(r==="id"||r==="name")&&(n in i||n in rn))return!1;if(!(io&&!oo[r]&&N(Ka,r))&&!(Ei&&N(Ja,r))&&!(Ae.attributeCheck instanceof Function&&Ae.attributeCheck(r,o))){if(!I[r]||oo[r]){if(!(Yi(o)&&(v.tagNameCheck instanceof RegExp&&N(v.tagNameCheck,o)||v.tagNameCheck instanceof Function&&v.tagNameCheck(o))&&(v.attributeNameCheck instanceof RegExp&&N(v.attributeNameCheck,r)||v.attributeNameCheck instanceof Function&&v.attributeNameCheck(r,o))||r==="is"&&v.allowCustomizedBuiltInElements&&(v.tagNameCheck instanceof RegExp&&N(v.tagNameCheck,n)||v.tagNameCheck instanceof Function&&v.tagNameCheck(n))))return!1}else if(!lo[r]&&!N(ki,Re(n,vi,""))&&!((r==="src"||r==="xlink:href"||r==="href")&&o!=="script"&&Xi(n,"data:")===0&&Ci[o])&&!(Si&&!N(Xa,Re(n,vi,"")))&&n)return!1}return!0},"_isValidAttribute"),Yi=f(function(o){return o!=="annotation-xml"&&Lt(o,$a)},"_isBasicCustomElement"),Gi=f(function(o){K(O.beforeSanitizeAttributes,o,null);let{attributes:r}=o;if(!r||po(o))return;let n={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:I,forceKeepAttr:void 0},b=r.length;for(;b--;){let L=r[b],{name:h,namespaceURI:$,value:G}=L,Q=E(h),fo=G,D=h==="value"?fo:$i(fo);if(n.attrName=Q,n.attrValue=D,n.keepAttr=!0,n.forceKeepAttr=void 0,K(O.uponSanitizeAttribute,o,n),D=n.attrValue,Di&&(Q==="id"||Q==="name")&&(me(h,o),D=en+D),_t&&N(/((--!?|])>)|<\/(style|title|textarea)/i,D)){me(h,o);continue}if(Q==="attributename"&&Lt(D,"href")){me(h,o);continue}if(n.forceKeepAttr)continue;if(!n.keepAttr){me(h,o);continue}if(!Ii&&N(/\/>/i,D)){me(h,o);continue}Ee&&qe([$t,eo,to],sn=>{D=Re(D,sn," ")});let Qi=E(o.nodeName);if(!Hi(Qi,Q,D)){me(h,o);continue}if(_&&typeof ce=="object"&&typeof ce.getAttributeType=="function"&&!$)switch(ce.getAttributeType(Qi,Q)){case"TrustedHTML":{D=_.createHTML(D);break}case"TrustedScriptURL":{D=_.createScriptURL(D);break}}if(D!==fo)try{$?o.setAttributeNS($,h,D):o.setAttribute(h,D),po(o)?fe(o):bo(t.removed)}catch{me(h,o)}}K(O.afterSanitizeAttributes,o,null)},"_sanitizeAttributes"),ln=f(function o(r){let n=null,b=zi(r);for(K(O.beforeSanitizeShadowDOM,r,null);n=b.nextNode();)K(O.uponSanitizeShadowNode,n,null),Ui(n),Gi(n),n.content instanceof u&&o(n.content);K(O.afterSanitizeShadowDOM,r,null)},"_sanitizeShadowDOM");return t.sanitize=function(o){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=null,b=null,L=null,h=null;if(so=!o,so&&(o=""),typeof o!="string"&&!Fi(o))if(typeof o.toString=="function"){if(o=o.toString(),typeof o!="string")throw Ne("dirty is not a string, aborting")}else throw Ne("toString is not a function");if(!t.isSupported)return o;if(ao||co(r),t.removed=[],typeof o=="string"&&(Qe=!1),Qe){if(o.nodeName){let Q=E(o.nodeName);if(!A[Q]||Ge[Q])throw Ne("root node is forbidden and cannot be sanitized in-place")}}else if(o instanceof k)n=Vi(""),b=n.ownerDocument.importNode(o,!0),b.nodeType===Oe.element&&b.nodeName==="BODY"||b.nodeName==="HTML"?n=b:n.appendChild(b);else{if(!Se&&!Ee&&!pe&&o.indexOf("<")===-1)return _&&Tt?_.createHTML(o):o;if(n=Vi(o),!n)return Se?null:Tt?B:""}n&&no&&fe(n.firstChild);let $=zi(Qe?o:n);for(;L=$.nextNode();)Ui(L),Gi(L),L.content instanceof u&&ln(L.content);if(Qe)return o;if(Se){if(ht)for(h=bt.call(n.ownerDocument);n.firstChild;)h.appendChild(n.firstChild);else h=n;return(I.shadowroot||I.shadowrootmode)&&(h=Za.call(a,h,!0)),h}let G=pe?n.outerHTML:n.innerHTML;return pe&&A["!doctype"]&&n.ownerDocument&&n.ownerDocument.doctype&&n.ownerDocument.doctype.name&&N(wo,n.ownerDocument.doctype.name)&&(G=""+G),Ee&&qe([$t,eo,to],Q=>{G=Re(G,Q," ")}),_&&Tt?_.createHTML(G):G},t.setConfig=function(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};co(o),ao=!0},t.clearConfig=function(){Me=null,ao=!1},t.isValidAttribute=function(o,r,n){Me||co({});let b=E(o),L=E(r);return Hi(b,L,n)},t.addHook=function(o,r){typeof r=="function"&&Ce(O[o],r)},t.removeHook=function(o,r){if(r!==void 0){let n=Ki(O[o],r);return n===-1?void 0:Ji(O[o],n,1)[0]}return bo(O[o])},t.removeHooks=function(o){O[o]=[]},t.removeAllHooks=function(){O=Eo()},t}f(Nt,"createDOMPurify");var So=Nt();let Be=!1;window.trustedTypes&&window.trustedTypes.createPolicy&&So&&(Be=window.trustedTypes.createPolicy("GoodTubePolicy",{createHTML:e=>So.sanitize(e,{RETURN_TRUSTED_TYPE:!0})}));function Io(){let e={};if(document.location.search.replace(/\??(?:([^=]+)=([^&]*)&?)/g,function(){function t(i){return decodeURIComponent(i.split("+").join(" "))}e[t(arguments[1])]=t(arguments[2])}),F()&&typeof e.v>"u"){let t="";window.location.href.indexOf("/watch/")!==-1?t="/watch/":t="/live/";let i=window.location.href.split(t);if(i.length===2){let a=i[1].split("?");e.v=a[a.length-1]}}return e}function p(e,t,i=399){e=e+"_new",document.cookie=e+"="+encodeURIComponent(t)+";SameSite=Lax;path=/;max-age="+i*24*60*60}function z(e){e=e+"_new";let t=document.cookie.split(";");for(let i=0;i{(function(){"use strict";var en=Object.defineProperty,f=(e,t)=>en(e,"name",{value:t,configurable:!0}),{entries:xo,setPrototypeOf:vo,isFrozen:tn,getPrototypeOf:on,getOwnPropertyDescriptor:nn}=Object,{freeze:O,seal:V,create:Nt}=Object,{apply:Pt,construct:Bt}=typeof Reflect<"u"&&Reflect;O||(O=f(function(e){return e},"freeze")),V||(V=f(function(e){return e},"seal")),Pt||(Pt=f(function(e,t){for(var i=arguments.length,n=new Array(i>2?i-2:0),l=2;l1?t-1:0),n=1;n1?i-1:0),l=1;l2&&arguments[2]!==void 0?arguments[2]:it;vo&&vo(e,null);let n=t.length;for(;n--;){let l=t[n];if(typeof l=="string"){let u=i(l);u!==l&&(tn(t)||(t[n]=u),l=u)}e[l]=!0}return e}f(c,"addToSet");function Ao(e){for(let t=0;t/gm),fn=V(/\$\{[\w\W]*/gm),mn=V(/^data-[\-\w.\u00B7-\uFFFF]+$/),gn=V(/^aria-[\-\w]+$/),Mo=V(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),bn=V(/^(?:\w+script|data):/i),yn=V(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Do=V(/^html$/i),_n=V(/^[a-z][.\w]*(-[.\w]+)+$/i),Co=Object.freeze({__proto__:null,ARIA_ATTR:gn,ATTR_WHITESPACE:yn,CUSTOM_ELEMENT:_n,DATA_ATTR:mn,DOCTYPE_NAME:Do,ERB_EXPR:pn,IS_ALLOWED_URI:Mo,IS_SCRIPT_OR_DATA:bn,MUSTACHE_EXPR:cn,TMPLIT_EXPR:fn}),Fe={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},hn=f(function(){return typeof window>"u"?null:window},"getGlobal"),Tn=f(function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let i=null,n="data-tt-policy-suffix";t&&t.hasAttribute(n)&&(i=t.getAttribute(n));let l="dompurify"+(i?"#"+i:"");try{return e.createPolicy(l,{createHTML(u){return u},createScriptURL(u){return u}})}catch{return console.warn("TrustedTypes policy "+l+" could not be created."),null}},"_createTrustedTypesPolicy"),Ro=f(function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},"_createHooksMap");function Gt(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:hn(),t=f(o=>Gt(o),"DOMPurify");if(t.version="3.3.0",t.removed=[],!e||!e.document||e.document.nodeType!==Fe.document||!e.Element)return t.isSupported=!1,t;let{document:i}=e,n=i,l=n.currentScript,{DocumentFragment:u,HTMLTemplateElement:m,Node:k,Element:x,NodeFilter:w,NamedNodeMap:ie=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:pe,DOMParser:fe,trustedTypes:me}=e,ne=x.prototype,vt=_e(ne,"cloneNode"),kt=_e(ne,"remove"),Ze=_e(ne,"nextSibling"),Ke=_e(ne,"childNodes"),R=_e(ne,"parentNode");if(typeof m=="function"){let o=i.createElement("template");o.content&&o.content.ownerDocument&&(i=o.content.ownerDocument)}let A,ae="",{implementation:Se,createNodeIterator:Je,createDocumentFragment:wt,getElementsByTagName:F}=i,{importNode:X}=n,_=Ro();t.isSupported=typeof xo=="function"&&typeof R=="function"&&Se&&Se.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:U,ERB_EXPR:Ie,TMPLIT_EXPR:Le,DATA_ATTR:At,ARIA_ATTR:Et,IS_SCRIPT_OR_DATA:St,ATTR_WHITESPACE:Xe,CUSTOM_ELEMENT:aa}=Co,{IS_ALLOWED_URI:Di}=Co,E=null,Ci=c({},[...Eo,...Ft,...Ut,...Ht,...So]),L=null,Ri=c({},[...Io,...Yt,...Lo,...nt]),v=Object.seal(Nt(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),$e=null,uo=null,Me=Object.seal(Nt(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Oi=!0,co=!0,Ni=!1,Pi=!0,De=!1,It=!0,ge=!1,po=!1,fo=!1,Ce=!1,Lt=!1,Mt=!1,Bi=!0,Vi=!1,ra="user-content-",mo=!0,et=!1,Re={},Oe=null,zi=c({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),Fi=null,Ui=c({},["audio","video","img","source","image","track"]),go=null,Hi=c({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Dt="http://www.w3.org/1998/Math/MathML",Ct="http://www.w3.org/2000/svg",$="http://www.w3.org/1999/xhtml",Ne=$,bo=!1,yo=null,da=c({},[Dt,Ct,$],Vt),Rt=c({},["mi","mo","mn","ms","mtext"]),Ot=c({},["annotation-xml"]),la=c({},["title","style","font","a","script"]),tt=null,sa=["application/xhtml+xml","text/html"],ua="text/html",S=null,Pe=null,ca=i.createElement("form"),Yi=f(function(o){return o instanceof RegExp||o instanceof Function},"isRegexOrFunction"),_o=f(function(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Pe&&Pe===o)){if((!o||typeof o!="object")&&(o={}),o=Q(o),tt=sa.indexOf(o.PARSER_MEDIA_TYPE)===-1?ua:o.PARSER_MEDIA_TYPE,S=tt==="application/xhtml+xml"?Vt:it,E=H(o,"ALLOWED_TAGS")?c({},o.ALLOWED_TAGS,S):Ci,L=H(o,"ALLOWED_ATTR")?c({},o.ALLOWED_ATTR,S):Ri,yo=H(o,"ALLOWED_NAMESPACES")?c({},o.ALLOWED_NAMESPACES,Vt):da,go=H(o,"ADD_URI_SAFE_ATTR")?c(Q(Hi),o.ADD_URI_SAFE_ATTR,S):Hi,Fi=H(o,"ADD_DATA_URI_TAGS")?c(Q(Ui),o.ADD_DATA_URI_TAGS,S):Ui,Oe=H(o,"FORBID_CONTENTS")?c({},o.FORBID_CONTENTS,S):zi,$e=H(o,"FORBID_TAGS")?c({},o.FORBID_TAGS,S):Q({}),uo=H(o,"FORBID_ATTR")?c({},o.FORBID_ATTR,S):Q({}),Re=H(o,"USE_PROFILES")?o.USE_PROFILES:!1,Oi=o.ALLOW_ARIA_ATTR!==!1,co=o.ALLOW_DATA_ATTR!==!1,Ni=o.ALLOW_UNKNOWN_PROTOCOLS||!1,Pi=o.ALLOW_SELF_CLOSE_IN_ATTR!==!1,De=o.SAFE_FOR_TEMPLATES||!1,It=o.SAFE_FOR_XML!==!1,ge=o.WHOLE_DOCUMENT||!1,Ce=o.RETURN_DOM||!1,Lt=o.RETURN_DOM_FRAGMENT||!1,Mt=o.RETURN_TRUSTED_TYPE||!1,fo=o.FORCE_BODY||!1,Bi=o.SANITIZE_DOM!==!1,Vi=o.SANITIZE_NAMED_PROPS||!1,mo=o.KEEP_CONTENT!==!1,et=o.IN_PLACE||!1,Di=o.ALLOWED_URI_REGEXP||Mo,Ne=o.NAMESPACE||$,Rt=o.MATHML_TEXT_INTEGRATION_POINTS||Rt,Ot=o.HTML_INTEGRATION_POINTS||Ot,v=o.CUSTOM_ELEMENT_HANDLING||{},o.CUSTOM_ELEMENT_HANDLING&&Yi(o.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(v.tagNameCheck=o.CUSTOM_ELEMENT_HANDLING.tagNameCheck),o.CUSTOM_ELEMENT_HANDLING&&Yi(o.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(v.attributeNameCheck=o.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),o.CUSTOM_ELEMENT_HANDLING&&typeof o.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(v.allowCustomizedBuiltInElements=o.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),De&&(co=!1),Lt&&(Ce=!0),Re&&(E=c({},So),L=[],Re.html===!0&&(c(E,Eo),c(L,Io)),Re.svg===!0&&(c(E,Ft),c(L,Yt),c(L,nt)),Re.svgFilters===!0&&(c(E,Ut),c(L,Yt),c(L,nt)),Re.mathMl===!0&&(c(E,Ht),c(L,Lo),c(L,nt))),o.ADD_TAGS&&(typeof o.ADD_TAGS=="function"?Me.tagCheck=o.ADD_TAGS:(E===Ci&&(E=Q(E)),c(E,o.ADD_TAGS,S))),o.ADD_ATTR&&(typeof o.ADD_ATTR=="function"?Me.attributeCheck=o.ADD_ATTR:(L===Ri&&(L=Q(L)),c(L,o.ADD_ATTR,S))),o.ADD_URI_SAFE_ATTR&&c(go,o.ADD_URI_SAFE_ATTR,S),o.FORBID_CONTENTS&&(Oe===zi&&(Oe=Q(Oe)),c(Oe,o.FORBID_CONTENTS,S)),mo&&(E["#text"]=!0),ge&&c(E,["html","head","body"]),E.table&&(c(E,["tbody"]),delete $e.tbody),o.TRUSTED_TYPES_POLICY){if(typeof o.TRUSTED_TYPES_POLICY.createHTML!="function")throw ze('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof o.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ze('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');A=o.TRUSTED_TYPES_POLICY,ae=A.createHTML("")}else A===void 0&&(A=Tn(me,l)),A!==null&&typeof ae=="string"&&(ae=A.createHTML(""));O&&O(o),Pe=o}},"_parseConfig"),Gi=c({},[...Ft,...Ut,...sn]),Qi=c({},[...Ht,...un]),pa=f(function(o){let r=R(o);(!r||!r.tagName)&&(r={namespaceURI:Ne,tagName:"template"});let a=it(o.tagName),b=it(r.tagName);return yo[o.namespaceURI]?o.namespaceURI===Ct?r.namespaceURI===$?a==="svg":r.namespaceURI===Dt?a==="svg"&&(b==="annotation-xml"||Rt[b]):!!Gi[a]:o.namespaceURI===Dt?r.namespaceURI===$?a==="math":r.namespaceURI===Ct?a==="math"&&Ot[b]:!!Qi[a]:o.namespaceURI===$?r.namespaceURI===Ct&&!Ot[b]||r.namespaceURI===Dt&&!Rt[b]?!1:!Qi[a]&&(la[a]||!Gi[a]):!!(tt==="application/xhtml+xml"&&yo[o.namespaceURI]):!1},"_checkValidNamespace"),be=f(function(o){Be(t.removed,{element:o});try{R(o).removeChild(o)}catch{kt(o)}},"_forceRemove"),ye=f(function(o,r){try{Be(t.removed,{attribute:r.getAttributeNode(o),from:r})}catch{Be(t.removed,{attribute:null,from:r})}if(r.removeAttribute(o),o==="is")if(Ce||Lt)try{be(r)}catch{}else try{r.setAttribute(o,"")}catch{}},"_removeAttribute"),qi=f(function(o){let r=null,a=null;if(fo)o=""+o;else{let h=zt(o,/^[\r\n\t ]+/);a=h&&h[0]}tt==="application/xhtml+xml"&&Ne===$&&(o=''+o+"");let b=A?A.createHTML(o):o;if(Ne===$)try{r=new fe().parseFromString(b,tt)}catch{}if(!r||!r.documentElement){r=Se.createDocument(Ne,"template",null);try{r.documentElement.innerHTML=bo?ae:b}catch{}}let M=r.body||r.documentElement;return o&&a&&M.insertBefore(i.createTextNode(a),M.childNodes[0]||null),Ne===$?F.call(r,ge?"html":"body")[0]:ge?r.documentElement:M},"_initDocument"),ji=f(function(o){return Je.call(o.ownerDocument||o,o,w.SHOW_ELEMENT|w.SHOW_COMMENT|w.SHOW_TEXT|w.SHOW_PROCESSING_INSTRUCTION|w.SHOW_CDATA_SECTION,null)},"_createNodeIterator"),ho=f(function(o){return o instanceof pe&&(typeof o.nodeName!="string"||typeof o.textContent!="string"||typeof o.removeChild!="function"||!(o.attributes instanceof ie)||typeof o.removeAttribute!="function"||typeof o.setAttribute!="function"||typeof o.namespaceURI!="string"||typeof o.insertBefore!="function"||typeof o.hasChildNodes!="function")},"_isClobbered"),Wi=f(function(o){return typeof k=="function"&&o instanceof k},"_isNode");function J(o,r,a){ot(o,b=>{b.call(t,r,a,Pe)})}f(J,"_executeHooks");let Zi=f(function(o){let r=null;if(J(_.beforeSanitizeElements,o,null),ho(o))return be(o),!0;let a=S(o.nodeName);if(J(_.uponSanitizeElement,o,{tagName:a,allowedTags:E}),It&&o.hasChildNodes()&&!Wi(o.firstElementChild)&&N(/<[/\w!]/g,o.innerHTML)&&N(/<[/\w!]/g,o.textContent)||o.nodeType===Fe.progressingInstruction||It&&o.nodeType===Fe.comment&&N(/<[/\w]/g,o.data))return be(o),!0;if(!(Me.tagCheck instanceof Function&&Me.tagCheck(a))&&(!E[a]||$e[a])){if(!$e[a]&&Ji(a)&&(v.tagNameCheck instanceof RegExp&&N(v.tagNameCheck,a)||v.tagNameCheck instanceof Function&&v.tagNameCheck(a)))return!1;if(mo&&!Oe[a]){let b=R(o)||o.parentNode,M=Ke(o)||o.childNodes;if(M&&b){let h=M.length;for(let ee=h-1;ee>=0;--ee){let Y=vt(M[ee],!0);Y.__removalCount=(o.__removalCount||0)+1,b.insertBefore(Y,Ze(o))}}}return be(o),!0}return o instanceof x&&!pa(o)||(a==="noscript"||a==="noembed"||a==="noframes")&&N(/<\/no(script|embed|frames)/i,o.innerHTML)?(be(o),!0):(De&&o.nodeType===Fe.text&&(r=o.textContent,ot([U,Ie,Le],b=>{r=Ve(r,b," ")}),o.textContent!==r&&(Be(t.removed,{element:o.cloneNode()}),o.textContent=r)),J(_.afterSanitizeElements,o,null),!1)},"_sanitizeElements"),Ki=f(function(o,r,a){if(Bi&&(r==="id"||r==="name")&&(a in i||a in ca))return!1;if(!(co&&!uo[r]&&N(At,r))&&!(Oi&&N(Et,r))&&!(Me.attributeCheck instanceof Function&&Me.attributeCheck(r,o))){if(!L[r]||uo[r]){if(!(Ji(o)&&(v.tagNameCheck instanceof RegExp&&N(v.tagNameCheck,o)||v.tagNameCheck instanceof Function&&v.tagNameCheck(o))&&(v.attributeNameCheck instanceof RegExp&&N(v.attributeNameCheck,r)||v.attributeNameCheck instanceof Function&&v.attributeNameCheck(r,o))||r==="is"&&v.allowCustomizedBuiltInElements&&(v.tagNameCheck instanceof RegExp&&N(v.tagNameCheck,a)||v.tagNameCheck instanceof Function&&v.tagNameCheck(a))))return!1}else if(!go[r]&&!N(Di,Ve(a,Xe,""))&&!((r==="src"||r==="xlink:href"||r==="href")&&o!=="script"&&dn(a,"data:")===0&&Fi[o])&&!(Ni&&!N(St,Ve(a,Xe,"")))&&a)return!1}return!0},"_isValidAttribute"),Ji=f(function(o){return o!=="annotation-xml"&&zt(o,aa)},"_isBasicCustomElement"),Xi=f(function(o){J(_.beforeSanitizeAttributes,o,null);let{attributes:r}=o;if(!r||ho(o))return;let a={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:L,forceKeepAttr:void 0},b=r.length;for(;b--;){let M=r[b],{name:h,namespaceURI:ee,value:Y}=M,G=S(h),To=Y,D=h==="value"?To:ln(To);if(a.attrName=G,a.attrValue=D,a.keepAttr=!0,a.forceKeepAttr=void 0,J(_.uponSanitizeAttribute,o,a),D=a.attrValue,Vi&&(G==="id"||G==="name")&&(ye(h,o),D=ra+D),It&&N(/((--!?|])>)|<\/(style|title|textarea)/i,D)){ye(h,o);continue}if(G==="attributename"&&zt(D,"href")){ye(h,o);continue}if(a.forceKeepAttr)continue;if(!a.keepAttr){ye(h,o);continue}if(!Pi&&N(/\/>/i,D)){ye(h,o);continue}De&&ot([U,Ie,Le],ma=>{D=Ve(D,ma," ")});let $i=S(o.nodeName);if(!Ki($i,G,D)){ye(h,o);continue}if(A&&typeof me=="object"&&typeof me.getAttributeType=="function"&&!ee)switch(me.getAttributeType($i,G)){case"TrustedHTML":{D=A.createHTML(D);break}case"TrustedScriptURL":{D=A.createScriptURL(D);break}}if(D!==To)try{ee?o.setAttributeNS(ee,h,D):o.setAttribute(h,D),ho(o)?be(o):ko(t.removed)}catch{ye(h,o)}}J(_.afterSanitizeAttributes,o,null)},"_sanitizeAttributes"),fa=f(function o(r){let a=null,b=ji(r);for(J(_.beforeSanitizeShadowDOM,r,null);a=b.nextNode();)J(_.uponSanitizeShadowNode,a,null),Zi(a),Xi(a),a.content instanceof u&&o(a.content);J(_.afterSanitizeShadowDOM,r,null)},"_sanitizeShadowDOM");return t.sanitize=function(o){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=null,b=null,M=null,h=null;if(bo=!o,bo&&(o=""),typeof o!="string"&&!Wi(o))if(typeof o.toString=="function"){if(o=o.toString(),typeof o!="string")throw ze("dirty is not a string, aborting")}else throw ze("toString is not a function");if(!t.isSupported)return o;if(po||_o(r),t.removed=[],typeof o=="string"&&(et=!1),et){if(o.nodeName){let G=S(o.nodeName);if(!E[G]||$e[G])throw ze("root node is forbidden and cannot be sanitized in-place")}}else if(o instanceof k)a=qi(""),b=a.ownerDocument.importNode(o,!0),b.nodeType===Fe.element&&b.nodeName==="BODY"||b.nodeName==="HTML"?a=b:a.appendChild(b);else{if(!Ce&&!De&&!ge&&o.indexOf("<")===-1)return A&&Mt?A.createHTML(o):o;if(a=qi(o),!a)return Ce?null:Mt?ae:""}a&&fo&&be(a.firstChild);let ee=ji(et?o:a);for(;M=ee.nextNode();)Zi(M),Xi(M),M.content instanceof u&&fa(M.content);if(et)return o;if(Ce){if(Lt)for(h=wt.call(a.ownerDocument);a.firstChild;)h.appendChild(a.firstChild);else h=a;return(L.shadowroot||L.shadowrootmode)&&(h=X.call(n,h,!0)),h}let Y=ge?a.outerHTML:a.innerHTML;return ge&&E["!doctype"]&&a.ownerDocument&&a.ownerDocument.doctype&&a.ownerDocument.doctype.name&&N(Do,a.ownerDocument.doctype.name)&&(Y=""+Y),De&&ot([U,Ie,Le],G=>{Y=Ve(Y,G," ")}),A&&Mt?A.createHTML(Y):Y},t.setConfig=function(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};_o(o),po=!0},t.clearConfig=function(){Pe=null,po=!1},t.isValidAttribute=function(o,r,a){Pe||_o({});let b=S(o),M=S(r);return Ki(b,M,a)},t.addHook=function(o,r){typeof r=="function"&&Be(_[o],r)},t.removeHook=function(o,r){if(r!==void 0){let a=an(_[o],r);return a===-1?void 0:rn(_[o],a,1)[0]}return ko(_[o])},t.removeHooks=function(o){_[o]=[]},t.removeAllHooks=function(){_=Ro()},t}f(Gt,"createDOMPurify");var Oo=Gt();let Ue=!1;window.trustedTypes&&window.trustedTypes.createPolicy&&Oo&&(Ue=window.trustedTypes.createPolicy("GoodTubePolicy",{createHTML:e=>Oo.sanitize(e,{RETURN_TRUSTED_TYPE:!0})}));function No(){let e={};if(document.location.search.replace(/\??(?:([^=]+)=([^&]*)&?)/g,function(){function t(i){return decodeURIComponent(i.split("+").join(" "))}e[t(arguments[1])]=t(arguments[2])}),z()&&typeof e.v>"u"){let t="";window.location.href.indexOf("/watch/")!==-1?t="/watch/":t="/live/";let i=window.location.href.split(t);if(i.length===2){let n=i[1].split("?");e.v=n[n.length-1]}}return e}function p(e,t,i=399){e=e+"_new",document.cookie=e+"="+encodeURIComponent(t)+";SameSite=Lax;path=/;max-age="+i*24*60*60}function P(e){e=e+"_new";let t=document.cookie.split(";");for(let i=0;i
- +
@@ -193,15 +193,32 @@
- + + +
+ +
+
-
- +
+
+
+ + +
+
@@ -211,7 +228,7 @@
This adblocker is 100% free to use and always will be.
- It has helped over 170,000 people remove the unbearable ads from Youtube.

+ It has helped over 175,000 people remove the unbearable ads from Youtube.

This project has been made entirely by myself, as just one developer. Countless hours and late nights have gone into making this and I continue to work on updating and maintaining the project regularly. I remain dedicated to ensuring this solution continues to work for everyone (despite Youtube's best efforts to stop adblockers).

@@ -266,7 +283,7 @@
- `);let w=document.createElement("style");w.textContent=` + `);let kt=document.createElement("style");kt.textContent=` /* Menu button ---------------------------------------------------------------------------------------------------- */ .goodTube_menuButton { @@ -486,7 +503,7 @@ .goodTube_modal .goodTube_content .goodTube_setting input { width: 24px; - height: 24x; + height: 24px; min-width: 24px; min-height: 24px; border-radius: 4px; @@ -495,6 +512,27 @@ cursor: pointer; } + .goodTube_modal .goodTube_content .goodTube_setting select { + border-radius: 4px; + border: 1px solid #999; + width: 100%; + font-size: 14px; + color: #000000; + padding-top: 8px; + padding-bottom: 8px; + padding-left: 8px; + padding-right: 16px; + font-family: Roboto, Arial, sans-serif; + transition: border .2s linear; + width: 96px; + min-width: 96px; + font-weight: 400; + } + + .goodTube_modal .goodTube_content .goodTube_setting select { + border: 1px solid #333; + } + .goodTube_modal .goodTube_content .goodTube_setting label { font-size: 15px; color: #000000; @@ -592,7 +630,7 @@ margin-bottom: 16px; height: 128px; } - `,document.head.appendChild(w);let oe=document.querySelector(".goodTube_menuButton"),ie=document.querySelector(".goodTube_menuClose");ie&&ie.addEventListener("click",()=>{oe.remove(),ie.remove()});let C=document.querySelector(".goodTube_modal"),ce=document.querySelector(".goodTube_modal .goodTube_modal_overlay"),ae=document.querySelector(".goodTube_modal .goodTube_modal_closeButton");oe&&oe.addEventListener("click",()=>{if(C){let U=document.querySelector(".goodTube_report");U&&(U.style.display="block");let H=document.querySelector(".goodTube_successText");H&&(H.style.display="none");let _=document.querySelector(".goodTube_reportEmail");_&&(_.value="");let B=document.querySelector(".goodTube_reportText");B&&(B.value=""),C.classList.add("visible")}}),ce&&ce.addEventListener("click",()=>{C&&C.classList.contains("visible")&&C.classList.remove("visible")}),ae&&ae.addEventListener("click",()=>{C&&C.classList.contains("visible")&&C.classList.remove("visible")}),document.addEventListener("keydown",U=>{U.key.toLowerCase()==="escape"&&C&&C.classList.contains("visible")&&C.classList.remove("visible")});let ft=document.getElementById("goodTube_button_saveSettings");ft&&ft.addEventListener("click",()=>{let U=document.querySelector(".goodTube_option_shorts");U&&(U.checked?p("goodTube_shorts","false"):p("goodTube_shorts","true"));let H=document.querySelector(".goodTube_option_hideInfoCards");H&&(H.checked?p("goodTube_hideInfoCards","true"):p("goodTube_hideInfoCards","false"));let _=document.querySelector(".goodTube_option_hideEndScreen");_&&(_.checked?p("goodTube_hideEndScreen","true"):p("goodTube_hideEndScreen","false"));let B=document.querySelector(".goodTube_option_hideSuggestedVideos");B&&(B.checked?p("goodTube_hideSuggestedVideos","true"):p("goodTube_hideSuggestedVideos","false"));let we=document.querySelector(".goodTube_option_hideComments");we&&(we.checked?p("goodTube_hideComments","true"):p("goodTube_hideComments","false"));let gt=document.querySelector(".goodTube_option_hideAiSummaries");gt&&(gt.checked?p("goodTube_hideAiSummaries","true"):p("goodTube_hideAiSummaries","false"));let bt=document.querySelector(".goodTube_option_alwaysStart");bt&&(bt.checked?p("goodTube_alwaysStart","true"):p("goodTube_alwaysStart","false"));let yt=document.querySelector(".goodTube_option_blackBackground");yt&&(yt.checked?p("goodTube_blackBackground","true"):p("goodTube_blackBackground","false")),window.location.href=window.location.href});let Ye=document.querySelector(".goodTube_report"),mt=document.querySelector(".goodTube_successText");Ye&&mt&&Ye.addEventListener("submit",U=>{U.preventDefault(),U.stopImmediatePropagation();let H={email:document.querySelector(".goodTube_reportEmail")?.value,message:document.querySelector(".goodTube_reportText")?.value},_={method:"POST",body:JSON.stringify(H),headers:{"Content-Type":"application/json; charset=UTF-8"},referrerPolicy:"no-referrer"};fetch("https://jamenlyndon.com/_other/stats/mail.php",_).then(B=>B.text()).then(B=>{Ye.style.display="none",mt.style.display="block"})})}function La(){window.addEventListener("focus",()=>{Vt=!0}),window.addEventListener("blur",()=>{Vt=!1})}function Da(){let e=document.createElement("style"),t=` + `,document.head.appendChild(kt);let Ze=document.querySelector(".goodTube_menuButton"),Ke=document.querySelector(".goodTube_menuClose");Ke&&Ke.addEventListener("click",()=>{Ze.remove(),Ke.remove()});let R=document.querySelector(".goodTube_modal"),A=document.querySelector(".goodTube_modal .goodTube_modal_overlay"),ae=document.querySelector(".goodTube_modal .goodTube_modal_closeButton");Ze&&Ze.addEventListener("click",()=>{if(R){let F=document.querySelector(".goodTube_report");F&&(F.style.display="block");let X=document.querySelector(".goodTube_successText");X&&(X.style.display="none");let _=document.querySelector(".goodTube_reportEmail");_&&(_.value="");let U=document.querySelector(".goodTube_reportText");U&&(U.value=""),R.classList.add("visible")}}),A&&A.addEventListener("click",()=>{R&&R.classList.contains("visible")&&R.classList.remove("visible")}),ae&&ae.addEventListener("click",()=>{R&&R.classList.contains("visible")&&R.classList.remove("visible")}),document.addEventListener("keydown",F=>{F.key.toLowerCase()==="escape"&&R&&R.classList.contains("visible")&&R.classList.remove("visible")});let Se=document.getElementById("goodTube_button_saveSettings");Se&&Se.addEventListener("click",()=>{let F=document.querySelector(".goodTube_option_shorts");F&&(F.checked?p("goodTube_shorts","false"):p("goodTube_shorts","true"));let X=document.querySelector(".goodTube_option_hideInfoCards");X&&(X.checked?p("goodTube_hideInfoCards","true"):p("goodTube_hideInfoCards","false"));let _=document.querySelector(".goodTube_option_hideEndScreen");_&&(_.checked?p("goodTube_hideEndScreen","true"):p("goodTube_hideEndScreen","false"));let U=document.querySelector(".goodTube_option_hideSuggestedVideos");U&&(U.checked?p("goodTube_hideSuggestedVideos","true"):p("goodTube_hideSuggestedVideos","false"));let Ie=document.querySelector(".goodTube_option_hideComments");Ie&&(Ie.checked?p("goodTube_hideComments","true"):p("goodTube_hideComments","false"));let Le=document.querySelector(".goodTube_option_hideAiSummaries");Le&&(Le.checked?p("goodTube_hideAiSummaries","true"):p("goodTube_hideAiSummaries","false"));let At=document.querySelector(".goodTube_option_hideMembersOnlyVideos");At&&(At.checked?p("goodTube_hideMembersOnlyVideos","true"):p("goodTube_hideMembersOnlyVideos","false"));let Et=document.querySelector(".goodTube_option_alwaysStart");Et&&(Et.checked?p("goodTube_alwaysStart","true"):p("goodTube_alwaysStart","false"));let St=document.querySelector(".goodTube_option_blackBackground");St&&(St.checked?p("goodTube_blackBackground","true"):p("goodTube_blackBackground","false"));let Xe=document.querySelector(".goodTube_option_videosPerRow");Xe&&p("goodTube_videosPerRow",Xe.value.toString().toLowerCase()),window.location.href=window.location.href});let Je=document.querySelector(".goodTube_report"),wt=document.querySelector(".goodTube_successText");Je&&wt&&Je.addEventListener("submit",F=>{F.preventDefault(),F.stopImmediatePropagation();let X={email:document.querySelector(".goodTube_reportEmail")?.value,message:document.querySelector(".goodTube_reportText")?.value},_={method:"POST",body:JSON.stringify(X),headers:{"Content-Type":"application/json; charset=UTF-8"},referrerPolicy:"no-referrer"};fetch("https://jamenlyndon.com/_other/stats/mail.php",_).then(U=>U.text()).then(U=>{Je.style.display="none",wt.style.display="block"})})}function zn(){window.addEventListener("focus",()=>{Wt=!0}),window.addEventListener("blur",()=>{Wt=!1})}function Fn(){let e=document.createElement("style"),t=` .ytp-skip-ad-button { bottom: 48px !important; right: 32px !important; @@ -665,16 +703,16 @@ .ytp-pip-button { display: inline-block !important; } - `),ze==="true"&&(t+=` + `),Ge==="true"&&(t+=` .ytp-ce-covering-overlay, .ytp-ce-element { display: none !important; } - `),Fe==="true"&&(t+=` + `),Qe==="true"&&(t+=` .ytp-videowall-still { display: none !important; } - `),e.textContent=t,document.head.appendChild(e);function i(a){if(!F()||re!=="enabled"||a.ctrlKey||a.altKey||a.metaKey)return;let l=a.key.toLowerCase(),u=a.srcElement,m=!1,k=!1;u&&(typeof u.nodeName<"u"&&(m=u.nodeName.toLowerCase()),typeof u.getAttribute<"u"&&(k=u.getAttribute("id"))),(!u||m.indexOf("input")===-1&&m.indexOf("label")===-1&&m.indexOf("select")===-1&&m.indexOf("textarea")===-1&&m.indexOf("fieldset")===-1&&m.indexOf("legend")===-1&&m.indexOf("datalist")===-1&&m.indexOf("output")===-1&&m.indexOf("option")===-1&&m.indexOf("optgroup")===-1&&k!=="contenteditable-root")&&(l===" "||l==="k"||l==="m"||l==="i")&&(a.preventDefault(),a.stopImmediatePropagation())}document.addEventListener("keydown",i,!0),document.addEventListener("keypress",i,!0),document.addEventListener("keyup",i,!0),Wo()}function Ma(){y&&F()?Ot()?Ca():Ra():re=""}let re="";function Ca(){let e=document.getElementById("goodTube_hideMuteAdsOverlay");if(re==="enabled"&&e)return;let t=document.querySelector("#movie_player video");t&&(t.playbackRate=2,t.muted=!0,t.volume=0,J(t));let i=document.querySelector(".ytp-chrome-bottom");i&&J(i);let a=document.getElementById("movie_player");a&&(a.style.pointerEvents="none");let l=document.querySelector(".ytp-caption-window-container");if(a&&J(l),!e){let u=document.createElement("div");u.setAttribute("id","goodTube_hideMuteAdsOverlay"),Je(u,` + `),e.textContent=t,document.head.appendChild(e);function i(n){if(!z()||de!=="enabled"||n.ctrlKey||n.altKey||n.metaKey)return;let l=n.key.toLowerCase(),u=n.srcElement,m=!1,k=!1;u&&(typeof u.nodeName<"u"&&(m=u.nodeName.toLowerCase()),typeof u.getAttribute<"u"&&(k=u.getAttribute("id"))),(!u||m.indexOf("input")===-1&&m.indexOf("label")===-1&&m.indexOf("select")===-1&&m.indexOf("textarea")===-1&&m.indexOf("fieldset")===-1&&m.indexOf("legend")===-1&&m.indexOf("datalist")===-1&&m.indexOf("output")===-1&&m.indexOf("option")===-1&&m.indexOf("optgroup")===-1&&k!=="contenteditable-root")&&(l===" "||l==="k"||l==="m"||l==="i")&&(n.preventDefault(),n.stopImmediatePropagation())}document.addEventListener("keydown",i,!0),document.addEventListener("keypress",i,!0),document.addEventListener("keyup",i,!0),ii()}function Un(){y&&z()?Qt()?Hn():Yn():de=""}let de="";function Hn(){let e=document.getElementById("goodTube_hideMuteAdsOverlay");if(de==="enabled"&&e)return;let t=document.querySelector("#movie_player video");t&&(t.playbackRate=2,t.muted=!0,t.volume=0,j(t));let i=document.querySelector(".ytp-chrome-bottom");i&&j(i);let n=document.getElementById("movie_player");n&&(n.style.pointerEvents="none");let l=document.querySelector(".ytp-caption-window-container");if(n&&j(l),!e){let u=document.createElement("div");u.setAttribute("id","goodTube_hideMuteAdsOverlay"),rt(u,`
@@ -682,7 +720,7 @@
Hang tight. Click the skip button if it appears to speed things up.
- `);let m=document.querySelector(".ytp-ad-player-overlay-layout");m&&m.prepend(u)}Gt(!0),re="enabled"}function Ra(){if(re==="disabled")return;let e=document.querySelector("#movie_player video");e&&(e.playbackRate=ye,d=document.getElementById("movie_player"),d&&typeof d.unMute=="function"&&typeof d.setVolume=="function"&&typeof d.getVolume=="function"&&(e.volume<=0||e.muted||d.getVolume()===0)&&(e.muted=!1,e.volume=1,d.unMute(),d.setVolume(100)),Ke(e));let t=document.querySelector(".ytp-chrome-bottom");t&&Ke(t);let i=document.getElementById("movie_player");i&&(i.style.pointerEvents="auto");let a=document.querySelector(".ytp-caption-window-container");i&&Ke(a);let l=document.getElementById("goodTube_hideMuteAdsOverlay");l&&l.remove(),Gt(),re="disabled"}let qo=setTimeout(()=>{},0);function Wo(){let e=document.querySelector("#movie_player .ytp-autonav-toggle-button");e?e.addEventListener("click",()=>{let t="true";e.getAttribute("aria-checked")==="true"&&(t="false"),p("goodTube_autoplay",t),P.contentWindow.postMessage("goodTube_autoplay_"+t,"*")}):(clearTimeout(qo),qo=setTimeout(Wo,100))}let Zo=setTimeout(()=>{},0);function Ko(){let e=document.querySelector("#movie_player .ytp-autonav-toggle-button");e&&e.checkVisibility()?e.getAttribute("aria-checked")!==W&&q(e):(clearTimeout(Zo),Zo=setTimeout(Ko,100))}let Jo=setTimeout(()=>{},0);function Gt(e=!1){if(!(!y||!F())&&(d=document.getElementById("movie_player"),d&&typeof d.playVideo=="function"&&typeof d.mute=="function"&&typeof d.setVolume=="function")){let t=document.querySelector("#movie_player video");if(d.playVideo(),e&&(d.mute(),d.setVolume(0)),t){e&&(t.muted=!0,t.volume=0);let i=t.currentTime;clearTimeout(Jo),Jo=setTimeout(()=>{t.currentTime===i&&Gt()},100)}}}let Xo=!1,$o=setTimeout(()=>{},0);function ei(e=!1){e||(window.addEventListener("message",ut),document.addEventListener("DOMContentLoaded",lt),(document.readyState==="interactive"||document.readyState==="complete")&<()),!document.body||!document.head?(clearTimeout($o),$o=setTimeout(()=>{ei(!0)},1)):lt()}let ti=setTimeout(()=>{},0);function lt(){s=document.getElementById("movie_player");let e=!1;if(s&&typeof s.getVideoData=="function"&&(e=s.getVideoData()),!e){clearTimeout(ti),ti=setTimeout(lt,1);return}Xo||(Xo=!0,Pa(),ni(),di(),za(),ve(),Ya(),setInterval(_i,5e3),Oa(),oi(),setInterval(oi,100),window.top.postMessage("goodTube_playerIframe_loaded","*"))}function oi(){Na(),Ha(),Ba(),Ga(),T.goodTube_playlist!=="undefined"&&T.goodTube_playlist==="true"&&ii(),Qa()}function Na(){document.querySelector(".ytp-error")?y||(y=!0,window.top.postMessage("goodTube_fallback_enable","*"),ve(),clearTimeout(ct)):y&&(y=!1,window.top.postMessage("goodTube_fallback_disable","*"),ve(),clearTimeout(ct))}function Oa(){typeof T.goodTube_playbackSpeed<"u"&&s&&typeof s.setPlaybackRate=="function"&&s.setPlaybackRate(parseFloat(T.goodTube_playbackSpeed)),setInterval(()=>{s&&typeof s.getPlaybackRate=="function"&&window.top.postMessage("goodTube_playbackSpeed_"+s.getPlaybackRate(),"*")},100)}function Ba(){document.querySelectorAll(".ytp-videowall-still:not(.goodTube_fixed), .ytp-ce-covering-overlay:not(.goodTube_fixed)").forEach(t=>{t.addEventListener("click",i=>{i.preventDefault(),i.stopImmediatePropagation(),window.top.location.href=t.href},!0),t.addEventListener("mousedown",i=>{i.button===0&&(i.preventDefault(),i.stopImmediatePropagation())},!0),t.addEventListener("mouseup",i=>{i.button===0&&(i.preventDefault(),i.stopImmediatePropagation())},!0),t.addEventListener("touchstart",i=>{i.preventDefault(),i.stopImmediatePropagation()},!0),t.addEventListener("touchend",i=>{i.preventDefault(),i.stopImmediatePropagation()},!0),t.classList.add("goodTube_fixed")})}function Pa(){let e=document.createElement("style"),t=` + `);let m=document.querySelector(".ytp-ad-player-overlay-layout");m&&m.prepend(u)}eo(!0),de="enabled"}function Yn(){if(de==="disabled")return;let e=document.querySelector("#movie_player video");e&&(e.playbackRate=Te,d=document.getElementById("movie_player"),d&&typeof d.unMute=="function"&&typeof d.setVolume=="function"&&typeof d.getVolume=="function"&&(e.volume<=0||e.muted||d.getVolume()===0)&&(e.muted=!1,e.volume=1,d.unMute(),d.setVolume(100)),at(e));let t=document.querySelector(".ytp-chrome-bottom");t&&at(t);let i=document.getElementById("movie_player");i&&(i.style.pointerEvents="auto");let n=document.querySelector(".ytp-caption-window-container");i&&at(n);let l=document.getElementById("goodTube_hideMuteAdsOverlay");l&&l.remove(),eo(),de="disabled"}let oi=setTimeout(()=>{},0);function ii(){let e=document.querySelector("#movie_player .ytp-autonav-toggle-button");e?e.addEventListener("click",()=>{let t="true";e.getAttribute("aria-checked")==="true"&&(t="false"),p("goodTube_autoplay",t),B.contentWindow.postMessage("goodTube_autoplay_"+t,"*")}):(clearTimeout(oi),oi=setTimeout(ii,100))}let ni=setTimeout(()=>{},0);function ai(){let e=document.querySelector("#movie_player .ytp-autonav-toggle-button");e&&e.checkVisibility()?e.getAttribute("aria-checked")!==Z&&q(e):(clearTimeout(ni),ni=setTimeout(ai,100))}let ri=setTimeout(()=>{},0);function eo(e=!1){if(!(!y||!z())&&(d=document.getElementById("movie_player"),d&&typeof d.playVideo=="function"&&typeof d.mute=="function"&&typeof d.setVolume=="function")){let t=document.querySelector("#movie_player video");if(d.playVideo(),e&&(d.mute(),d.setVolume(0)),t){e&&(t.muted=!0,t.volume=0);let i=t.currentTime;clearTimeout(ri),ri=setTimeout(()=>{t.currentTime===i&&eo()},100)}}}let di=!1,li=setTimeout(()=>{},0);function si(e=!1){e||(window.addEventListener("message",ht),document.addEventListener("DOMContentLoaded",yt),(document.readyState==="interactive"||document.readyState==="complete")&&yt()),!document.body||!document.head?(clearTimeout(li),li=setTimeout(()=>{si(!0)},1)):yt()}let ui=setTimeout(()=>{},0);function yt(){s=document.getElementById("movie_player");let e=!1;if(s&&typeof s.getVideoData=="function"&&(e=s.getVideoData()),!e){clearTimeout(ui),ui=setTimeout(yt,1);return}di||(di=!0,jn(),mi(),bi(),Zn(),Ae(),$n(),setInterval(Si,5e3),Qn(),ci(),setInterval(ci,100),window.top.postMessage("goodTube_playerIframe_loaded","*"))}function ci(){Gn(),Xn(),qn(),ea(),T.goodTube_playlist!=="undefined"&&T.goodTube_playlist==="true"&&pi(),ta()}function Gn(){document.querySelector(".ytp-error")?y||(y=!0,window.top.postMessage("goodTube_fallback_enable","*"),Ae(),clearTimeout(Tt)):y&&(y=!1,window.top.postMessage("goodTube_fallback_disable","*"),Ae(),clearTimeout(Tt))}function Qn(){typeof T.goodTube_playbackSpeed<"u"&&s&&typeof s.setPlaybackRate=="function"&&s.setPlaybackRate(parseFloat(T.goodTube_playbackSpeed)),setInterval(()=>{s&&typeof s.getPlaybackRate=="function"&&window.top.postMessage("goodTube_playbackSpeed_"+s.getPlaybackRate(),"*")},100)}function qn(){document.querySelectorAll(".ytp-videowall-still:not(.goodTube_fixed), .ytp-ce-covering-overlay:not(.goodTube_fixed)").forEach(t=>{t.addEventListener("click",i=>{i.preventDefault(),i.stopImmediatePropagation(),window.top.location.href=t.href},!0),t.addEventListener("mousedown",i=>{i.button===0&&(i.preventDefault(),i.stopImmediatePropagation())},!0),t.addEventListener("mouseup",i=>{i.button===0&&(i.preventDefault(),i.stopImmediatePropagation())},!0),t.addEventListener("touchstart",i=>{i.preventDefault(),i.stopImmediatePropagation()},!0),t.addEventListener("touchend",i=>{i.preventDefault(),i.stopImmediatePropagation()},!0),t.classList.add("goodTube_fixed")})}function jn(){let e=document.createElement("style"),t=` /* Hide unwanted stuff */ .ytp-gradient-top, .ytp-show-cards-title, @@ -821,9 +859,9 @@ .ytp-videowall-still { display: none !important; } - `),e.textContent=t,document.head.appendChild(e)}function ii(){let e=document.querySelector(".ytp-prev-button");e&&!e.classList.contains("goodTube_visible")&&e.classList.add("goodTube_visible")}function Va(){let e=document.querySelector(".ytp-prev-button");e&&e.classList.contains("goodTube_visible")&&e.classList.remove("goodTube_visible")}let ai=setTimeout(()=>{},0);function ni(){if(!document.querySelector(".ytp-play-button")){clearTimeout(ai),ai=setTimeout(ni,100);return}let t=document.querySelector(".ytp-prev-button");t&&t.addEventListener("click",function(){window.top.postMessage("goodTube_prevVideo","*")});let i=document.querySelector(".ytp-next-button");i&&i.addEventListener("click",function(){window.top.postMessage("goodTube_nextVideo","*")});let a=document.querySelector(".ytp-size-button");a&&(a.setAttribute("data-tooltip-target-id","ytp-size-button"),a.setAttribute("data-title-no-tooltip","Theater mode (t)"),a.setAttribute("aria-label","Theater mode (t)"),a.setAttribute("title","Theater mode (t)"),a.setAttribute("data-tooltip-title","Theater mode (t)"),Je(a,` + `),e.textContent=t,document.head.appendChild(e)}function pi(){let e=document.querySelector(".ytp-prev-button");e&&!e.classList.contains("goodTube_visible")&&e.classList.add("goodTube_visible")}function Wn(){let e=document.querySelector(".ytp-prev-button");e&&e.classList.contains("goodTube_visible")&&e.classList.remove("goodTube_visible")}let fi=setTimeout(()=>{},0);function mi(){if(!document.querySelector(".ytp-play-button")){clearTimeout(fi),fi=setTimeout(mi,100);return}let t=document.querySelector(".ytp-prev-button");t&&t.addEventListener("click",function(){window.top.postMessage("goodTube_prevVideo","*")});let i=document.querySelector(".ytp-next-button");i&&i.addEventListener("click",function(){window.top.postMessage("goodTube_nextVideo","*")});let n=document.querySelector(".ytp-size-button");n&&(n.setAttribute("data-tooltip-target-id","ytp-size-button"),n.setAttribute("data-title-no-tooltip","Theater mode (t)"),n.setAttribute("aria-label","Theater mode (t)"),n.setAttribute("title","Theater mode (t)"),n.setAttribute("data-tooltip-title","Theater mode (t)"),rt(n,` - `),a.addEventListener("click",function(){window.top.postMessage("goodTube_theater","*")}));let l=document.querySelector(".ytp-subtitles-button");if(l){fa(l,"beforebegin",'');let u=document.querySelector("#goodTube_autoplayButton");u&&u.addEventListener("click",function(){let m=u.querySelector(".ytp-autonav-toggle-button");m.getAttribute("aria-checked")==="true"?(m.setAttribute("aria-checked","false"),window.top.postMessage("goodTube_autoplay_false","*")):(m.setAttribute("aria-checked","true"),window.top.postMessage("goodTube_autoplay_true","*"))})}}let ri=setTimeout(()=>{},0);function di(){let e=document.querySelector("#movie_player video");if(!e){clearTimeout(ri),ri=setTimeout(di,100);return}e.addEventListener("ended",function(){_i(!0),window.top.postMessage("goodTube_videoEnded","*")})}function za(){document.addEventListener("keydown",function(e){if(e.ctrlKey||e.altKey||e.metaKey||y)return;let t=e.key.toLowerCase();if(t==="t"&&window.top.postMessage("goodTube_theater","*"),t==="i"){let i=document.querySelector(".ytp-pip-button");i&&q(i)}else t==="p"&&e.shiftKey||t==="mediatrackprevious"?window.top.postMessage("goodTube_prevVideo","*"):(t==="n"&&e.shiftKey||t==="mediatracknext")&&window.top.postMessage("goodTube_nextVideo","*")})}let te=setTimeout(()=>{},0),Z=!1,de=-1,le=!1,se=!1,ue=!1,g=document.querySelector("video"),S=document.querySelector(".goodTube_doubleSpeed");function Qt(e){let t=e.key.toLowerCase();if(t===" "||t==="k"){if(y)return;if(se){e.preventDefault(),e.stopImmediatePropagation();return}if(e.ctrlKey||e.altKey||e.metaKey||(e.preventDefault(),e.stopImmediatePropagation(),Z)||le)return;le=!0,de=s.getPlaybackRate(),clearTimeout(te),te=setTimeout(()=>{s.setPlaybackRate(2),s.playVideo(),S.style.display="block",Z=!0},1e3)}}function jt(e){let t=e.key.toLowerCase();if(t===" "||t==="k"){if(y)return;if(se){e.preventDefault(),e.stopImmediatePropagation();return}if(e.ctrlKey||e.altKey||e.metaKey)return;e.preventDefault(),e.stopImmediatePropagation()}}function qt(e){let t=e.key.toLowerCase();if(t===" "||t==="k"){if(y)return;if(se){e.preventDefault(),e.stopImmediatePropagation();return}if(e.ctrlKey||e.altKey||e.metaKey)return;clearTimeout(te),Z?(s.setPlaybackRate(de),S.style.display="none",Z=!1):(g=document.querySelector("video"),ue=!0,q(g),ue=!1),le=!1,e.preventDefault(),e.stopImmediatePropagation()}}function he(e){if(e.button===0&&!ue&&!y){if(le){e.preventDefault(),e.stopImmediatePropagation();return}se=!0,e.preventDefault(),e.stopImmediatePropagation(),de=s.getPlaybackRate(),clearTimeout(te),te=setTimeout(()=>{s.setPlaybackRate(2),s.playVideo(),S.style.display="block",Z=!0},1e3)}}function Wt(e){ue||y||(e.preventDefault(),e.stopImmediatePropagation())}function Te(e){if(e.button===0&&!ue&&!y){if(le){e.preventDefault(),e.stopImmediatePropagation();return}clearTimeout(te),Z?(s.setPlaybackRate(de),S.style.display="none",Z=!1):(g=document.querySelector("video"),ue=!0,q(g),ue=!1,setTimeout(g.focus())),se=!1,e.preventDefault(),e.stopImmediatePropagation()}}function xe(e){if(!y){if(le){e.preventDefault(),e.stopImmediatePropagation();return}e.preventDefault(),e.stopImmediatePropagation(),clearTimeout(te),Z&&(s.setPlaybackRate(de),S.style.display="none",Z=!1),se=!1}}let st=setTimeout(()=>{},0);function ve(){if(clearTimeout(te),Z=!1,le=!1,se=!1,g=document.querySelector("video"),S=document.querySelector(".goodTube_doubleSpeed"),y){document.removeEventListener("keydown",Qt,!0),document.removeEventListener("keypress",jt,!0),document.removeEventListener("keyup",qt,!0),g&&(g.removeEventListener("mousedown",he,!0),g.removeEventListener("touchstart",he,!0),g.removeEventListener("click",Wt,!0),g.removeEventListener("mouseup",Te,!0),g.removeEventListener("touchend",Te,!0),g.removeEventListener("mouseout",xe,!0),g.removeEventListener("touchcancel",xe,!0)),S&&(S.style.display="none");return}if(!g){clearTimeout(st),st=setTimeout(ve,100);return}if(s=document.getElementById("movie_player"),!s||typeof s.getPlaybackRate!="function"||typeof s.setPlaybackRate!="function"||typeof s.playVideo!="function"){clearTimeout(st),st=setTimeout(ve,100);return}if(de=s.getPlaybackRate(),s.setPlaybackRate(de),S)S.style.display="none";else{S=document.createElement("div"),S.classList.add("goodTube_doubleSpeed"),S.style.position="relative",S.style.zIndex="999",S.style.display="none",Je(S,` + `),n.addEventListener("click",function(){window.top.postMessage("goodTube_theater","*")}));let l=document.querySelector(".ytp-subtitles-button");if(l){vn(l,"beforebegin",'');let u=document.querySelector("#goodTube_autoplayButton");u&&u.addEventListener("click",function(){let m=u.querySelector(".ytp-autonav-toggle-button");m.getAttribute("aria-checked")==="true"?(m.setAttribute("aria-checked","false"),window.top.postMessage("goodTube_autoplay_false","*")):(m.setAttribute("aria-checked","true"),window.top.postMessage("goodTube_autoplay_true","*"))})}}let gi=setTimeout(()=>{},0);function bi(){let e=document.querySelector("#movie_player video");if(!e){clearTimeout(gi),gi=setTimeout(bi,100);return}e.addEventListener("ended",function(){Si(!0),window.top.postMessage("goodTube_videoEnded","*")})}function Zn(){document.addEventListener("keydown",function(e){if(e.ctrlKey||e.altKey||e.metaKey||y)return;let t=e.key.toLowerCase();if(t==="t"&&window.top.postMessage("goodTube_theater","*"),t==="i"){let i=document.querySelector(".ytp-pip-button");i&&q(i)}else t==="p"&&e.shiftKey||t==="mediatrackprevious"?window.top.postMessage("goodTube_prevVideo","*"):(t==="n"&&e.shiftKey||t==="mediatracknext")&&window.top.postMessage("goodTube_nextVideo","*")})}let oe=setTimeout(()=>{},0),K=!1,le=-1,se=!1,ue=!1,ce=!1,g=document.querySelector("video"),I=document.querySelector(".goodTube_doubleSpeed");function to(e){let t=e.key.toLowerCase();if(t===" "||t==="k"){if(y)return;if(ue){e.preventDefault(),e.stopImmediatePropagation();return}if(e.ctrlKey||e.altKey||e.metaKey||(e.preventDefault(),e.stopImmediatePropagation(),K)||se)return;se=!0,le=s.getPlaybackRate(),clearTimeout(oe),oe=setTimeout(()=>{s.setPlaybackRate(2),s.playVideo(),I.style.display="block",K=!0},1e3)}}function oo(e){let t=e.key.toLowerCase();if(t===" "||t==="k"){if(y)return;if(ue){e.preventDefault(),e.stopImmediatePropagation();return}if(e.ctrlKey||e.altKey||e.metaKey)return;e.preventDefault(),e.stopImmediatePropagation()}}function io(e){let t=e.key.toLowerCase();if(t===" "||t==="k"){if(y)return;if(ue){e.preventDefault(),e.stopImmediatePropagation();return}if(e.ctrlKey||e.altKey||e.metaKey)return;clearTimeout(oe),K?(s.setPlaybackRate(le),I.style.display="none",K=!1):(g=document.querySelector("video"),ce=!0,q(g),ce=!1),se=!1,e.preventDefault(),e.stopImmediatePropagation()}}function ve(e){if(e.button===0&&!ce&&!y){if(se){e.preventDefault(),e.stopImmediatePropagation();return}ue=!0,e.preventDefault(),e.stopImmediatePropagation(),le=s.getPlaybackRate(),clearTimeout(oe),oe=setTimeout(()=>{s.setPlaybackRate(2),s.playVideo(),I.style.display="block",K=!0},1e3)}}function no(e){ce||y||(e.preventDefault(),e.stopImmediatePropagation())}function ke(e){if(e.button===0&&!ce&&!y){if(se){e.preventDefault(),e.stopImmediatePropagation();return}clearTimeout(oe),K?(s.setPlaybackRate(le),I.style.display="none",K=!1):(g=document.querySelector("video"),ce=!0,q(g),ce=!1,setTimeout(g.focus())),ue=!1,e.preventDefault(),e.stopImmediatePropagation()}}function we(e){if(!y){if(se){e.preventDefault(),e.stopImmediatePropagation();return}e.preventDefault(),e.stopImmediatePropagation(),clearTimeout(oe),K&&(s.setPlaybackRate(le),I.style.display="none",K=!1),ue=!1}}let _t=setTimeout(()=>{},0);function Ae(){if(clearTimeout(oe),K=!1,se=!1,ue=!1,g=document.querySelector("video"),I=document.querySelector(".goodTube_doubleSpeed"),y){document.removeEventListener("keydown",to,!0),document.removeEventListener("keypress",oo,!0),document.removeEventListener("keyup",io,!0),g&&(g.removeEventListener("mousedown",ve,!0),g.removeEventListener("touchstart",ve,!0),g.removeEventListener("click",no,!0),g.removeEventListener("mouseup",ke,!0),g.removeEventListener("touchend",ke,!0),g.removeEventListener("mouseout",we,!0),g.removeEventListener("touchcancel",we,!0)),I&&(I.style.display="none");return}if(!g){clearTimeout(_t),_t=setTimeout(Ae,100);return}if(s=document.getElementById("movie_player"),!s||typeof s.getPlaybackRate!="function"||typeof s.setPlaybackRate!="function"||typeof s.playVideo!="function"){clearTimeout(_t),_t=setTimeout(Ae,100);return}if(le=s.getPlaybackRate(),s.setPlaybackRate(le),I)I.style.display="none";else{I=document.createElement("div"),I.classList.add("goodTube_doubleSpeed"),I.style.position="relative",I.style.zIndex="999",I.style.display="none",rt(I,`
2x
@@ -834,7 +872,7 @@
- `);let e=document.querySelector(".html5-video-player");e&&e.appendChild(S)}document.removeEventListener("keydown",Qt,!0),document.addEventListener("keydown",Qt,!0),document.removeEventListener("keypress",jt,!0),document.addEventListener("keypress",jt,!0),document.removeEventListener("keyup",qt,!0),document.addEventListener("keyup",qt,!0),g.removeEventListener("mousedown",he,!0),g.addEventListener("mousedown",he,!0),g.removeEventListener("touchstart",he,!0),g.addEventListener("touchstart",he,!0),g.removeEventListener("click",Wt,!0),g.addEventListener("click",Wt,!0),g.removeEventListener("mouseup",Te,!0),g.addEventListener("mouseup",Te,!0),g.removeEventListener("touchend",Te,!0),g.addEventListener("touchend",Te,!0),g.removeEventListener("mouseout",xe,!0),g.addEventListener("mouseout",xe,!0),g.removeEventListener("touchcancel",xe,!0),g.addEventListener("touchcancel",xe,!0)}function Fa(e,t){s=document.getElementById("movie_player"),s&&typeof s.loadVideoById=="function"&&typeof s.getVideoData=="function"&&(s.loadVideoById({videoId:e,startSeconds:t}),ve())}let ke=setTimeout(()=>{},0);function ut(e){if(typeof e.data!="string")return;if(!document.body||!document.head){clearTimeout(ke),ke=setTimeout(()=>{ut(e)},100);return}s=document.getElementById("movie_player");let t=!1;if(s&&typeof s.getVideoData=="function"&&(t=s.getVideoData()),!t){clearTimeout(ke),ke=setTimeout(()=>{ut(e)},100);return}if(e.data.indexOf("goodTube_load_")!==-1){let i=e.data.replace("goodTube_load_","").split("|||"),a=i[0],l=parseFloat(i[1]);i[2]==="true"?ii():Va(),Fa(a,l)}else if(e.data==="goodTube_stopVideo")Kt(),mi();else if(e.data.indexOf("goodTube_skipTo_")!==-1){let i=e.data.replace("goodTube_skipTo_","").split("|||"),a=parseFloat(i[0]),l=i[1];if(l!==""&&t.video_id!==l){clearTimeout(ke),ke=setTimeout(()=>{ut(e)},100);return}ci(a)}else if(e.data==="goodTube_pause")Kt();else if(e.data.indexOf("goodTube_play|||")!==-1)yi(e.data.replace("goodTube_play|||",""));else if(e.data==="goodTube_endScreen_show")document.body&&document.body.classList.contains("goodTube_hideEndScreen")&&document.body.classList.remove("goodTube_hideEndScreen");else if(e.data==="goodTube_endScreen_hide")document.body&&!document.body.classList.contains("goodTube_hideEndScreen")&&document.body.classList.add("goodTube_hideEndScreen");else if(e.data.indexOf("goodTube_shortcut_")!==-1){let i=document.querySelector("video");if(i){let a=e.data.replace("goodTube_shortcut_","").split("_"),l=a[0],u={bubbles:!0,key:a[1],keyCode:a[2],ctrlKey:a[3]==="true",metaKey:a[4]==="true",shiftKey:a[5]==="true",altKey:a[6]==="true"};i.dispatchEvent(new KeyboardEvent(l,u))}}else e.data==="goodTube_fullscreen"?li():e.data==="goodTube_autoplay_true"?(p("goodTube_autoplay","true"),W="true",Zt("true")):e.data==="goodTube_autoplay_false"&&(p("goodTube_autoplay","false"),W="false",Zt("false"))}let ct=setTimeout(()=>{},0);function li(){let e=document.querySelector(".ytp-fullscreen-button");e?q(e):(clearTimeout(ct),ct=setTimeout(li,100))}let si=setTimeout(()=>{},0);function Zt(e){let t=document.querySelector("#goodTube_autoplayButton");t?t.querySelector(".ytp-autonav-toggle-button").getAttribute("aria-checked")!==e&&q(t):(clearTimeout(si),si=setTimeout(()=>{Zt(e)},100))}let ui=setTimeout(()=>{},0);function ci(e){let t=document.querySelector("video");t?t.currentTime=parseFloat(e):(clearTimeout(ui),ui=setTimeout(()=>{ci(e)},100))}let pi=setTimeout(()=>{},0);function Kt(){let e=document.querySelector("video");e?e.pause():(clearTimeout(pi),pi=setTimeout(Kt,100))}let fi=setTimeout(()=>{},0);function mi(){let e=document.querySelector("video");e?e.muted=!0:(clearTimeout(fi),fi=setTimeout(mi,100))}let gi=setTimeout(()=>{},0);function Ua(){let e=document.querySelector("video");e?e.muted=!1:(clearTimeout(gi),gi=setTimeout(Ua,100))}let bi=setTimeout(()=>{},0);function yi(e){s=document.getElementById("movie_player");let t=!1;if(s&&typeof s.getVideoData=="function"&&(t=s.getVideoData()),!t||e!==t.video_id){clearTimeout(bi),bi=setTimeout(()=>{yi(e)},100);return}let i=document.querySelector("#movie_player video");i&&i.currentTime>=i.duration||s&&typeof s.playVideo=="function"&&s.playVideo()}function Ha(){let e=document.querySelector(".ytp-fullscreen-button");e&&(e.setAttribute("aria-disabled","false"),document.querySelector(".ytp-fullscreen")?e.setAttribute("title","Exit full screen (f)"):e.setAttribute("title","Full screen (f)"))}function _i(e=!1){let t=document.querySelector("video");if(t){let i=t.currentTime;e&&(i=t.duration),window.top.postMessage("goodTube_syncMainPlayer_"+i,"*")}}function Ya(){addEventListener("leavepictureinpicture",e=>{Pe=!1,window.top.postMessage("goodTube_pip_false","*")}),addEventListener("enterpictureinpicture",e=>{Pe=!0,window.top.postMessage("goodTube_pip_true","*")})}function Ga(){"mediaSession"in navigator&&(navigator.mediaSession.setActionHandler("nexttrack",()=>{window.top.postMessage("goodTube_nextVideo","*")}),navigator.mediaSession.setActionHandler("previoustrack",()=>{window.top.postMessage("goodTube_prevVideo","*")}))}function Qa(){let e=document.querySelector("video");if(e){let a=function(m,k){return k==0?m:a(k,m%k)},l=function(m,k){var x=a(m,k);return[m/x,k/x]},t=e.videoWidth,i=e.videoHeight,u=l(t,i);u.length===2&&!isNaN(u[0])&&!isNaN(u[1])&&window.top.postMessage("goodTube_syncAspectRatio_"+u[0]+"_"+u[1],"*")}}let hi=!1,Ti=setTimeout(()=>{},0);function xi(){window.addEventListener("message",Xt),document.addEventListener("DOMContentLoaded",Jt),(document.readyState==="interactive"||document.readyState==="complete")&&Jt(),!document.body||!document.head?(clearTimeout(Ti),Ti=setTimeout(xi,1)):Jt()}function Jt(){hi||(hi=!0,ja(),qa(),window.top.postMessage("goodTube_proxyIframe_loaded","*"))}function ja(){let e=document.createElement("style");e.textContent=` + `);let e=document.querySelector(".html5-video-player");e&&e.appendChild(I)}document.removeEventListener("keydown",to,!0),document.addEventListener("keydown",to,!0),document.removeEventListener("keypress",oo,!0),document.addEventListener("keypress",oo,!0),document.removeEventListener("keyup",io,!0),document.addEventListener("keyup",io,!0),g.removeEventListener("mousedown",ve,!0),g.addEventListener("mousedown",ve,!0),g.removeEventListener("touchstart",ve,!0),g.addEventListener("touchstart",ve,!0),g.removeEventListener("click",no,!0),g.addEventListener("click",no,!0),g.removeEventListener("mouseup",ke,!0),g.addEventListener("mouseup",ke,!0),g.removeEventListener("touchend",ke,!0),g.addEventListener("touchend",ke,!0),g.removeEventListener("mouseout",we,!0),g.addEventListener("mouseout",we,!0),g.removeEventListener("touchcancel",we,!0),g.addEventListener("touchcancel",we,!0)}function Kn(e,t){s=document.getElementById("movie_player"),s&&typeof s.loadVideoById=="function"&&typeof s.getVideoData=="function"&&(s.loadVideoById({videoId:e,startSeconds:t}),Ae())}let Ee=setTimeout(()=>{},0);function ht(e){if(typeof e.data!="string")return;if(!document.body||!document.head){clearTimeout(Ee),Ee=setTimeout(()=>{ht(e)},100);return}s=document.getElementById("movie_player");let t=!1;if(s&&typeof s.getVideoData=="function"&&(t=s.getVideoData()),!t){clearTimeout(Ee),Ee=setTimeout(()=>{ht(e)},100);return}if(e.data.indexOf("goodTube_load_")!==-1){let i=e.data.replace("goodTube_load_","").split("|||"),n=i[0],l=parseFloat(i[1]);i[2]==="true"?pi():Wn(),Kn(n,l)}else if(e.data==="goodTube_stopVideo")ro(),ki();else if(e.data.indexOf("goodTube_skipTo_")!==-1){let i=e.data.replace("goodTube_skipTo_","").split("|||"),n=parseFloat(i[0]),l=i[1];if(l!==""&&t.video_id!==l){clearTimeout(Ee),Ee=setTimeout(()=>{ht(e)},100);return}Ti(n)}else if(e.data==="goodTube_pause")ro();else if(e.data.indexOf("goodTube_play|||")!==-1)Ei(e.data.replace("goodTube_play|||",""));else if(e.data==="goodTube_endScreen_show")document.body&&document.body.classList.contains("goodTube_hideEndScreen")&&document.body.classList.remove("goodTube_hideEndScreen");else if(e.data==="goodTube_endScreen_hide")document.body&&!document.body.classList.contains("goodTube_hideEndScreen")&&document.body.classList.add("goodTube_hideEndScreen");else if(e.data.indexOf("goodTube_shortcut_")!==-1){let i=document.querySelector("video");if(i){let n=e.data.replace("goodTube_shortcut_","").split("_"),l=n[0],u={bubbles:!0,key:n[1],keyCode:n[2],ctrlKey:n[3]==="true",metaKey:n[4]==="true",shiftKey:n[5]==="true",altKey:n[6]==="true"};i.dispatchEvent(new KeyboardEvent(l,u))}}else e.data==="goodTube_fullscreen"?yi():e.data==="goodTube_autoplay_true"?(p("goodTube_autoplay","true"),Z="true",ao("true")):e.data==="goodTube_autoplay_false"&&(p("goodTube_autoplay","false"),Z="false",ao("false"))}let Tt=setTimeout(()=>{},0);function yi(){let e=document.querySelector(".ytp-fullscreen-button");e?q(e):(clearTimeout(Tt),Tt=setTimeout(yi,100))}let _i=setTimeout(()=>{},0);function ao(e){let t=document.querySelector("#goodTube_autoplayButton");t?t.querySelector(".ytp-autonav-toggle-button").getAttribute("aria-checked")!==e&&q(t):(clearTimeout(_i),_i=setTimeout(()=>{ao(e)},100))}let hi=setTimeout(()=>{},0);function Ti(e){let t=document.querySelector("video");t?t.currentTime=parseFloat(e):(clearTimeout(hi),hi=setTimeout(()=>{Ti(e)},100))}let xi=setTimeout(()=>{},0);function ro(){let e=document.querySelector("video");e?e.pause():(clearTimeout(xi),xi=setTimeout(ro,100))}let vi=setTimeout(()=>{},0);function ki(){let e=document.querySelector("video");e?e.muted=!0:(clearTimeout(vi),vi=setTimeout(ki,100))}let wi=setTimeout(()=>{},0);function Jn(){let e=document.querySelector("video");e?e.muted=!1:(clearTimeout(wi),wi=setTimeout(Jn,100))}let Ai=setTimeout(()=>{},0);function Ei(e){s=document.getElementById("movie_player");let t=!1;if(s&&typeof s.getVideoData=="function"&&(t=s.getVideoData()),!t||e!==t.video_id){clearTimeout(Ai),Ai=setTimeout(()=>{Ei(e)},100);return}let i=document.querySelector("#movie_player video");i&&i.currentTime>=i.duration||s&&typeof s.playVideo=="function"&&s.playVideo()}function Xn(){let e=document.querySelector(".ytp-fullscreen-button");e&&(e.setAttribute("aria-disabled","false"),document.querySelector(".ytp-fullscreen")?e.setAttribute("title","Exit full screen (f)"):e.setAttribute("title","Full screen (f)"))}function Si(e=!1){let t=document.querySelector("video");if(t){let i=t.currentTime;e&&(i=t.duration),window.top.postMessage("goodTube_syncMainPlayer_"+i,"*")}}function $n(){addEventListener("leavepictureinpicture",e=>{He=!1,window.top.postMessage("goodTube_pip_false","*")}),addEventListener("enterpictureinpicture",e=>{He=!0,window.top.postMessage("goodTube_pip_true","*")})}function ea(){"mediaSession"in navigator&&(navigator.mediaSession.setActionHandler("nexttrack",()=>{window.top.postMessage("goodTube_nextVideo","*")}),navigator.mediaSession.setActionHandler("previoustrack",()=>{window.top.postMessage("goodTube_prevVideo","*")}))}function ta(){let e=document.querySelector("video");if(e){let n=function(m,k){return k==0?m:n(k,m%k)},l=function(m,k){var x=n(m,k);return[m/x,k/x]},t=e.videoWidth,i=e.videoHeight,u=l(t,i);u.length===2&&!isNaN(u[0])&&!isNaN(u[1])&&window.top.postMessage("goodTube_syncAspectRatio_"+u[0]+"_"+u[1],"*")}}let Ii=!1,Li=setTimeout(()=>{},0);function Mi(){window.addEventListener("message",so),document.addEventListener("DOMContentLoaded",lo),(document.readyState==="interactive"||document.readyState==="complete")&&lo(),!document.body||!document.head?(clearTimeout(Li),Li=setTimeout(Mi,1)):lo()}function lo(){Ii||(Ii=!0,oa(),ia(),window.top.postMessage("goodTube_proxyIframe_loaded","*"))}function oa(){let e=document.createElement("style");e.textContent=` /* Hide the page */ body *:not(#goodTube_youtube_iframe) { display: none !important; @@ -856,4 +894,4 @@ right: 0; z-index: 99999; } - `,document.head.appendChild(e)}function qa(){let e=document.createElement("iframe");e.src="",e.setAttribute("width","100%"),e.setAttribute("height","100%"),e.setAttribute("frameborder","0"),e.setAttribute("scrolling","yes"),e.setAttribute("allow","accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"),e.setAttribute("referrerpolicy","strict-origin-when-cross-origin"),e.setAttribute("allowfullscreen",!0),e.setAttribute("id","goodTube_youtube_iframe"),document.body.appendChild(e)}let pt=setTimeout(()=>{},0);function Xt(e){if(typeof e.data!="string")return;(!document.body||!document.head)&&(clearTimeout(pt),pt=setTimeout(()=>{Xt(e)},100));let t=document.getElementById("goodTube_youtube_iframe");t?e.data.indexOf("goodTube_src_")!==-1?t.src===""||t.src.indexOf("?goodTubeProxy=1")!==-1?t.src=e.data.replace("goodTube_src_",""):t.contentWindow.location.replace(e.data.replace("goodTube_src_","")):t.contentWindow.postMessage(e.data,"*"):(clearTimeout(pt),pt=setTimeout(()=>{Xt(e)},100))}function Wa(){window.top===window.self&&window.location.href.indexOf("youtube")!==-1?Go():window.location.href.indexOf("?goodTubeProxy=1")!==-1?xi():window.location.href.indexOf("?goodTubeEmbed=1")!==-1&&ei()}Wa()})();})(); + `,document.head.appendChild(e)}function ia(){let e=document.createElement("iframe");e.src="",e.setAttribute("width","100%"),e.setAttribute("height","100%"),e.setAttribute("frameborder","0"),e.setAttribute("scrolling","yes"),e.setAttribute("allow","accelerometer *; autoplay *; clipboard-write *; encrypted-media *; gyroscope *; picture-in-picture *; web-share *;"),e.setAttribute("referrerpolicy","strict-origin-when-cross-origin"),e.setAttribute("allowfullscreen",!0),e.setAttribute("id","goodTube_youtube_iframe"),document.body.appendChild(e)}let xt=setTimeout(()=>{},0);function so(e){if(typeof e.data!="string")return;(!document.body||!document.head)&&(clearTimeout(xt),xt=setTimeout(()=>{so(e)},100));let t=document.getElementById("goodTube_youtube_iframe");t?e.data.indexOf("goodTube_src_")!==-1?t.src===""||t.src.indexOf("?goodTubeProxy=1")!==-1?t.src=e.data.replace("goodTube_src_",""):t.contentWindow.location.replace(e.data.replace("goodTube_src_","")):t.contentWindow.postMessage(e.data,"*"):(clearTimeout(xt),xt=setTimeout(()=>{so(e)},100))}function na(){window.top===window.self&&window.location.href.indexOf("youtube")!==-1?$o():window.location.href.indexOf("?goodTubeProxy=1")!==-1?Mi():window.location.href.indexOf("?goodTubeEmbed=1")!==-1&&si()}na()})();})();