diff --git a/goodtube.js b/goodtube.js index 702c41e..2c7e328 100644 --- a/goodtube.js +++ b/goodtube.js @@ -475,9 +475,6 @@ // 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); } @@ -2118,7 +2115,13 @@ // If we're not watching a video else { // Stop the video (this solves some weird edge case where the video can be playing in the background) - goodTube_player.contentWindow.postMessage('goodTube_stopVideo', '*') + goodTube_player.contentWindow.postMessage('goodTube_stopVideo', '*'); + + // Videos per row on the home page + if (goodTube_videosPerRow !== 'default') { + // Set videos per row on the home page + goodTube_youtube_setVideosPerRow(goodTube_videosPerRow); + } } // Hide shorts (real time) diff --git a/goodtube.min.js b/goodtube.min.js index bd153a3..0f1ec7c 100644 --- a/goodtube.min.js +++ b/goodtube.min.js @@ -1,8 +1,8 @@ -(()=>{(function(){"use strict";var tn=Object.defineProperty,f=(e,t)=>tn(e,"name",{value:t,configurable:!0}),{entries:xo,setPrototypeOf:vo,isFrozen:on,getPrototypeOf:nn,getOwnPropertyDescriptor:an}=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]:nt;vo&&vo(e,null);let n=t.length;for(;n--;){let l=t[n];if(typeof l=="string"){let u=i(l);u!==l&&(on(t)||(t[n]=u),l=u)}e[l]=!0}return e}f(c,"addToSet");function Ao(e){for(let t=0;t/gm),mn=V(/\$\{[\w\W]*/gm),gn=V(/^data-[\-\w.\u00B7-\uFFFF]+$/),bn=V(/^aria-[\-\w]+$/),Lo=V(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),yn=V(/^(?:\w+script|data):/i),_n=V(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Do=V(/^html$/i),hn=V(/^[a-z][.\w]*(-[.\w]+)+$/i),Co=Object.freeze({__proto__:null,ARIA_ATTR:bn,ATTR_WHITESPACE:_n,CUSTOM_ELEMENT:hn,DATA_ATTR:gn,DOCTYPE_NAME:Do,ERB_EXPR:fn,IS_ALLOWED_URI:Lo,IS_SCRIPT_OR_DATA:yn,MUSTACHE_EXPR:pn,TMPLIT_EXPR:mn}),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},Tn=f(function(){return typeof window>"u"?null:window},"getGlobal"),xn=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]:Tn(),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:w,Element:x,NodeFilter:k,NamedNodeMap:ie=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:pe,DOMParser:fe,trustedTypes:me}=e,ne=x.prototype,vt=_e(ne,"cloneNode"),wt=_e(ne,"remove"),Ke=_e(ne,"nextSibling"),Je=_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:Xe,createDocumentFragment:kt,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:Me,DATA_ATTR:At,ARIA_ATTR:Et,IS_SCRIPT_OR_DATA:St,ATTR_WHITESPACE:$e,CUSTOM_ELEMENT:aa}=Co,{IS_ALLOWED_URI:Ci}=Co,E=null,Ri=c({},[...Eo,...Ft,...Ut,...Ht,...So]),M=null,Oi=c({},[...Io,...Yt,...Mo,...at]),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}})),et=null,uo=null,Le=Object.seal(Nt(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Ni=!0,co=!0,Pi=!1,Bi=!0,De=!1,It=!0,ge=!1,po=!1,fo=!1,Ce=!1,Mt=!1,Lt=!1,Vi=!0,zi=!1,ra="user-content-",mo=!0,tt=!1,Re={},Oe=null,Fi=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"]),Ui=null,Hi=c({},["audio","video","img","source","image","track"]),go=null,Yi=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"]),ot=null,sa=["application/xhtml+xml","text/html"],ua="text/html",S=null,Pe=null,ca=i.createElement("form"),Gi=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),ot=sa.indexOf(o.PARSER_MEDIA_TYPE)===-1?ua:o.PARSER_MEDIA_TYPE,S=ot==="application/xhtml+xml"?Vt:nt,E=H(o,"ALLOWED_TAGS")?c({},o.ALLOWED_TAGS,S):Ri,M=H(o,"ALLOWED_ATTR")?c({},o.ALLOWED_ATTR,S):Oi,yo=H(o,"ALLOWED_NAMESPACES")?c({},o.ALLOWED_NAMESPACES,Vt):da,go=H(o,"ADD_URI_SAFE_ATTR")?c(Q(Yi),o.ADD_URI_SAFE_ATTR,S):Yi,Ui=H(o,"ADD_DATA_URI_TAGS")?c(Q(Hi),o.ADD_DATA_URI_TAGS,S):Hi,Oe=H(o,"FORBID_CONTENTS")?c({},o.FORBID_CONTENTS,S):Fi,et=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,Ni=o.ALLOW_ARIA_ATTR!==!1,co=o.ALLOW_DATA_ATTR!==!1,Pi=o.ALLOW_UNKNOWN_PROTOCOLS||!1,Bi=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,Mt=o.RETURN_DOM_FRAGMENT||!1,Lt=o.RETURN_TRUSTED_TYPE||!1,fo=o.FORCE_BODY||!1,Vi=o.SANITIZE_DOM!==!1,zi=o.SANITIZE_NAMED_PROPS||!1,mo=o.KEEP_CONTENT!==!1,tt=o.IN_PLACE||!1,Ci=o.ALLOWED_URI_REGEXP||Lo,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&&Gi(o.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(v.tagNameCheck=o.CUSTOM_ELEMENT_HANDLING.tagNameCheck),o.CUSTOM_ELEMENT_HANDLING&&Gi(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),Mt&&(Ce=!0),Re&&(E=c({},So),M=[],Re.html===!0&&(c(E,Eo),c(M,Io)),Re.svg===!0&&(c(E,Ft),c(M,Yt),c(M,at)),Re.svgFilters===!0&&(c(E,Ut),c(M,Yt),c(M,at)),Re.mathMl===!0&&(c(E,Ht),c(M,Mo),c(M,at))),o.ADD_TAGS&&(typeof o.ADD_TAGS=="function"?Le.tagCheck=o.ADD_TAGS:(E===Ri&&(E=Q(E)),c(E,o.ADD_TAGS,S))),o.ADD_ATTR&&(typeof o.ADD_ATTR=="function"?Le.attributeCheck=o.ADD_ATTR:(M===Oi&&(M=Q(M)),c(M,o.ADD_ATTR,S))),o.ADD_URI_SAFE_ATTR&&c(go,o.ADD_URI_SAFE_ATTR,S),o.FORBID_CONTENTS&&(Oe===Fi&&(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 et.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=xn(me,l)),A!==null&&typeof ae=="string"&&(ae=A.createHTML(""));O&&O(o),Pe=o}},"_parseConfig"),Qi=c({},[...Ft,...Ut,...un]),qi=c({},[...Ht,...cn]),pa=f(function(o){let r=R(o);(!r||!r.tagName)&&(r={namespaceURI:Ne,tagName:"template"});let a=nt(o.tagName),b=nt(r.tagName);return yo[o.namespaceURI]?o.namespaceURI===Ct?r.namespaceURI===$?a==="svg":r.namespaceURI===Dt?a==="svg"&&(b==="annotation-xml"||Rt[b]):!!Qi[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]||!Qi[a]):!!(ot==="application/xhtml+xml"&&yo[o.namespaceURI]):!1},"_checkValidNamespace"),be=f(function(o){Be(t.removed,{element:o});try{R(o).removeChild(o)}catch{wt(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||Mt)try{be(r)}catch{}else try{r.setAttribute(o,"")}catch{}},"_removeAttribute"),ji=f(function(o){let r=null,a=null;if(fo)o=""+o;else{let h=zt(o,/^[\r\n\t ]+/);a=h&&h[0]}ot==="application/xhtml+xml"&&Ne===$&&(o=''+o+"");let b=A?A.createHTML(o):o;if(Ne===$)try{r=new fe().parseFromString(b,ot)}catch{}if(!r||!r.documentElement){r=Se.createDocument(Ne,"template",null);try{r.documentElement.innerHTML=bo?ae:b}catch{}}let L=r.body||r.documentElement;return o&&a&&L.insertBefore(i.createTextNode(a),L.childNodes[0]||null),Ne===$?F.call(r,ge?"html":"body")[0]:ge?r.documentElement:L},"_initDocument"),Wi=f(function(o){return Xe.call(o.ownerDocument||o,o,k.SHOW_ELEMENT|k.SHOW_COMMENT|k.SHOW_TEXT|k.SHOW_PROCESSING_INSTRUCTION|k.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"),Zi=f(function(o){return typeof w=="function"&&o instanceof w},"_isNode");function J(o,r,a){it(o,b=>{b.call(t,r,a,Pe)})}f(J,"_executeHooks");let Ki=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()&&!Zi(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(!(Le.tagCheck instanceof Function&&Le.tagCheck(a))&&(!E[a]||et[a])){if(!et[a]&&Xi(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,L=Je(o)||o.childNodes;if(L&&b){let h=L.length;for(let ee=h-1;ee>=0;--ee){let Y=vt(L[ee],!0);Y.__removalCount=(o.__removalCount||0)+1,b.insertBefore(Y,Ke(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,it([U,Ie,Me],b=>{r=Ve(r,b," ")}),o.textContent!==r&&(Be(t.removed,{element:o.cloneNode()}),o.textContent=r)),J(_.afterSanitizeElements,o,null),!1)},"_sanitizeElements"),Ji=f(function(o,r,a){if(Vi&&(r==="id"||r==="name")&&(a in i||a in ca))return!1;if(!(co&&!uo[r]&&N(At,r))&&!(Ni&&N(Et,r))&&!(Le.attributeCheck instanceof Function&&Le.attributeCheck(r,o))){if(!M[r]||uo[r]){if(!(Xi(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(Ci,Ve(a,$e,""))&&!((r==="src"||r==="xlink:href"||r==="href")&&o!=="script"&&ln(a,"data:")===0&&Ui[o])&&!(Pi&&!N(St,Ve(a,$e,"")))&&a)return!1}return!0},"_isValidAttribute"),Xi=f(function(o){return o!=="annotation-xml"&&zt(o,aa)},"_isBasicCustomElement"),$i=f(function(o){J(_.beforeSanitizeAttributes,o,null);let{attributes:r}=o;if(!r||ho(o))return;let a={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:M,forceKeepAttr:void 0},b=r.length;for(;b--;){let L=r[b],{name:h,namespaceURI:ee,value:Y}=L,G=S(h),To=Y,D=h==="value"?To:sn(To);if(a.attrName=G,a.attrValue=D,a.keepAttr=!0,a.forceKeepAttr=void 0,J(_.uponSanitizeAttribute,o,a),D=a.attrValue,zi&&(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(!Bi&&N(/\/>/i,D)){ye(h,o);continue}De&&it([U,Ie,Me],ma=>{D=Ve(D,ma," ")});let en=S(o.nodeName);if(!Ji(en,G,D)){ye(h,o);continue}if(A&&typeof me=="object"&&typeof me.getAttributeType=="function"&&!ee)switch(me.getAttributeType(en,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):wo(t.removed)}catch{ye(h,o)}}J(_.afterSanitizeAttributes,o,null)},"_sanitizeAttributes"),fa=f(function o(r){let a=null,b=Wi(r);for(J(_.beforeSanitizeShadowDOM,r,null);a=b.nextNode();)J(_.uponSanitizeShadowNode,a,null),Ki(a),$i(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,L=null,h=null;if(bo=!o,bo&&(o=""),typeof o!="string"&&!Zi(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"&&(tt=!1),tt){if(o.nodeName){let G=S(o.nodeName);if(!E[G]||et[G])throw ze("root node is forbidden and cannot be sanitized in-place")}}else if(o instanceof w)a=ji(""),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&&Lt?A.createHTML(o):o;if(a=ji(o),!a)return Ce?null:Lt?ae:""}a&&fo&&be(a.firstChild);let ee=Wi(tt?o:a);for(;L=ee.nextNode();)Ki(L),$i(L),L.content instanceof u&&fa(L.content);if(tt)return o;if(Ce){if(Mt)for(h=kt.call(a.ownerDocument);a.firstChild;)h.appendChild(a.firstChild);else h=a;return(M.shadowroot||M.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&&it([U,Ie,Me],G=>{Y=Ve(Y,G," ")}),A&&Lt?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),L=S(r);return Ji(b,L,a)},t.addHook=function(o,r){typeof r=="function"&&Be(_[o],r)},t.removeHook=function(o,r){if(r!==void 0){let a=rn(_[o],r);return a===-1?void 0:dn(_[o],a,1)[0]}return wo(_[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{(function(){"use strict";var tn=Object.defineProperty,f=(e,t)=>tn(e,"name",{value:t,configurable:!0}),{entries:xo,setPrototypeOf:vo,isFrozen:on,getPrototypeOf:nn,getOwnPropertyDescriptor:an}=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]:nt;vo&&vo(e,null);let n=t.length;for(;n--;){let l=t[n];if(typeof l=="string"){let u=i(l);u!==l&&(on(t)||(t[n]=u),l=u)}e[l]=!0}return e}f(c,"addToSet");function Ao(e){for(let t=0;t/gm),mn=V(/\$\{[\w\W]*/gm),gn=V(/^data-[\-\w.\u00B7-\uFFFF]+$/),bn=V(/^aria-[\-\w]+$/),Lo=V(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),yn=V(/^(?:\w+script|data):/i),_n=V(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Do=V(/^html$/i),hn=V(/^[a-z][.\w]*(-[.\w]+)+$/i),Co=Object.freeze({__proto__:null,ARIA_ATTR:bn,ATTR_WHITESPACE:_n,CUSTOM_ELEMENT:hn,DATA_ATTR:gn,DOCTYPE_NAME:Do,ERB_EXPR:fn,IS_ALLOWED_URI:Lo,IS_SCRIPT_OR_DATA:yn,MUSTACHE_EXPR:pn,TMPLIT_EXPR:mn}),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},Tn=f(function(){return typeof window>"u"?null:window},"getGlobal"),xn=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]:Tn(),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:w,Element:x,NodeFilter:k,NamedNodeMap:ie=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:pe,DOMParser:fe,trustedTypes:me}=e,ne=x.prototype,vt=_e(ne,"cloneNode"),wt=_e(ne,"remove"),Ke=_e(ne,"nextSibling"),Je=_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:Xe,createDocumentFragment:kt,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:Me,DATA_ATTR:At,ARIA_ATTR:Et,IS_SCRIPT_OR_DATA:St,ATTR_WHITESPACE:$e,CUSTOM_ELEMENT:aa}=Co,{IS_ALLOWED_URI:Ci}=Co,E=null,Ri=c({},[...Eo,...Ft,...Ut,...Ht,...So]),M=null,Oi=c({},[...Io,...Yt,...Mo,...at]),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}})),et=null,uo=null,Le=Object.seal(Nt(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Ni=!0,co=!0,Pi=!1,Bi=!0,De=!1,It=!0,ge=!1,po=!1,fo=!1,Ce=!1,Mt=!1,Lt=!1,Vi=!0,zi=!1,ra="user-content-",mo=!0,tt=!1,Re={},Oe=null,Fi=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"]),Ui=null,Hi=c({},["audio","video","img","source","image","track"]),go=null,Yi=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"]),ot=null,sa=["application/xhtml+xml","text/html"],ua="text/html",S=null,Pe=null,ca=i.createElement("form"),Gi=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),ot=sa.indexOf(o.PARSER_MEDIA_TYPE)===-1?ua:o.PARSER_MEDIA_TYPE,S=ot==="application/xhtml+xml"?Vt:nt,E=H(o,"ALLOWED_TAGS")?c({},o.ALLOWED_TAGS,S):Ri,M=H(o,"ALLOWED_ATTR")?c({},o.ALLOWED_ATTR,S):Oi,yo=H(o,"ALLOWED_NAMESPACES")?c({},o.ALLOWED_NAMESPACES,Vt):da,go=H(o,"ADD_URI_SAFE_ATTR")?c(q(Yi),o.ADD_URI_SAFE_ATTR,S):Yi,Ui=H(o,"ADD_DATA_URI_TAGS")?c(q(Hi),o.ADD_DATA_URI_TAGS,S):Hi,Oe=H(o,"FORBID_CONTENTS")?c({},o.FORBID_CONTENTS,S):Fi,et=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,Ni=o.ALLOW_ARIA_ATTR!==!1,co=o.ALLOW_DATA_ATTR!==!1,Pi=o.ALLOW_UNKNOWN_PROTOCOLS||!1,Bi=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,Mt=o.RETURN_DOM_FRAGMENT||!1,Lt=o.RETURN_TRUSTED_TYPE||!1,fo=o.FORCE_BODY||!1,Vi=o.SANITIZE_DOM!==!1,zi=o.SANITIZE_NAMED_PROPS||!1,mo=o.KEEP_CONTENT!==!1,tt=o.IN_PLACE||!1,Ci=o.ALLOWED_URI_REGEXP||Lo,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&&Gi(o.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(v.tagNameCheck=o.CUSTOM_ELEMENT_HANDLING.tagNameCheck),o.CUSTOM_ELEMENT_HANDLING&&Gi(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),Mt&&(Ce=!0),Re&&(E=c({},So),M=[],Re.html===!0&&(c(E,Eo),c(M,Io)),Re.svg===!0&&(c(E,Ft),c(M,Yt),c(M,at)),Re.svgFilters===!0&&(c(E,Ut),c(M,Yt),c(M,at)),Re.mathMl===!0&&(c(E,Ht),c(M,Mo),c(M,at))),o.ADD_TAGS&&(typeof o.ADD_TAGS=="function"?Le.tagCheck=o.ADD_TAGS:(E===Ri&&(E=q(E)),c(E,o.ADD_TAGS,S))),o.ADD_ATTR&&(typeof o.ADD_ATTR=="function"?Le.attributeCheck=o.ADD_ATTR:(M===Oi&&(M=q(M)),c(M,o.ADD_ATTR,S))),o.ADD_URI_SAFE_ATTR&&c(go,o.ADD_URI_SAFE_ATTR,S),o.FORBID_CONTENTS&&(Oe===Fi&&(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 et.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=xn(me,l)),A!==null&&typeof ae=="string"&&(ae=A.createHTML(""));O&&O(o),Pe=o}},"_parseConfig"),Qi=c({},[...Ft,...Ut,...un]),qi=c({},[...Ht,...cn]),pa=f(function(o){let r=R(o);(!r||!r.tagName)&&(r={namespaceURI:Ne,tagName:"template"});let a=nt(o.tagName),b=nt(r.tagName);return yo[o.namespaceURI]?o.namespaceURI===Ct?r.namespaceURI===$?a==="svg":r.namespaceURI===Dt?a==="svg"&&(b==="annotation-xml"||Rt[b]):!!Qi[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]||!Qi[a]):!!(ot==="application/xhtml+xml"&&yo[o.namespaceURI]):!1},"_checkValidNamespace"),be=f(function(o){Be(t.removed,{element:o});try{R(o).removeChild(o)}catch{wt(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||Mt)try{be(r)}catch{}else try{r.setAttribute(o,"")}catch{}},"_removeAttribute"),ji=f(function(o){let r=null,a=null;if(fo)o=""+o;else{let h=zt(o,/^[\r\n\t ]+/);a=h&&h[0]}ot==="application/xhtml+xml"&&Ne===$&&(o=''+o+"");let b=A?A.createHTML(o):o;if(Ne===$)try{r=new fe().parseFromString(b,ot)}catch{}if(!r||!r.documentElement){r=Se.createDocument(Ne,"template",null);try{r.documentElement.innerHTML=bo?ae:b}catch{}}let L=r.body||r.documentElement;return o&&a&&L.insertBefore(i.createTextNode(a),L.childNodes[0]||null),Ne===$?F.call(r,ge?"html":"body")[0]:ge?r.documentElement:L},"_initDocument"),Wi=f(function(o){return Xe.call(o.ownerDocument||o,o,k.SHOW_ELEMENT|k.SHOW_COMMENT|k.SHOW_TEXT|k.SHOW_PROCESSING_INSTRUCTION|k.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"),Zi=f(function(o){return typeof w=="function"&&o instanceof w},"_isNode");function J(o,r,a){it(o,b=>{b.call(t,r,a,Pe)})}f(J,"_executeHooks");let Ki=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()&&!Zi(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(!(Le.tagCheck instanceof Function&&Le.tagCheck(a))&&(!E[a]||et[a])){if(!et[a]&&Xi(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,L=Je(o)||o.childNodes;if(L&&b){let h=L.length;for(let ee=h-1;ee>=0;--ee){let G=vt(L[ee],!0);G.__removalCount=(o.__removalCount||0)+1,b.insertBefore(G,Ke(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,it([U,Ie,Me],b=>{r=Ve(r,b," ")}),o.textContent!==r&&(Be(t.removed,{element:o.cloneNode()}),o.textContent=r)),J(_.afterSanitizeElements,o,null),!1)},"_sanitizeElements"),Ji=f(function(o,r,a){if(Vi&&(r==="id"||r==="name")&&(a in i||a in ca))return!1;if(!(co&&!uo[r]&&N(At,r))&&!(Ni&&N(Et,r))&&!(Le.attributeCheck instanceof Function&&Le.attributeCheck(r,o))){if(!M[r]||uo[r]){if(!(Xi(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(Ci,Ve(a,$e,""))&&!((r==="src"||r==="xlink:href"||r==="href")&&o!=="script"&&ln(a,"data:")===0&&Ui[o])&&!(Pi&&!N(St,Ve(a,$e,"")))&&a)return!1}return!0},"_isValidAttribute"),Xi=f(function(o){return o!=="annotation-xml"&&zt(o,aa)},"_isBasicCustomElement"),$i=f(function(o){J(_.beforeSanitizeAttributes,o,null);let{attributes:r}=o;if(!r||ho(o))return;let a={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:M,forceKeepAttr:void 0},b=r.length;for(;b--;){let L=r[b],{name:h,namespaceURI:ee,value:G}=L,Q=S(h),To=G,D=h==="value"?To:sn(To);if(a.attrName=Q,a.attrValue=D,a.keepAttr=!0,a.forceKeepAttr=void 0,J(_.uponSanitizeAttribute,o,a),D=a.attrValue,zi&&(Q==="id"||Q==="name")&&(ye(h,o),D=ra+D),It&&N(/((--!?|])>)|<\/(style|title|textarea)/i,D)){ye(h,o);continue}if(Q==="attributename"&&zt(D,"href")){ye(h,o);continue}if(a.forceKeepAttr)continue;if(!a.keepAttr){ye(h,o);continue}if(!Bi&&N(/\/>/i,D)){ye(h,o);continue}De&&it([U,Ie,Me],ma=>{D=Ve(D,ma," ")});let en=S(o.nodeName);if(!Ji(en,Q,D)){ye(h,o);continue}if(A&&typeof me=="object"&&typeof me.getAttributeType=="function"&&!ee)switch(me.getAttributeType(en,Q)){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):wo(t.removed)}catch{ye(h,o)}}J(_.afterSanitizeAttributes,o,null)},"_sanitizeAttributes"),fa=f(function o(r){let a=null,b=Wi(r);for(J(_.beforeSanitizeShadowDOM,r,null);a=b.nextNode();)J(_.uponSanitizeShadowNode,a,null),Ki(a),$i(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,L=null,h=null;if(bo=!o,bo&&(o=""),typeof o!="string"&&!Zi(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"&&(tt=!1),tt){if(o.nodeName){let Q=S(o.nodeName);if(!E[Q]||et[Q])throw ze("root node is forbidden and cannot be sanitized in-place")}}else if(o instanceof w)a=ji(""),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&&Lt?A.createHTML(o):o;if(a=ji(o),!a)return Ce?null:Lt?ae:""}a&&fo&&be(a.firstChild);let ee=Wi(tt?o:a);for(;L=ee.nextNode();)Ki(L),$i(L),L.content instanceof u&&fa(L.content);if(tt)return o;if(Ce){if(Mt)for(h=kt.call(a.ownerDocument);a.firstChild;)h.appendChild(a.firstChild);else h=a;return(M.shadowroot||M.shadowrootmode)&&(h=X.call(n,h,!0)),h}let G=ge?a.outerHTML:a.innerHTML;return ge&&E["!doctype"]&&a.ownerDocument&&a.ownerDocument.doctype&&a.ownerDocument.doctype.name&&N(Do,a.ownerDocument.doctype.name)&&(G=""+G),De&&it([U,Ie,Me],Q=>{G=Ve(G,Q," ")}),A&&Lt?A.createHTML(G):G},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),L=S(r);return Ji(b,L,a)},t.addHook=function(o,r){typeof r=="function"&&Be(_[o],r)},t.removeHook=function(o,r){if(r!==void 0){let a=rn(_[o],r);return a===-1?void 0:dn(_[o],a,1)[0]}return wo(_[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{},0);function Ho(e){let t=window.location.href;if(t=t.replace("https://","").replace("http://",""),t.split("/").length<=2){let n=document.querySelector("ytd-rich-grid-renderer #contents");if(!n){clearTimeout(Uo),Uo=setTimeout(()=>{Ho(e)},100);return}n.style.setProperty("--ytd-rich-grid-items-per-row",e),n.style.setProperty("--ytd-rich-grid-posts-per-row",e),n.style.setProperty("--ytd-rich-grid-slim-items-per-row",e),n.style.setProperty("--ytd-rich-grid-game-cards-per-row",e),n.style.setProperty("--ytd-rich-grid-mini-game-cards-per-row",e)}}function An(){document.querySelectorAll("ytd-rich-item-renderer:not(.goodTube_checked)").forEach(t=>{t.innerHTML.toLowerCase().indexOf("members only")!==-1&&j(t),t.classList.add("goodTube_checked")})}function En(){if(he==="true")return;window.location.href.indexOf("/shorts")!==-1&&!Vo&&(window.location.href="https://youtube.com",Vo=!0),document.querySelectorAll("a:not(.goodTube_hidden)").forEach(i=>{i.href.indexOf("shorts/")!==-1&&(j(i),j(i.closest("ytd-video-renderer")),j(i.closest("ytd-compact-video-renderer")),j(i.closest("ytd-rich-grid-media")))}),document.querySelectorAll("yt-chip-cloud-chip-renderer:not(.goodTube_hidden):not(.goodTube_checked), yt-tab-shape:not(.goodTube_hidden):not(.goodTube_checked), ytd-guide-entry-renderer:not(.goodTube_checked)").forEach(i=>{i.innerHTML.toLowerCase().indexOf("shorts")!==-1&&j(i),i.classList.add("goodTube_checked")})}function Sn(){document.querySelectorAll("#description a, ytd-comments .yt-core-attributed-string a, ytm-expandable-video-description-body-renderer a, .comment-content a").forEach(t=>{!t.classList.contains("goodTube_timestampLink")&&t.getAttribute("href")&&t.getAttribute("href").indexOf(T.v)!==-1&&(t.classList.add("goodTube_timestampLink"),t.addEventListener("click",function(){let i=0,n=t.getAttribute("href").split("t=");typeof n[1]<"u"&&(i=parseFloat(n[1].replace("s",""))),Wo(i)}))})}let pt=setTimeout(()=>{},0);function Zt(){if(he==="true"&&window.location.href.indexOf("/shorts")!==-1||!z()){clearTimeout(pt),pt=setTimeout(Zt,100);return}document.querySelectorAll("video").forEach(t=>{y?!t.paused&&!t.closest("#movie_player")&&(t.muted=!0,t.volume=0,t.pause()):!t.paused&&(!qt||!t.closest("#movie_player"))&&(t.muted=!0,t.volume=0,!Qt()||!t.closest("#movie_player")?(t.pause(),t.playbackRate=Te):(t.play(),t.playbackRate=2))}),clearTimeout(pt),pt=setTimeout(Zt,100)}function In(){if(Bo)return;let e=document.querySelector("#movie_player .ytp-autonav-toggle-button");e&&(e.getAttribute("aria-checked")==="true"&&q(e),Bo=!0)}function Mn(){document.querySelectorAll("yt-confirm-dialog-renderer").forEach(t=>{if(t.innerHTML.indexOf("Video paused. Continue watching?")!==-1){let i=t.querySelector("#confirm-button");i&&q(i)}})}function Ln(e,t){if(!e||!t)return;let i=document.querySelector("ytd-watch-flexy");i&&z()&&!y&&(i.style.setProperty("--ytd-watch-flexy-width-ratio",e),i.style.setProperty("--ytd-watch-flexy-height-ratio",t))}function Yo(){let e=document.querySelector("ytd-watch-flexy");e&&(e.style.removeProperty("--ytd-watch-flexy-width-ratio"),e.style.removeProperty("--ytd-watch-flexy-height-ratio"))}let Go=setTimeout(()=>{},0);function Qo(){d=document.getElementById("movie_player");let e=!1;if(d&&typeof d.getVideoData=="function"&&(e=d.getVideoData()),!e){clearTimeout(Go),Go=setTimeout(Qo,100);return}let t="transparent";ct==="true"&&(t="#000000");let i=document.createElement("style");i.textContent=` + `,console.log("[GoodTube] AI summaries removed")),qe==="true"&&console.log("[GoodTube] Members only videos removed"),Y!=="default"&&console.log("[GoodTube] Videos per row on the home page set to "+Y);let t=document.createElement("style");t.textContent=e,document.head.appendChild(t)}let Uo=setTimeout(()=>{},0);function Ho(e){let t=window.location.href;if(t=t.replace("https://","").replace("http://",""),t.split("/").length<=2){let n=document.querySelector("ytd-rich-grid-renderer #contents");if(!n){clearTimeout(Uo),Uo=setTimeout(()=>{Ho(e)},100);return}n.style.setProperty("--ytd-rich-grid-items-per-row",e),n.style.setProperty("--ytd-rich-grid-posts-per-row",e),n.style.setProperty("--ytd-rich-grid-slim-items-per-row",e),n.style.setProperty("--ytd-rich-grid-game-cards-per-row",e),n.style.setProperty("--ytd-rich-grid-mini-game-cards-per-row",e)}}function An(){document.querySelectorAll("ytd-rich-item-renderer:not(.goodTube_checked)").forEach(t=>{t.innerHTML.toLowerCase().indexOf("members only")!==-1&&W(t),t.classList.add("goodTube_checked")})}function En(){if(he==="true")return;window.location.href.indexOf("/shorts")!==-1&&!Vo&&(window.location.href="https://youtube.com",Vo=!0),document.querySelectorAll("a:not(.goodTube_hidden)").forEach(i=>{i.href.indexOf("shorts/")!==-1&&(W(i),W(i.closest("ytd-video-renderer")),W(i.closest("ytd-compact-video-renderer")),W(i.closest("ytd-rich-grid-media")))}),document.querySelectorAll("yt-chip-cloud-chip-renderer:not(.goodTube_hidden):not(.goodTube_checked), yt-tab-shape:not(.goodTube_hidden):not(.goodTube_checked), ytd-guide-entry-renderer:not(.goodTube_checked)").forEach(i=>{i.innerHTML.toLowerCase().indexOf("shorts")!==-1&&W(i),i.classList.add("goodTube_checked")})}function Sn(){document.querySelectorAll("#description a, ytd-comments .yt-core-attributed-string a, ytm-expandable-video-description-body-renderer a, .comment-content a").forEach(t=>{!t.classList.contains("goodTube_timestampLink")&&t.getAttribute("href")&&t.getAttribute("href").indexOf(T.v)!==-1&&(t.classList.add("goodTube_timestampLink"),t.addEventListener("click",function(){let i=0,n=t.getAttribute("href").split("t=");typeof n[1]<"u"&&(i=parseFloat(n[1].replace("s",""))),Wo(i)}))})}let pt=setTimeout(()=>{},0);function Zt(){if(he==="true"&&window.location.href.indexOf("/shorts")!==-1||!z()){clearTimeout(pt),pt=setTimeout(Zt,100);return}document.querySelectorAll("video").forEach(t=>{y?!t.paused&&!t.closest("#movie_player")&&(t.muted=!0,t.volume=0,t.pause()):!t.paused&&(!qt||!t.closest("#movie_player"))&&(t.muted=!0,t.volume=0,!Qt()||!t.closest("#movie_player")?(t.pause(),t.playbackRate=Te):(t.play(),t.playbackRate=2))}),clearTimeout(pt),pt=setTimeout(Zt,100)}function In(){if(Bo)return;let e=document.querySelector("#movie_player .ytp-autonav-toggle-button");e&&(e.getAttribute("aria-checked")==="true"&&j(e),Bo=!0)}function Mn(){document.querySelectorAll("yt-confirm-dialog-renderer").forEach(t=>{if(t.innerHTML.indexOf("Video paused. Continue watching?")!==-1){let i=t.querySelector("#confirm-button");i&&j(i)}})}function Ln(e,t){if(!e||!t)return;let i=document.querySelector("ytd-watch-flexy");i&&z()&&!y&&(i.style.setProperty("--ytd-watch-flexy-width-ratio",e),i.style.setProperty("--ytd-watch-flexy-height-ratio",t))}function Yo(){let e=document.querySelector("ytd-watch-flexy");e&&(e.style.removeProperty("--ytd-watch-flexy-width-ratio"),e.style.removeProperty("--ytd-watch-flexy-height-ratio"))}let Go=setTimeout(()=>{},0);function Qo(){d=document.getElementById("movie_player");let e=!1;if(d&&typeof d.getVideoData=="function"&&(e=d.getVideoData()),!e){clearTimeout(Go),Go=setTimeout(Qo,100);return}let t="transparent";ct==="true"&&(t="#000000");let i=document.createElement("style");i.textContent=` /* Player wrapper */ #goodTube_playerWrapper { border-radius: 12px; @@ -138,7 +138,7 @@ max-width: calc(177.77777778vh - var(--ytd-watch-flexy-masthead-height) * 1.7777777778 - var(--ytd-margin-6x) * 1.7777777778 - var(--ytd-watch-flexy-space-below-player) * 1.7777777778) !important; min-width: calc(var(--ytd-watch-flexy-min-player-height) * 1.7777777778) !important; } - `,document.head.appendChild(i);let n=document.createElement("div");n.id="goodTube_playerWrapper",n.classList.add("goodTube_hidden"),document.body.appendChild(n);let l=document.createElement("iframe");l.src="https://wikipedia.org/wiki/Bruce_Lee?goodTubeProxy=1",l.setAttribute("width","100%"),l.setAttribute("height","100%"),l.setAttribute("frameborder","0"),l.setAttribute("scrolling","yes"),l.setAttribute("allow","accelerometer *; autoplay *; clipboard-write *; encrypted-media *; gyroscope *; picture-in-picture *; web-share *;"),l.setAttribute("referrerpolicy","strict-origin-when-cross-origin"),l.setAttribute("allowfullscreen",!0),l.style.display="none",n.appendChild(l),re=n,B=l,oi(),setInterval(oi,100)}let Kt=!1;function Dn(){if(y)Kt||(mt(!0),Kt=!0);else{Kt=!1;let e=document.querySelector("#player.ytd-watch-flexy");if((!e||e.offsetHeight<=0)&&(e=document.querySelector("#ytd-player")),(!e||e.offsetHeight<=0)&&(e=document.querySelector(".player-size")),(!e||e.offsetHeight<=0)&&(e=document.querySelector(".html5-video-player")),e&&e.offsetHeight>0){let t=e.getBoundingClientRect();re.style.top=t.top+window.scrollY+"px",re.style.left=t.left+window.scrollX+"px",re.style.width=e.offsetWidth+"px",re.style.height=e.offsetHeight+"px",rt(re)}}}let xe=setTimeout(()=>{},0);function We(){d=document.getElementById("movie_player");let e=!1,t=!1;if(d&&typeof d.getVideoData=="function"&&(e=d.getVideoData(),t=e.video_id),!e||t!==T.v){clearTimeout(xe),xe=setTimeout(We,100);return}if(d&&typeof d.getPlaylist=="function"&&typeof d.getPlaylistIndex=="function"){if(te=d.getPlaylist(),Ye=d.getPlaylistIndex(),!te){clearTimeout(xe),xe=setTimeout(We,100);return}}else{clearTimeout(xe),xe=setTimeout(We,100);return}}let qo=setTimeout(()=>{},0);function jo(){if(de="",Cn(),!Fo){clearTimeout(qo),qo=setTimeout(jo,100);return}let e=0;je==="false"&&typeof T.t<"u"&&(e=parseFloat(T.t.replace("s","")));let t="false";if(typeof T.i<"u"||typeof T.index<"u"||typeof T.list<"u"?(t="true",We()):(te=!1,Ye=0),zo){z()||mt();let i="";e>0&&(i="&start="+e),B.contentWindow.postMessage("goodTube_src_https://www.youtube.com/embed/"+T.v+"?goodTubeEmbed=1&autoplay=1&goodTube_playlist="+t+"&goodTube_autoplay="+Z+"&goodTube_playbackSpeed="+Te+"&goodTube_hideInfoCards="+Ge+"&goodTube_hideEndScreen="+Qe+i,"*"),zo=!1}else B.contentWindow.postMessage("goodTube_load_"+T.v+"|||"+e+"|||"+t,"*");je==="false"&&Jt(),navigator.userAgent.toLowerCase().indexOf("firefox")!==-1&>()}let ft=setTimeout(()=>{},0);function Jt(){if(!jt){clearTimeout(ft),ft=setTimeout(Jt,100);return}d=document.getElementById("movie_player");let e=!1,t=!1;if(d&&typeof d.getVideoData=="function"&&typeof d.getCurrentTime=="function"&&(e=d.getVideoData(),t=e.video_id),!e||!t||t!==T.v){clearTimeout(ft),ft=setTimeout(Jt,100);return}let i=Math.floor(d.getCurrentTime());i>=10&&Wo(i,t)}function mt(e=!1){He||(e?(d=document.getElementById("movie_player"),d&&typeof d.pauseVideo=="function"&&typeof d.mute=="function"&&(d.pauseVideo(),d.mute())):B.contentWindow.postMessage("goodTube_stopVideo","*")),j(re)}function Wo(e,t=""){B.contentWindow.postMessage("goodTube_skipTo_"+e+"|||"+t,"*")}function Cn(){B.contentWindow.postMessage("goodTube_pause","*")}let Ze=setTimeout(()=>{},0);function gt(){if(!Wt||!jt){clearTimeout(Ze),Ze=setTimeout(gt,100);return}if(!y)B.contentWindow.postMessage("goodTube_play|||"+T.v,"*");else{d=document.getElementById("movie_player");let e=!1;if(d&&typeof d.getVideoData=="function"&&(e=d.getVideoData()),!e||T.v!==e.video_id){clearTimeout(Ze),Ze=setTimeout(gt,100);return}let t=document.querySelector("#movie_player video");if(t&&t.currentTime>=t.duration)return;d&&typeof d.playVideo=="function"&&setTimeout(()=>{d.playVideo()},100)}}function Rn(){document.addEventListener("keydown",Zo,!0),document.addEventListener("keyup",Zo,!0)}function Zo(e){if(!z()||y)return;let t=[{key:">",code:!1,ctrl:!1,shift:!0,alt:!1},{key:"<",code:!1,ctrl:!1,shift:!0,alt:!1},{key:",",code:!1,ctrl:!1,shift:!1,alt:!1},{key:".",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"arrowleft",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"arrowright",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"j",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"l",code:!1,ctrl:!1,shift:!1,alt:!1},{key:" ",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"k",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"mediaplaypause",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"m",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"f",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"c",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"o",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"w",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"=",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"-",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"w",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"a",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"s",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"d",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"[",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"]",code:!1,ctrl:!1,shift:!1,alt:!1},{key:!1,code:"numpadadd",ctrl:!1,shift:!1,alt:!1},{key:!1,code:"numpadsubtract",ctrl:!1,shift:!1,alt:!1},{key:"0",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"1",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"2",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"3",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"4",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"5",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"6",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"7",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"8",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"9",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"i",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"arrowleft",code:!1,ctrl:!0,shift:!1,alt:!1},{key:"arrowright",code:!1,ctrl:!0,shift:!1,alt:!1}],i=e.key.toLowerCase(),n=e.code.toLowerCase(),l=e.ctrlKey;e.metaKey&&(l=e.metaKey);let u=e.shiftKey,m=e.altKey,w=!1;if(t.forEach(x=>{(i===x.key||n===x.code)&&l===x.ctrl&&u===x.shift&&m===x.alt&&(w=!0)}),w){let x=e.srcElement,k=!1,ie=!1;if(x&&(typeof x.nodeName<"u"&&(k=x.nodeName.toLowerCase()),typeof x.getAttribute<"u"&&(ie=x.getAttribute("id"))),!x||k.indexOf("input")===-1&&k.indexOf("label")===-1&&k.indexOf("select")===-1&&k.indexOf("textarea")===-1&&k.indexOf("fieldset")===-1&&k.indexOf("legend")===-1&&k.indexOf("datalist")===-1&&k.indexOf("output")===-1&&k.indexOf("option")===-1&&k.indexOf("optgroup")===-1&&ie!=="contenteditable-root"){e.preventDefault(),e.stopImmediatePropagation();let pe=e.key,fe=e.keyCode;i==="mediaplaypause"&&(pe=" ",fe=32),B.contentWindow.postMessage("goodTube_shortcut_"+e.type+"_"+pe+"_"+fe+"_"+e.ctrlKey+"_"+e.metaKey+"_"+e.shiftKey+"_"+e.altKey,"*")}}}function Xt(e=!1){d=document.getElementById("movie_player"),d&&typeof d.nextVideo=="function"&&d.nextVideo(),console.log("[GoodTube] Playing next video...")}function On(){d=document.getElementById("movie_player"),d&&typeof d.previousVideo=="function"&&d.previousVideo(),console.log("[GoodTube] Playing previous video...")}let Ko=setTimeout(()=>{},0);function Jo(){if(Z==="true")Xt();else if(te){if(We(),!te||!Ye){clearTimeout(Ko),Ko=setTimeout(Jo,100);return}Ye{},0);function ei(e=!1){e||(window.top===window.self&&(console.log(` + `,document.head.appendChild(i);let n=document.createElement("div");n.id="goodTube_playerWrapper",n.classList.add("goodTube_hidden"),document.body.appendChild(n);let l=document.createElement("iframe");l.src="https://wikipedia.org/wiki/Bruce_Lee?goodTubeProxy=1",l.setAttribute("width","100%"),l.setAttribute("height","100%"),l.setAttribute("frameborder","0"),l.setAttribute("scrolling","yes"),l.setAttribute("allow","accelerometer *; autoplay *; clipboard-write *; encrypted-media *; gyroscope *; picture-in-picture *; web-share *;"),l.setAttribute("referrerpolicy","strict-origin-when-cross-origin"),l.setAttribute("allowfullscreen",!0),l.style.display="none",n.appendChild(l),re=n,B=l,oi(),setInterval(oi,100)}let Kt=!1;function Dn(){if(y)Kt||(mt(!0),Kt=!0);else{Kt=!1;let e=document.querySelector("#player.ytd-watch-flexy");if((!e||e.offsetHeight<=0)&&(e=document.querySelector("#ytd-player")),(!e||e.offsetHeight<=0)&&(e=document.querySelector(".player-size")),(!e||e.offsetHeight<=0)&&(e=document.querySelector(".html5-video-player")),e&&e.offsetHeight>0){let t=e.getBoundingClientRect();re.style.top=t.top+window.scrollY+"px",re.style.left=t.left+window.scrollX+"px",re.style.width=e.offsetWidth+"px",re.style.height=e.offsetHeight+"px",rt(re)}}}let xe=setTimeout(()=>{},0);function We(){d=document.getElementById("movie_player");let e=!1,t=!1;if(d&&typeof d.getVideoData=="function"&&(e=d.getVideoData(),t=e.video_id),!e||t!==T.v){clearTimeout(xe),xe=setTimeout(We,100);return}if(d&&typeof d.getPlaylist=="function"&&typeof d.getPlaylistIndex=="function"){if(te=d.getPlaylist(),Ye=d.getPlaylistIndex(),!te){clearTimeout(xe),xe=setTimeout(We,100);return}}else{clearTimeout(xe),xe=setTimeout(We,100);return}}let qo=setTimeout(()=>{},0);function jo(){if(de="",Cn(),!Fo){clearTimeout(qo),qo=setTimeout(jo,100);return}let e=0;je==="false"&&typeof T.t<"u"&&(e=parseFloat(T.t.replace("s","")));let t="false";if(typeof T.i<"u"||typeof T.index<"u"||typeof T.list<"u"?(t="true",We()):(te=!1,Ye=0),zo){z()||mt();let i="";e>0&&(i="&start="+e),B.contentWindow.postMessage("goodTube_src_https://www.youtube.com/embed/"+T.v+"?goodTubeEmbed=1&autoplay=1&goodTube_playlist="+t+"&goodTube_autoplay="+Z+"&goodTube_playbackSpeed="+Te+"&goodTube_hideInfoCards="+Ge+"&goodTube_hideEndScreen="+Qe+i,"*"),zo=!1}else B.contentWindow.postMessage("goodTube_load_"+T.v+"|||"+e+"|||"+t,"*");je==="false"&&Jt(),navigator.userAgent.toLowerCase().indexOf("firefox")!==-1&>()}let ft=setTimeout(()=>{},0);function Jt(){if(!jt){clearTimeout(ft),ft=setTimeout(Jt,100);return}d=document.getElementById("movie_player");let e=!1,t=!1;if(d&&typeof d.getVideoData=="function"&&typeof d.getCurrentTime=="function"&&(e=d.getVideoData(),t=e.video_id),!e||!t||t!==T.v){clearTimeout(ft),ft=setTimeout(Jt,100);return}let i=Math.floor(d.getCurrentTime());i>=10&&Wo(i,t)}function mt(e=!1){He||(e?(d=document.getElementById("movie_player"),d&&typeof d.pauseVideo=="function"&&typeof d.mute=="function"&&(d.pauseVideo(),d.mute())):B.contentWindow.postMessage("goodTube_stopVideo","*")),W(re)}function Wo(e,t=""){B.contentWindow.postMessage("goodTube_skipTo_"+e+"|||"+t,"*")}function Cn(){B.contentWindow.postMessage("goodTube_pause","*")}let Ze=setTimeout(()=>{},0);function gt(){if(!Wt||!jt){clearTimeout(Ze),Ze=setTimeout(gt,100);return}if(!y)B.contentWindow.postMessage("goodTube_play|||"+T.v,"*");else{d=document.getElementById("movie_player");let e=!1;if(d&&typeof d.getVideoData=="function"&&(e=d.getVideoData()),!e||T.v!==e.video_id){clearTimeout(Ze),Ze=setTimeout(gt,100);return}let t=document.querySelector("#movie_player video");if(t&&t.currentTime>=t.duration)return;d&&typeof d.playVideo=="function"&&setTimeout(()=>{d.playVideo()},100)}}function Rn(){document.addEventListener("keydown",Zo,!0),document.addEventListener("keyup",Zo,!0)}function Zo(e){if(!z()||y)return;let t=[{key:">",code:!1,ctrl:!1,shift:!0,alt:!1},{key:"<",code:!1,ctrl:!1,shift:!0,alt:!1},{key:",",code:!1,ctrl:!1,shift:!1,alt:!1},{key:".",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"arrowleft",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"arrowright",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"j",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"l",code:!1,ctrl:!1,shift:!1,alt:!1},{key:" ",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"k",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"mediaplaypause",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"m",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"f",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"c",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"o",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"w",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"=",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"-",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"w",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"a",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"s",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"d",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"[",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"]",code:!1,ctrl:!1,shift:!1,alt:!1},{key:!1,code:"numpadadd",ctrl:!1,shift:!1,alt:!1},{key:!1,code:"numpadsubtract",ctrl:!1,shift:!1,alt:!1},{key:"0",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"1",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"2",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"3",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"4",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"5",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"6",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"7",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"8",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"9",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"i",code:!1,ctrl:!1,shift:!1,alt:!1},{key:"arrowleft",code:!1,ctrl:!0,shift:!1,alt:!1},{key:"arrowright",code:!1,ctrl:!0,shift:!1,alt:!1}],i=e.key.toLowerCase(),n=e.code.toLowerCase(),l=e.ctrlKey;e.metaKey&&(l=e.metaKey);let u=e.shiftKey,m=e.altKey,w=!1;if(t.forEach(x=>{(i===x.key||n===x.code)&&l===x.ctrl&&u===x.shift&&m===x.alt&&(w=!0)}),w){let x=e.srcElement,k=!1,ie=!1;if(x&&(typeof x.nodeName<"u"&&(k=x.nodeName.toLowerCase()),typeof x.getAttribute<"u"&&(ie=x.getAttribute("id"))),!x||k.indexOf("input")===-1&&k.indexOf("label")===-1&&k.indexOf("select")===-1&&k.indexOf("textarea")===-1&&k.indexOf("fieldset")===-1&&k.indexOf("legend")===-1&&k.indexOf("datalist")===-1&&k.indexOf("output")===-1&&k.indexOf("option")===-1&&k.indexOf("optgroup")===-1&&ie!=="contenteditable-root"){e.preventDefault(),e.stopImmediatePropagation();let pe=e.key,fe=e.keyCode;i==="mediaplaypause"&&(pe=" ",fe=32),B.contentWindow.postMessage("goodTube_shortcut_"+e.type+"_"+pe+"_"+fe+"_"+e.ctrlKey+"_"+e.metaKey+"_"+e.shiftKey+"_"+e.altKey,"*")}}}function Xt(e=!1){d=document.getElementById("movie_player"),d&&typeof d.nextVideo=="function"&&d.nextVideo(),console.log("[GoodTube] Playing next video...")}function On(){d=document.getElementById("movie_player"),d&&typeof d.previousVideo=="function"&&d.previousVideo(),console.log("[GoodTube] Playing previous video...")}let Ko=setTimeout(()=>{},0);function Jo(){if(Z==="true")Xt();else if(te){if(We(),!te||!Ye){clearTimeout(Ko),Ko=setTimeout(Jo,100);return}Ye{},0);function ei(e=!1){e||(window.top===window.self&&(console.log(` ================================================== ______ ________ __ / ____/___ ____ ____/ /_ __/_ __/ /_ ___ @@ -146,7 +146,7 @@ / /_/ / /_/ / /_/ / /_/ / / / / /_/ / /_/ / __/ \\____/\\____/\\____/\\____/ /_/ \\____/_____/\\___/ -==================================================`),console.log("[GoodTube] Initiating...")),window.addEventListener("message",ti),Zt(),document.addEventListener("DOMContentLoaded",$t),(document.readyState==="interactive"||document.readyState==="complete")&&$t()),!document.body||!document.head?(clearTimeout($o),$o=setTimeout(()=>{ei(!0)},1)):$t()}function $t(){Xo||(Xo=!0,zn(),vn(),kn(),Qo(),Fn(),Pn(),Rn(),Vn())}let bt=setTimeout(()=>{},0);function ti(e){if(typeof e.data=="string")if(!document.body||!document.head?(clearTimeout(bt),bt=setTimeout(()=>{ti(e)},100)):e.data==="goodTube_proxyIframe_loaded"?Fo=!0:e.data==="goodTube_playerIframe_loaded"&&(jt=!0,B.style.display="block"),e.data.indexOf("goodTube_pip_")!==-1)e.data.replace("goodTube_pip_","")==="true"?He=!0:(He=!1,typeof T.v>"u"&&mt());else if(e.data.indexOf("goodTube_playbackSpeed_")!==-1)p("goodTube_playbackSpeed",e.data.replace("goodTube_playbackSpeed_","")),Te=e.data.replace("goodTube_playbackSpeed_","");else if(e.data==="goodTube_prevVideo")On();else if(e.data==="goodTube_nextVideo")Xt();else if(e.data==="goodTube_videoEnded")Jo();else if(e.data==="goodTube_theater"&&!document.fullscreenElement){let t=document.querySelector(".ytp-size-button");t&&q(t)}else if(e.data==="goodTube_autoplay_false")p("goodTube_autoplay","false"),Z="false";else if(e.data==="goodTube_autoplay_true")p("goodTube_autoplay","true"),Z="true";else if(e.data.indexOf("goodTube_syncMainPlayer_")!==-1&&z()&&!y){let t=parseFloat(e.data.replace("goodTube_syncMainPlayer_","")),i=document.querySelector("#movie_player video");if(d=document.getElementById("movie_player"),!d||typeof d.seekTo!="function"||typeof d.playVideo!="function"||typeof d.mute!="function"||typeof d.setVolume!="function")return;i&&Math.floor(i.currentTime)!==Math.floor(t)&&!Qt()&&(qt=!0,d.playVideo(),d.seekTo(t-.5),d.mute(),d.setVolume(0),i.volume=0,i.muted=!0,clearTimeout(bt),bt=setTimeout(()=>{qt=!1},1e3))}else if(e.data==="goodTube_fallback_enable")y=!0,document.body&&!document.body.classList.contains("goodTube_fallback")&&document.body.classList.add("goodTube_fallback"),Yo(),ri(),navigator.userAgent.toLowerCase().indexOf("firefox")!==-1&>(),document.fullscreenElement&&(document.exitFullscreen(),window.setTimeout(()=>{let t=document.querySelector(".ytp-fullscreen-button");t&&q(t)},100));else if(e.data==="goodTube_fallback_disable")y=!1,document.body&&document.body.classList.contains("goodTube_fallback")&&document.body.classList.remove("goodTube_fallback"),document.fullscreenElement&&(document.exitFullscreen(),window.setTimeout(()=>{B.contentWindow.postMessage("goodTube_fullscreen","*")},100));else if(e.data.indexOf("goodTube_syncAspectRatio_")!==-1)if(window.location.href.indexOf("/shorts")!==-1)Yo();else{let t=e.data.replace("goodTube_syncAspectRatio_","").split("_");Ln(t[0],t[1])}else e.data==="goodTube_cancelPlay"&&clearTimeout(Ze)}function oi(){let e=Po;e&&(e=e.split("#")[0],e=e.split("index=")[0]);let t=window.location.href;t&&(t=t.split("#")[0],t=t.split("index=")[0]),e!==t&&(T=No(),z()?(jo(),Bn()):mt(),Po=window.location.href),z()?(Nn(),Sn(),y||In(),Mn(),Dn(),Un()):B.contentWindow.postMessage("goodTube_stopVideo","*"),En(),qe==="true"&&An()}function Vn(){let e=document.createElement("div");document.body.appendChild(e);let t=" checked";he==="true"&&(t="");let i="";Ge==="true"&&(i=" checked");let n="";Qe==="true"&&(n=" checked");let l="";lt==="true"&&(l=" checked");let u="";st==="true"&&(u=" checked");let m="";ut==="true"&&(m=" checked");let w="";qe==="true"&&(w=" checked");let x="";je==="true"&&(x=" checked");let k="";ct==="true"&&(k=" checked");let ie="",pe="",fe="",me="",ne="",vt="";ie==="default"?ie=" selected":W==="2"?pe=" selected":W==="3"?fe=" selected":W==="4"?me=" selected":W==="5"?ne=" selected":W==="6"&&(vt=" selected"),dt(e,` +==================================================`),console.log("[GoodTube] Initiating...")),window.addEventListener("message",ti),Zt(),document.addEventListener("DOMContentLoaded",$t),(document.readyState==="interactive"||document.readyState==="complete")&&$t()),!document.body||!document.head?(clearTimeout($o),$o=setTimeout(()=>{ei(!0)},1)):$t()}function $t(){Xo||(Xo=!0,zn(),vn(),kn(),Qo(),Fn(),Pn(),Rn(),Vn())}let bt=setTimeout(()=>{},0);function ti(e){if(typeof e.data=="string")if(!document.body||!document.head?(clearTimeout(bt),bt=setTimeout(()=>{ti(e)},100)):e.data==="goodTube_proxyIframe_loaded"?Fo=!0:e.data==="goodTube_playerIframe_loaded"&&(jt=!0,B.style.display="block"),e.data.indexOf("goodTube_pip_")!==-1)e.data.replace("goodTube_pip_","")==="true"?He=!0:(He=!1,typeof T.v>"u"&&mt());else if(e.data.indexOf("goodTube_playbackSpeed_")!==-1)p("goodTube_playbackSpeed",e.data.replace("goodTube_playbackSpeed_","")),Te=e.data.replace("goodTube_playbackSpeed_","");else if(e.data==="goodTube_prevVideo")On();else if(e.data==="goodTube_nextVideo")Xt();else if(e.data==="goodTube_videoEnded")Jo();else if(e.data==="goodTube_theater"&&!document.fullscreenElement){let t=document.querySelector(".ytp-size-button");t&&j(t)}else if(e.data==="goodTube_autoplay_false")p("goodTube_autoplay","false"),Z="false";else if(e.data==="goodTube_autoplay_true")p("goodTube_autoplay","true"),Z="true";else if(e.data.indexOf("goodTube_syncMainPlayer_")!==-1&&z()&&!y){let t=parseFloat(e.data.replace("goodTube_syncMainPlayer_","")),i=document.querySelector("#movie_player video");if(d=document.getElementById("movie_player"),!d||typeof d.seekTo!="function"||typeof d.playVideo!="function"||typeof d.mute!="function"||typeof d.setVolume!="function")return;i&&Math.floor(i.currentTime)!==Math.floor(t)&&!Qt()&&(qt=!0,d.playVideo(),d.seekTo(t-.5),d.mute(),d.setVolume(0),i.volume=0,i.muted=!0,clearTimeout(bt),bt=setTimeout(()=>{qt=!1},1e3))}else if(e.data==="goodTube_fallback_enable")y=!0,document.body&&!document.body.classList.contains("goodTube_fallback")&&document.body.classList.add("goodTube_fallback"),Yo(),ri(),navigator.userAgent.toLowerCase().indexOf("firefox")!==-1&>(),document.fullscreenElement&&(document.exitFullscreen(),window.setTimeout(()=>{let t=document.querySelector(".ytp-fullscreen-button");t&&j(t)},100));else if(e.data==="goodTube_fallback_disable")y=!1,document.body&&document.body.classList.contains("goodTube_fallback")&&document.body.classList.remove("goodTube_fallback"),document.fullscreenElement&&(document.exitFullscreen(),window.setTimeout(()=>{B.contentWindow.postMessage("goodTube_fullscreen","*")},100));else if(e.data.indexOf("goodTube_syncAspectRatio_")!==-1)if(window.location.href.indexOf("/shorts")!==-1)Yo();else{let t=e.data.replace("goodTube_syncAspectRatio_","").split("_");Ln(t[0],t[1])}else e.data==="goodTube_cancelPlay"&&clearTimeout(Ze)}function oi(){let e=Po;e&&(e=e.split("#")[0],e=e.split("index=")[0]);let t=window.location.href;t&&(t=t.split("#")[0],t=t.split("index=")[0]),e!==t&&(T=No(),z()?(jo(),Bn()):mt(),Po=window.location.href),z()?(Nn(),Sn(),y||In(),Mn(),Dn(),Un()):(B.contentWindow.postMessage("goodTube_stopVideo","*"),Y!=="default"&&Ho(Y)),En(),qe==="true"&&An()}function Vn(){let e=document.createElement("div");document.body.appendChild(e);let t=" checked";he==="true"&&(t="");let i="";Ge==="true"&&(i=" checked");let n="";Qe==="true"&&(n=" checked");let l="";lt==="true"&&(l=" checked");let u="";st==="true"&&(u=" checked");let m="";ut==="true"&&(m=" checked");let w="";qe==="true"&&(w=" checked");let x="";je==="true"&&(x=" checked");let k="";ct==="true"&&(k=" checked");let ie="",pe="",fe="",me="",ne="",vt="";ie==="default"?ie=" selected":Y==="2"?pe=" selected":Y==="3"?fe=" selected":Y==="4"?me=" selected":Y==="5"?ne=" selected":Y==="6"&&(vt=" selected"),dt(e,` @@ -716,7 +716,7 @@ .ytp-videowall-still { display: none !important; } - `),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,w=!1;u&&(typeof u.nodeName<"u"&&(m=u.nodeName.toLowerCase()),typeof u.getAttribute<"u"&&(w=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&&w!=="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),ni()}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"),dt(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,w=!1;u&&(typeof u.nodeName<"u"&&(m=u.nodeName.toLowerCase()),typeof u.getAttribute<"u"&&(w=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&&w!=="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),ni()}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,W(t));let i=document.querySelector(".ytp-chrome-bottom");i&&W(i);let n=document.getElementById("movie_player");n&&(n.style.pointerEvents="none");let l=document.querySelector(".ytp-caption-window-container");if(n&&W(l),!e){let u=document.createElement("div");u.setAttribute("id","goodTube_hideMuteAdsOverlay"),dt(u,`
@@ -724,7 +724,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)}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)),rt(e));let t=document.querySelector(".ytp-chrome-bottom");t&&rt(t);let i=document.getElementById("movie_player");i&&(i.style.pointerEvents="auto");let n=document.querySelector(".ytp-caption-window-container");i&&rt(n);let l=document.getElementById("goodTube_hideMuteAdsOverlay");l&&l.remove(),eo(),de="disabled"}let ii=setTimeout(()=>{},0);function ni(){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(ii),ii=setTimeout(ni,100))}let ai=setTimeout(()=>{},0);function ri(){let e=document.querySelector("#movie_player .ytp-autonav-toggle-button");e&&e.checkVisibility()?e.getAttribute("aria-checked")!==Z&&q(e):(clearTimeout(ai),ai=setTimeout(ri,100))}let di=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(di),di=setTimeout(()=>{t.currentTime===i&&eo()},100)}}}let li=!1,si=setTimeout(()=>{},0);function ui(e=!1){e||(window.addEventListener("message",ht),document.addEventListener("DOMContentLoaded",yt),(document.readyState==="interactive"||document.readyState==="complete")&&yt()),!document.body||!document.head?(clearTimeout(si),si=setTimeout(()=>{ui(!0)},1)):yt()}let ci=setTimeout(()=>{},0);function yt(){s=document.getElementById("movie_player");let e=!1;if(s&&typeof s.getVideoData=="function"&&(e=s.getVideoData()),!e){clearTimeout(ci),ci=setTimeout(yt,1);return}li||(li=!0,jn(),gi(),yi(),Zn(),Ae(),$n(),setInterval(Ii,5e3),Qn(),pi(),setInterval(pi,100),window.top.postMessage("goodTube_playerIframe_loaded","*"))}function pi(){Gn(),Xn(),qn(),ea(),T.goodTube_playlist!=="undefined"&&T.goodTube_playlist==="true"&&fi(),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=` + `);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)),rt(e));let t=document.querySelector(".ytp-chrome-bottom");t&&rt(t);let i=document.getElementById("movie_player");i&&(i.style.pointerEvents="auto");let n=document.querySelector(".ytp-caption-window-container");i&&rt(n);let l=document.getElementById("goodTube_hideMuteAdsOverlay");l&&l.remove(),eo(),de="disabled"}let ii=setTimeout(()=>{},0);function ni(){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(ii),ii=setTimeout(ni,100))}let ai=setTimeout(()=>{},0);function ri(){let e=document.querySelector("#movie_player .ytp-autonav-toggle-button");e&&e.checkVisibility()?e.getAttribute("aria-checked")!==Z&&j(e):(clearTimeout(ai),ai=setTimeout(ri,100))}let di=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(di),di=setTimeout(()=>{t.currentTime===i&&eo()},100)}}}let li=!1,si=setTimeout(()=>{},0);function ui(e=!1){e||(window.addEventListener("message",ht),document.addEventListener("DOMContentLoaded",yt),(document.readyState==="interactive"||document.readyState==="complete")&&yt()),!document.body||!document.head?(clearTimeout(si),si=setTimeout(()=>{ui(!0)},1)):yt()}let ci=setTimeout(()=>{},0);function yt(){s=document.getElementById("movie_player");let e=!1;if(s&&typeof s.getVideoData=="function"&&(e=s.getVideoData()),!e){clearTimeout(ci),ci=setTimeout(yt,1);return}li||(li=!0,jn(),gi(),yi(),Zn(),Ae(),$n(),setInterval(Ii,5e3),Qn(),pi(),setInterval(pi,100),window.top.postMessage("goodTube_playerIframe_loaded","*"))}function pi(){Gn(),Xn(),qn(),ea(),T.goodTube_playlist!=="undefined"&&T.goodTube_playlist==="true"&&fi(),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, @@ -865,7 +865,7 @@ } `),e.textContent=t,document.head.appendChild(e)}function fi(){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 mi=setTimeout(()=>{},0);function gi(){if(!document.querySelector(".ytp-play-button")){clearTimeout(mi),mi=setTimeout(gi,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)"),dt(n,` - `),n.addEventListener("click",function(){window.top.postMessage("goodTube_theater","*")}));let l=document.querySelector(".ytp-subtitles-button");if(l){wn(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 bi=setTimeout(()=>{},0);function yi(){let e=document.querySelector("#movie_player video");if(!e){clearTimeout(bi),bi=setTimeout(yi,100);return}e.addEventListener("ended",function(){Ii(!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,window.top.postMessage("goodTube_cancelPlay","*")),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 we(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()),window.top.postMessage("goodTube_cancelPlay","*")),ue=!1,e.preventDefault(),e.stopImmediatePropagation()}}function ke(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",we,!0),g.removeEventListener("touchend",we,!0),g.removeEventListener("mouseout",ke,!0),g.removeEventListener("touchcancel",ke,!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",dt(I,` + `),n.addEventListener("click",function(){window.top.postMessage("goodTube_theater","*")}));let l=document.querySelector(".ytp-subtitles-button");if(l){wn(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 bi=setTimeout(()=>{},0);function yi(){let e=document.querySelector("#movie_player video");if(!e){clearTimeout(bi),bi=setTimeout(yi,100);return}e.addEventListener("ended",function(){Ii(!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&&j(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,j(g),ce=!1,window.top.postMessage("goodTube_cancelPlay","*")),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 we(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,j(g),ce=!1,setTimeout(g.focus()),window.top.postMessage("goodTube_cancelPlay","*")),ue=!1,e.preventDefault(),e.stopImmediatePropagation()}}function ke(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",we,!0),g.removeEventListener("touchend",we,!0),g.removeEventListener("mouseout",ke,!0),g.removeEventListener("touchcancel",ke,!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",dt(I,`
2x
@@ -876,7 +876,7 @@
- `);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",we,!0),g.addEventListener("mouseup",we,!0),g.removeEventListener("touchend",we,!0),g.addEventListener("touchend",we,!0),g.removeEventListener("mouseout",ke,!0),g.addEventListener("mouseout",ke,!0),g.removeEventListener("touchcancel",ke,!0),g.addEventListener("touchcancel",ke,!0)}function Kn(e,t){s=document.getElementById("movie_player"),s&&typeof s.loadVideoById=="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"?fi():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}xi(n)}else if(e.data==="goodTube_pause")ro();else if(e.data.indexOf("goodTube_play|||")!==-1)Si(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"?_i():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 _i(){let e=document.querySelector(".ytp-fullscreen-button");e?q(e):(clearTimeout(Tt),Tt=setTimeout(_i,100))}let hi=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(hi),hi=setTimeout(()=>{ao(e)},100))}let Ti=setTimeout(()=>{},0);function xi(e){let t=document.querySelector("video");t?t.currentTime=parseFloat(e):(clearTimeout(Ti),Ti=setTimeout(()=>{xi(e)},100))}let vi=setTimeout(()=>{},0);function ro(){let e=document.querySelector("video");e?e.pause():(clearTimeout(vi),vi=setTimeout(ro,100)),window.top.postMessage("goodTube_cancelPlay","*")}let wi=setTimeout(()=>{},0);function ki(){let e=document.querySelector("video");e?e.muted=!0:(clearTimeout(wi),wi=setTimeout(ki,100))}let Ai=setTimeout(()=>{},0);function Jn(){let e=document.querySelector("video");e?e.muted=!1:(clearTimeout(Ai),Ai=setTimeout(Jn,100))}let Ei=setTimeout(()=>{},0);function Si(e){s=document.getElementById("movie_player");let t=!1;if(s&&typeof s.getVideoData=="function"&&(t=s.getVideoData()),!t||e!==t.video_id){clearTimeout(Ei),Ei=setTimeout(()=>{Si(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 Ii(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,w){return w==0?m:n(w,m%w)},l=function(m,w){var x=n(m,w);return[m/x,w/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 Mi=!1,Li=setTimeout(()=>{},0);function Di(){window.addEventListener("message",so),document.addEventListener("DOMContentLoaded",lo),(document.readyState==="interactive"||document.readyState==="complete")&&lo(),!document.body||!document.head?(clearTimeout(Li),Li=setTimeout(Di,1)):lo()}function lo(){Mi||(Mi=!0,oa(),ia(),window.top.postMessage("goodTube_proxyIframe_loaded","*"))}function oa(){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",we,!0),g.addEventListener("mouseup",we,!0),g.removeEventListener("touchend",we,!0),g.addEventListener("touchend",we,!0),g.removeEventListener("mouseout",ke,!0),g.addEventListener("mouseout",ke,!0),g.removeEventListener("touchcancel",ke,!0),g.addEventListener("touchcancel",ke,!0)}function Kn(e,t){s=document.getElementById("movie_player"),s&&typeof s.loadVideoById=="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"?fi():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}xi(n)}else if(e.data==="goodTube_pause")ro();else if(e.data.indexOf("goodTube_play|||")!==-1)Si(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"?_i():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 _i(){let e=document.querySelector(".ytp-fullscreen-button");e?j(e):(clearTimeout(Tt),Tt=setTimeout(_i,100))}let hi=setTimeout(()=>{},0);function ao(e){let t=document.querySelector("#goodTube_autoplayButton");t?t.querySelector(".ytp-autonav-toggle-button").getAttribute("aria-checked")!==e&&j(t):(clearTimeout(hi),hi=setTimeout(()=>{ao(e)},100))}let Ti=setTimeout(()=>{},0);function xi(e){let t=document.querySelector("video");t?t.currentTime=parseFloat(e):(clearTimeout(Ti),Ti=setTimeout(()=>{xi(e)},100))}let vi=setTimeout(()=>{},0);function ro(){let e=document.querySelector("video");e?e.pause():(clearTimeout(vi),vi=setTimeout(ro,100)),window.top.postMessage("goodTube_cancelPlay","*")}let wi=setTimeout(()=>{},0);function ki(){let e=document.querySelector("video");e?e.muted=!0:(clearTimeout(wi),wi=setTimeout(ki,100))}let Ai=setTimeout(()=>{},0);function Jn(){let e=document.querySelector("video");e?e.muted=!1:(clearTimeout(Ai),Ai=setTimeout(Jn,100))}let Ei=setTimeout(()=>{},0);function Si(e){s=document.getElementById("movie_player");let t=!1;if(s&&typeof s.getVideoData=="function"&&(t=s.getVideoData()),!t||e!==t.video_id){clearTimeout(Ei),Ei=setTimeout(()=>{Si(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 Ii(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,w){return w==0?m:n(w,m%w)},l=function(m,w){var x=n(m,w);return[m/x,w/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 Mi=!1,Li=setTimeout(()=>{},0);function Di(){window.addEventListener("message",so),document.addEventListener("DOMContentLoaded",lo),(document.readyState==="interactive"||document.readyState==="complete")&&lo(),!document.body||!document.head?(clearTimeout(Li),Li=setTimeout(Di,1)):lo()}function lo(){Mi||(Mi=!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;