diff --git a/goodtube.js b/goodtube.js
index 2c7e328..8b35a73 100644
--- a/goodtube.js
+++ b/goodtube.js
@@ -477,6 +477,22 @@
if (goodTube_videosPerRow !== 'default') {
// Debug message
console.log('[GoodTube] Videos per row on the home page set to ' + goodTube_videosPerRow);
+
+ let fixedWidthPercentage = (100 / parseFloat(goodTube_videosPerRow)) + '%';
+
+ cssOutput += `
+ ytd-rich-item-renderer[rendered-from-rich-grid] {
+ width: calc(` + fixedWidthPercentage + ` - ((var(--ytd-rich-grid-item-margin) / 2)) / ` + parseFloat(goodTube_videosPerRow - 1) + ` * ` + (parseFloat(goodTube_videosPerRow - 1) * 2) + ` ) !important;
+ width: calc(` + fixedWidthPercentage + ` - ((var(--ytd-rich-grid-item-margin) / 2)) / ` + parseFloat(goodTube_videosPerRow - 1) + ` * ` + (parseFloat(goodTube_videosPerRow - 1) * 2) + ` ) !important;
+ margin-left: calc(var(--ytd-rich-grid-item-margin) / 2) !important;
+ margin-right: calc(var(--ytd-rich-grid-item-margin) / 2) !important;
+ }
+
+ #contents.ytd-rich-grid-renderer {
+ padding-right: 24px !important;
+ box-sizing: border-box !important;
+ }
+ `;
}
// Add the styles to the page
@@ -485,33 +501,6 @@
document.head.appendChild(style);
}
- // Set videos per row on the home page
- let goodTube_youtube_setVideosPerRow_timeout = setTimeout(() => {}, 0);
- function goodTube_youtube_setVideosPerRow(videosPerRow) {
- // Make sure we're on the home page
- let currentUrl = window.location.href;
- currentUrl = currentUrl.replace('https://', '').replace('http://', '');
- let bits = currentUrl.split('/');
- if (bits.length <= 2) {
- // Target the aspect ratio element with the CSS variables
- let variableElement = document.querySelector('ytd-rich-grid-renderer #contents');
-
- // Make sure we found the variable element, if not retry
- if (!variableElement) {
- clearTimeout(goodTube_youtube_setVideosPerRow_timeout);
- goodTube_youtube_setVideosPerRow_timeout = setTimeout(() => { goodTube_youtube_setVideosPerRow(videosPerRow); }, 100);
- return;
- }
-
- // Set the videos per row
- variableElement.style.setProperty("--ytd-rich-grid-items-per-row", videosPerRow);
- variableElement.style.setProperty("--ytd-rich-grid-posts-per-row", videosPerRow);
- variableElement.style.setProperty("--ytd-rich-grid-slim-items-per-row", videosPerRow);
- variableElement.style.setProperty("--ytd-rich-grid-game-cards-per-row", videosPerRow);
- variableElement.style.setProperty("--ytd-rich-grid-mini-game-cards-per-row", videosPerRow);
- }
- }
-
// Hide members only videos
function goodTube_youtube_hideMembersOnlyVideos() {
let videos = document.querySelectorAll('ytd-rich-item-renderer:not(.goodTube_checked)');
@@ -2116,12 +2105,6 @@
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', '*');
-
- // 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)
@@ -2193,6 +2176,8 @@
let videosPerRow_4 = '';
let videosPerRow_5 = '';
let videosPerRow_6 = '';
+ let videosPerRow_7 = '';
+ let videosPerRow_8 = '';
if (videosPerRow_default === 'default') {
videosPerRow_default = ' selected';
}
@@ -2211,6 +2196,12 @@
else if (goodTube_videosPerRow === '6') {
videosPerRow_6 = ' selected';
}
+ else if (goodTube_videosPerRow === '7') {
+ videosPerRow_7 = ' selected';
+ }
+ else if (goodTube_videosPerRow === '8') {
+ videosPerRow_8 = ' selected';
+ }
// Add content to the menu container
goodTube_helper_innerHTML(menuContainer, `
@@ -2286,6 +2277,8 @@
+
+
diff --git a/goodtube.min.js b/goodtube.min.js
index 0f1ec7c..5c1344c 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 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{(function(){"use strict";var en=Object.defineProperty,f=(e,t)=>en(e,"name",{value:t,configurable:!0}),{entries:wo,setPrototypeOf:ko,isFrozen:tn,getPrototypeOf:on,getOwnPropertyDescriptor:nn}=Object,{freeze:N,seal:z,create:Bt}=Object,{apply:Vt,construct:zt}=typeof Reflect<"u"&&Reflect;N||(N=f(function(e){return e},"freeze")),z||(z=f(function(e){return e},"seal")),Vt||(Vt=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]:tt;ko&&ko(e,null);let n=t.length;for(;n--;){let l=t[n];if(typeof l=="string"){let u=i(l);u!==l&&(tn(t)||(t[n]=u),l=u)}e[l]=!0}return e}f(c,"addToSet");function So(e){for(let t=0;t/gm),fn=z(/\$\{[\w\W]*/gm),mn=z(/^data-[\-\w.\u00B7-\uFFFF]+$/),gn=z(/^aria-[\-\w]+$/),Co=z(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),bn=z(/^(?:\w+script|data):/i),yn=z(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ro=z(/^html$/i),_n=z(/^[a-z][.\w]*(-[.\w]+)+$/i),Oo=Object.freeze({__proto__:null,ARIA_ATTR:gn,ATTR_WHITESPACE:yn,CUSTOM_ELEMENT:_n,DATA_ATTR:mn,DOCTYPE_NAME:Ro,ERB_EXPR:pn,IS_ALLOWED_URI:Co,IS_SCRIPT_OR_DATA:bn,MUSTACHE_EXPR:cn,TMPLIT_EXPR:fn}),Ve={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},hn=f(function(){return typeof window>"u"?null:window},"getGlobal"),Tn=f(function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let i=null,n="data-tt-policy-suffix";t&&t.hasAttribute(n)&&(i=t.getAttribute(n));let l="dompurify"+(i?"#"+i:"");try{return e.createPolicy(l,{createHTML(u){return u},createScriptURL(u){return u}})}catch{return console.warn("TrustedTypes policy "+l+" could not be created."),null}},"_createTrustedTypesPolicy"),No=f(function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},"_createHooksMap");function jt(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:hn(),t=f(o=>jt(o),"DOMPurify");if(t.version="3.3.0",t.removed=[],!e||!e.document||e.document.nodeType!==Ve.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,ht=_e(ne,"cloneNode"),Tt=_e(ne,"remove"),xt=_e(ne,"nextSibling"),vt=_e(ne,"childNodes"),ae=_e(ne,"parentNode");if(typeof m=="function"){let o=i.createElement("template");o.content&&o.content.ownerDocument&&(i=o.content.ownerDocument)}let A,M="",{implementation:Se,createNodeIterator:wt,createDocumentFragment:kt,getElementsByTagName:We}=i,{importNode:At}=n,y=No();t.isSupported=typeof wo=="function"&&typeof ae=="function"&&Se&&Se.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:Y,ERB_EXPR:G,TMPLIT_EXPR:H,DATA_ATTR:Et,ARIA_ATTR:St,IS_SCRIPT_OR_DATA:It,ATTR_WHITESPACE:Ze,CUSTOM_ELEMENT:Mt}=Oo,{IS_ALLOWED_URI:Ke}=Oo,E=null,Ci=c({},[...Io,...Ut,...Yt,...Gt,...Mo]),L=null,Ri=c({},[...Lo,...Qt,...Do,...ot]),v=Object.seal(Bt(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}})),Je=null,po=null,Ie=Object.seal(Bt(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Oi=!0,fo=!0,Ni=!1,Pi=!0,Me=!1,Lt=!0,ge=!1,mo=!1,go=!1,Le=!1,Dt=!1,Ct=!1,Bi=!0,Vi=!1,na="user-content-",bo=!0,Xe=!1,De={},Ce=null,zi=c({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),Fi=null,Hi=c({},["audio","video","img","source","image","track"]),yo=null,Ui=c({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Rt="http://www.w3.org/1998/Math/MathML",Ot="http://www.w3.org/2000/svg",$="http://www.w3.org/1999/xhtml",Re=$,_o=!1,ho=null,aa=c({},[Rt,Ot,$],Ft),Nt=c({},["mi","mo","mn","ms","mtext"]),Pt=c({},["annotation-xml"]),ra=c({},["title","style","font","a","script"]),$e=null,da=["application/xhtml+xml","text/html"],la="text/html",S=null,Oe=null,sa=i.createElement("form"),Yi=f(function(o){return o instanceof RegExp||o instanceof Function},"isRegexOrFunction"),To=f(function(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Oe&&Oe===o)){if((!o||typeof o!="object")&&(o={}),o=q(o),$e=da.indexOf(o.PARSER_MEDIA_TYPE)===-1?la:o.PARSER_MEDIA_TYPE,S=$e==="application/xhtml+xml"?Ft:tt,E=U(o,"ALLOWED_TAGS")?c({},o.ALLOWED_TAGS,S):Ci,L=U(o,"ALLOWED_ATTR")?c({},o.ALLOWED_ATTR,S):Ri,ho=U(o,"ALLOWED_NAMESPACES")?c({},o.ALLOWED_NAMESPACES,Ft):aa,yo=U(o,"ADD_URI_SAFE_ATTR")?c(q(Ui),o.ADD_URI_SAFE_ATTR,S):Ui,Fi=U(o,"ADD_DATA_URI_TAGS")?c(q(Hi),o.ADD_DATA_URI_TAGS,S):Hi,Ce=U(o,"FORBID_CONTENTS")?c({},o.FORBID_CONTENTS,S):zi,Je=U(o,"FORBID_TAGS")?c({},o.FORBID_TAGS,S):q({}),po=U(o,"FORBID_ATTR")?c({},o.FORBID_ATTR,S):q({}),De=U(o,"USE_PROFILES")?o.USE_PROFILES:!1,Oi=o.ALLOW_ARIA_ATTR!==!1,fo=o.ALLOW_DATA_ATTR!==!1,Ni=o.ALLOW_UNKNOWN_PROTOCOLS||!1,Pi=o.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Me=o.SAFE_FOR_TEMPLATES||!1,Lt=o.SAFE_FOR_XML!==!1,ge=o.WHOLE_DOCUMENT||!1,Le=o.RETURN_DOM||!1,Dt=o.RETURN_DOM_FRAGMENT||!1,Ct=o.RETURN_TRUSTED_TYPE||!1,go=o.FORCE_BODY||!1,Bi=o.SANITIZE_DOM!==!1,Vi=o.SANITIZE_NAMED_PROPS||!1,bo=o.KEEP_CONTENT!==!1,Xe=o.IN_PLACE||!1,Ke=o.ALLOWED_URI_REGEXP||Co,Re=o.NAMESPACE||$,Nt=o.MATHML_TEXT_INTEGRATION_POINTS||Nt,Pt=o.HTML_INTEGRATION_POINTS||Pt,v=o.CUSTOM_ELEMENT_HANDLING||{},o.CUSTOM_ELEMENT_HANDLING&&Yi(o.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(v.tagNameCheck=o.CUSTOM_ELEMENT_HANDLING.tagNameCheck),o.CUSTOM_ELEMENT_HANDLING&&Yi(o.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(v.attributeNameCheck=o.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),o.CUSTOM_ELEMENT_HANDLING&&typeof o.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(v.allowCustomizedBuiltInElements=o.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Me&&(fo=!1),Dt&&(Le=!0),De&&(E=c({},Mo),L=[],De.html===!0&&(c(E,Io),c(L,Lo)),De.svg===!0&&(c(E,Ut),c(L,Qt),c(L,ot)),De.svgFilters===!0&&(c(E,Yt),c(L,Qt),c(L,ot)),De.mathMl===!0&&(c(E,Gt),c(L,Do),c(L,ot))),o.ADD_TAGS&&(typeof o.ADD_TAGS=="function"?Ie.tagCheck=o.ADD_TAGS:(E===Ci&&(E=q(E)),c(E,o.ADD_TAGS,S))),o.ADD_ATTR&&(typeof o.ADD_ATTR=="function"?Ie.attributeCheck=o.ADD_ATTR:(L===Ri&&(L=q(L)),c(L,o.ADD_ATTR,S))),o.ADD_URI_SAFE_ATTR&&c(yo,o.ADD_URI_SAFE_ATTR,S),o.FORBID_CONTENTS&&(Ce===zi&&(Ce=q(Ce)),c(Ce,o.FORBID_CONTENTS,S)),bo&&(E["#text"]=!0),ge&&c(E,["html","head","body"]),E.table&&(c(E,["tbody"]),delete Je.tbody),o.TRUSTED_TYPES_POLICY){if(typeof o.TRUSTED_TYPES_POLICY.createHTML!="function")throw Be('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof o.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Be('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');A=o.TRUSTED_TYPES_POLICY,M=A.createHTML("")}else A===void 0&&(A=Tn(me,l)),A!==null&&typeof M=="string"&&(M=A.createHTML(""));N&&N(o),Oe=o}},"_parseConfig"),Gi=c({},[...Ut,...Yt,...sn]),Qi=c({},[...Gt,...un]),ua=f(function(o){let r=ae(o);(!r||!r.tagName)&&(r={namespaceURI:Re,tagName:"template"});let a=tt(o.tagName),b=tt(r.tagName);return ho[o.namespaceURI]?o.namespaceURI===Ot?r.namespaceURI===$?a==="svg":r.namespaceURI===Rt?a==="svg"&&(b==="annotation-xml"||Nt[b]):!!Gi[a]:o.namespaceURI===Rt?r.namespaceURI===$?a==="math":r.namespaceURI===Ot?a==="math"&&Pt[b]:!!Qi[a]:o.namespaceURI===$?r.namespaceURI===Ot&&!Pt[b]||r.namespaceURI===Rt&&!Nt[b]?!1:!Qi[a]&&(ra[a]||!Gi[a]):!!($e==="application/xhtml+xml"&&ho[o.namespaceURI]):!1},"_checkValidNamespace"),be=f(function(o){Ne(t.removed,{element:o});try{ae(o).removeChild(o)}catch{Tt(o)}},"_forceRemove"),ye=f(function(o,r){try{Ne(t.removed,{attribute:r.getAttributeNode(o),from:r})}catch{Ne(t.removed,{attribute:null,from:r})}if(r.removeAttribute(o),o==="is")if(Le||Dt)try{be(r)}catch{}else try{r.setAttribute(o,"")}catch{}},"_removeAttribute"),ji=f(function(o){let r=null,a=null;if(go)o=""+o;else{let h=Ht(o,/^[\r\n\t ]+/);a=h&&h[0]}$e==="application/xhtml+xml"&&Re===$&&(o=''+o+"");let b=A?A.createHTML(o):o;if(Re===$)try{r=new fe().parseFromString(b,$e)}catch{}if(!r||!r.documentElement){r=Se.createDocument(Re,"template",null);try{r.documentElement.innerHTML=_o?M:b}catch{}}let D=r.body||r.documentElement;return o&&a&&D.insertBefore(i.createTextNode(a),D.childNodes[0]||null),Re===$?We.call(r,ge?"html":"body")[0]:ge?r.documentElement:D},"_initDocument"),qi=f(function(o){return wt.call(o.ownerDocument||o,o,k.SHOW_ELEMENT|k.SHOW_COMMENT|k.SHOW_TEXT|k.SHOW_PROCESSING_INSTRUCTION|k.SHOW_CDATA_SECTION,null)},"_createNodeIterator"),xo=f(function(o){return o instanceof pe&&(typeof o.nodeName!="string"||typeof o.textContent!="string"||typeof o.removeChild!="function"||!(o.attributes instanceof ie)||typeof o.removeAttribute!="function"||typeof o.setAttribute!="function"||typeof o.namespaceURI!="string"||typeof o.insertBefore!="function"||typeof o.hasChildNodes!="function")},"_isClobbered"),Wi=f(function(o){return typeof w=="function"&&o instanceof w},"_isNode");function X(o,r,a){et(o,b=>{b.call(t,r,a,Oe)})}f(X,"_executeHooks");let Zi=f(function(o){let r=null;if(X(y.beforeSanitizeElements,o,null),xo(o))return be(o),!0;let a=S(o.nodeName);if(X(y.uponSanitizeElement,o,{tagName:a,allowedTags:E}),Lt&&o.hasChildNodes()&&!Wi(o.firstElementChild)&&P(/<[/\w!]/g,o.innerHTML)&&P(/<[/\w!]/g,o.textContent)||o.nodeType===Ve.progressingInstruction||Lt&&o.nodeType===Ve.comment&&P(/<[/\w]/g,o.data))return be(o),!0;if(!(Ie.tagCheck instanceof Function&&Ie.tagCheck(a))&&(!E[a]||Je[a])){if(!Je[a]&&Ji(a)&&(v.tagNameCheck instanceof RegExp&&P(v.tagNameCheck,a)||v.tagNameCheck instanceof Function&&v.tagNameCheck(a)))return!1;if(bo&&!Ce[a]){let b=ae(o)||o.parentNode,D=vt(o)||o.childNodes;if(D&&b){let h=D.length;for(let ee=h-1;ee>=0;--ee){let Q=ht(D[ee],!0);Q.__removalCount=(o.__removalCount||0)+1,b.insertBefore(Q,xt(o))}}}return be(o),!0}return o instanceof x&&!ua(o)||(a==="noscript"||a==="noembed"||a==="noframes")&&P(/<\/no(script|embed|frames)/i,o.innerHTML)?(be(o),!0):(Me&&o.nodeType===Ve.text&&(r=o.textContent,et([Y,G,H],b=>{r=Pe(r,b," ")}),o.textContent!==r&&(Ne(t.removed,{element:o.cloneNode()}),o.textContent=r)),X(y.afterSanitizeElements,o,null),!1)},"_sanitizeElements"),Ki=f(function(o,r,a){if(Bi&&(r==="id"||r==="name")&&(a in i||a in sa))return!1;if(!(fo&&!po[r]&&P(Et,r))&&!(Oi&&P(St,r))&&!(Ie.attributeCheck instanceof Function&&Ie.attributeCheck(r,o))){if(!L[r]||po[r]){if(!(Ji(o)&&(v.tagNameCheck instanceof RegExp&&P(v.tagNameCheck,o)||v.tagNameCheck instanceof Function&&v.tagNameCheck(o))&&(v.attributeNameCheck instanceof RegExp&&P(v.attributeNameCheck,r)||v.attributeNameCheck instanceof Function&&v.attributeNameCheck(r,o))||r==="is"&&v.allowCustomizedBuiltInElements&&(v.tagNameCheck instanceof RegExp&&P(v.tagNameCheck,a)||v.tagNameCheck instanceof Function&&v.tagNameCheck(a))))return!1}else if(!yo[r]&&!P(Ke,Pe(a,Ze,""))&&!((r==="src"||r==="xlink:href"||r==="href")&&o!=="script"&&dn(a,"data:")===0&&Fi[o])&&!(Ni&&!P(It,Pe(a,Ze,"")))&&a)return!1}return!0},"_isValidAttribute"),Ji=f(function(o){return o!=="annotation-xml"&&Ht(o,Mt)},"_isBasicCustomElement"),Xi=f(function(o){X(y.beforeSanitizeAttributes,o,null);let{attributes:r}=o;if(!r||xo(o))return;let a={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:L,forceKeepAttr:void 0},b=r.length;for(;b--;){let D=r[b],{name:h,namespaceURI:ee,value:Q}=D,j=S(h),vo=Q,C=h==="value"?vo:ln(vo);if(a.attrName=j,a.attrValue=C,a.keepAttr=!0,a.forceKeepAttr=void 0,X(y.uponSanitizeAttribute,o,a),C=a.attrValue,Vi&&(j==="id"||j==="name")&&(ye(h,o),C=na+C),Lt&&P(/((--!?|])>)|<\/(style|title|textarea)/i,C)){ye(h,o);continue}if(j==="attributename"&&Ht(C,"href")){ye(h,o);continue}if(a.forceKeepAttr)continue;if(!a.keepAttr){ye(h,o);continue}if(!Pi&&P(/\/>/i,C)){ye(h,o);continue}Me&&et([Y,G,H],pa=>{C=Pe(C,pa," ")});let $i=S(o.nodeName);if(!Ki($i,j,C)){ye(h,o);continue}if(A&&typeof me=="object"&&typeof me.getAttributeType=="function"&&!ee)switch(me.getAttributeType($i,j)){case"TrustedHTML":{C=A.createHTML(C);break}case"TrustedScriptURL":{C=A.createScriptURL(C);break}}if(C!==vo)try{ee?o.setAttributeNS(ee,h,C):o.setAttribute(h,C),xo(o)?be(o):Ao(t.removed)}catch{ye(h,o)}}X(y.afterSanitizeAttributes,o,null)},"_sanitizeAttributes"),ca=f(function o(r){let a=null,b=qi(r);for(X(y.beforeSanitizeShadowDOM,r,null);a=b.nextNode();)X(y.uponSanitizeShadowNode,a,null),Zi(a),Xi(a),a.content instanceof u&&o(a.content);X(y.afterSanitizeShadowDOM,r,null)},"_sanitizeShadowDOM");return t.sanitize=function(o){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=null,b=null,D=null,h=null;if(_o=!o,_o&&(o=""),typeof o!="string"&&!Wi(o))if(typeof o.toString=="function"){if(o=o.toString(),typeof o!="string")throw Be("dirty is not a string, aborting")}else throw Be("toString is not a function");if(!t.isSupported)return o;if(mo||To(r),t.removed=[],typeof o=="string"&&(Xe=!1),Xe){if(o.nodeName){let j=S(o.nodeName);if(!E[j]||Je[j])throw Be("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===Ve.element&&b.nodeName==="BODY"||b.nodeName==="HTML"?a=b:a.appendChild(b);else{if(!Le&&!Me&&!ge&&o.indexOf("<")===-1)return A&&Ct?A.createHTML(o):o;if(a=ji(o),!a)return Le?null:Ct?M:""}a&&go&&be(a.firstChild);let ee=qi(Xe?o:a);for(;D=ee.nextNode();)Zi(D),Xi(D),D.content instanceof u&&ca(D.content);if(Xe)return o;if(Le){if(Dt)for(h=kt.call(a.ownerDocument);a.firstChild;)h.appendChild(a.firstChild);else h=a;return(L.shadowroot||L.shadowrootmode)&&(h=At.call(n,h,!0)),h}let Q=ge?a.outerHTML:a.innerHTML;return ge&&E["!doctype"]&&a.ownerDocument&&a.ownerDocument.doctype&&a.ownerDocument.doctype.name&&P(Ro,a.ownerDocument.doctype.name)&&(Q=""+Q),Me&&et([Y,G,H],j=>{Q=Pe(Q,j," ")}),A&&Ct?A.createHTML(Q):Q},t.setConfig=function(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};To(o),mo=!0},t.clearConfig=function(){Oe=null,mo=!1},t.isValidAttribute=function(o,r,a){Oe||To({});let b=S(o),D=S(r);return Ki(b,D,a)},t.addHook=function(o,r){typeof r=="function"&&Ne(y[o],r)},t.removeHook=function(o,r){if(r!==void 0){let a=an(y[o],r);return a===-1?void 0:rn(y[o],a,1)[0]}return Ao(y[o])},t.removeHooks=function(o){y[o]=[]},t.removeAllHooks=function(){y=No()},t}f(jt,"createDOMPurify");var Po=jt();let ze=!1;window.trustedTypes&&window.trustedTypes.createPolicy&&Po&&(ze=window.trustedTypes.createPolicy("GoodTubePolicy",{createHTML:e=>Po.sanitize(e,{RETURN_TRUSTED_TYPE:!0})}));function Bo(){let e={};if(document.location.search.replace(/\??(?:([^=]+)=([^&]*)&?)/g,function(){function t(i){return decodeURIComponent(i.split("+").join(" "))}e[t(arguments[1])]=t(arguments[2])}),F()&&typeof e.v>"u"){let t="";window.location.href.indexOf("/watch/")!==-1?t="/watch/":t="/live/";let i=window.location.href.split(t);if(i.length===2){let 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 B(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&&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=`
+ `,console.log("[GoodTube] AI summaries removed")),Ge==="true"&&console.log("[GoodTube] Members only videos removed"),O!=="default"){console.log("[GoodTube] Videos per row on the home page set to "+O);let i=100/parseFloat(O)+"%";e+=`
+ ytd-rich-item-renderer[rendered-from-rich-grid] {
+ width: calc(`+i+" - ((var(--ytd-rich-grid-item-margin) / 2)) / "+parseFloat(O-1)+" * "+parseFloat(O-1)*2+` ) !important;
+ width: calc(`+i+" - ((var(--ytd-rich-grid-item-margin) / 2)) / "+parseFloat(O-1)+" * "+parseFloat(O-1)*2+` ) !important;
+ margin-left: calc(var(--ytd-rich-grid-item-margin) / 2) !important;
+ margin-right: calc(var(--ytd-rich-grid-item-margin) / 2) !important;
+ }
+
+ #contents.ytd-rich-grid-renderer {
+ padding-right: 24px !important;
+ box-sizing: border-box !important;
+ }
+ `}let t=document.createElement("style");t.textContent=e,document.head.appendChild(t)}function kn(){document.querySelectorAll("ytd-rich-item-renderer:not(.goodTube_checked)").forEach(t=>{t.innerHTML.toLowerCase().indexOf("members only")!==-1&&Z(t),t.classList.add("goodTube_checked")})}function An(){if(he==="true")return;window.location.href.indexOf("/shorts")!==-1&&!Fo&&(window.location.href="https://youtube.com",Fo=!0),document.querySelectorAll("a:not(.goodTube_hidden)").forEach(i=>{i.href.indexOf("shorts/")!==-1&&(Z(i),Z(i.closest("ytd-video-renderer")),Z(i.closest("ytd-compact-video-renderer")),Z(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&&Z(i),i.classList.add("goodTube_checked")})}function En(){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 st=setTimeout(()=>{},0);function Jt(){if(he==="true"&&window.location.href.indexOf("/shorts")!==-1||!F()){clearTimeout(st),st=setTimeout(Jt,100);return}document.querySelectorAll("video").forEach(t=>{_?!t.paused&&!t.closest("#movie_player")&&(t.muted=!0,t.volume=0,t.pause()):!t.paused&&(!Wt||!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(st),st=setTimeout(Jt,100)}function Sn(){if(zo)return;let e=document.querySelector("#movie_player .ytp-autonav-toggle-button");e&&(e.getAttribute("aria-checked")==="true"&&W(e),zo=!0)}function In(){document.querySelectorAll("yt-confirm-dialog-renderer").forEach(t=>{if(t.innerHTML.indexOf("Video paused. Continue watching?")!==-1){let i=t.querySelector("#confirm-button");i&&W(i)}})}function Mn(e,t){if(!e||!t)return;let i=document.querySelector("ytd-watch-flexy");i&&F()&&!_&&(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";lt==="true"&&(t="#000000");let i=document.createElement("style");i.textContent=`
/* Player wrapper */
#goodTube_playerWrapper {
border-radius: 12px;
@@ -138,7 +150,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","*")),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(`
+ `,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,V=l,oi(),setInterval(oi,100)}let Xt=!1;function Ln(){if(_)Xt||(ct(!0),Xt=!0);else{Xt=!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",it(re)}}}let xe=setTimeout(()=>{},0);function je(){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(je,100);return}if(d&&typeof d.getPlaylist=="function"&&typeof d.getPlaylistIndex=="function"){if(te=d.getPlaylist(),He=d.getPlaylistIndex(),!te){clearTimeout(xe),xe=setTimeout(je,100);return}}else{clearTimeout(xe),xe=setTimeout(je,100);return}}let jo=setTimeout(()=>{},0);function qo(){if(de="",Dn(),!Uo){clearTimeout(jo),jo=setTimeout(qo,100);return}let e=0;Qe==="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",je()):(te=!1,He=0),Ho){F()||ct();let i="";e>0&&(i="&start="+e),V.contentWindow.postMessage("goodTube_src_https://www.youtube.com/embed/"+T.v+"?goodTubeEmbed=1&autoplay=1&goodTube_playlist="+t+"&goodTube_autoplay="+K+"&goodTube_playbackSpeed="+Te+"&goodTube_hideInfoCards="+Ue+"&goodTube_hideEndScreen="+Ye+i,"*"),Ho=!1}else V.contentWindow.postMessage("goodTube_load_"+T.v+"|||"+e+"|||"+t,"*");Qe==="false"&&$t(),navigator.userAgent.toLowerCase().indexOf("firefox")!==-1&&pt()}let ut=setTimeout(()=>{},0);function $t(){if(!Zt){clearTimeout(ut),ut=setTimeout($t,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(ut),ut=setTimeout($t,100);return}let i=Math.floor(d.getCurrentTime());i>=10&&Wo(i,t)}function ct(e=!1){Fe||(e?(d=document.getElementById("movie_player"),d&&typeof d.pauseVideo=="function"&&typeof d.mute=="function"&&(d.pauseVideo(),d.mute())):V.contentWindow.postMessage("goodTube_stopVideo","*")),Z(re)}function Wo(e,t=""){V.contentWindow.postMessage("goodTube_skipTo_"+e+"|||"+t,"*")}function Dn(){V.contentWindow.postMessage("goodTube_pause","*")}let qe=setTimeout(()=>{},0);function pt(){if(!Kt||!Zt){clearTimeout(qe),qe=setTimeout(pt,100);return}if(!_)V.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(qe),qe=setTimeout(pt,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 Cn(){document.addEventListener("keydown",Zo,!0),document.addEventListener("keyup",Zo,!0)}function Zo(e){if(!F()||_)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),V.contentWindow.postMessage("goodTube_shortcut_"+e.type+"_"+pe+"_"+fe+"_"+e.ctrlKey+"_"+e.metaKey+"_"+e.shiftKey+"_"+e.altKey,"*")}}}function eo(e=!1){d=document.getElementById("movie_player"),d&&typeof d.nextVideo=="function"&&d.nextVideo(),console.log("[GoodTube] Playing next video...")}function Rn(){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(K==="true")eo();else if(te){if(je(),!te||!He){clearTimeout(Ko),Ko=setTimeout(Jo,100);return}He{},0);function ei(e=!1){e||(window.top===window.self&&(console.log(`
==================================================
______ ________ __
/ ____/___ ____ ____/ /_ __/_ __/ /_ ___
@@ -146,7 +158,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&&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,`
+==================================================`),console.log("[GoodTube] Initiating...")),window.addEventListener("message",ti),Jt(),document.addEventListener("DOMContentLoaded",to),(document.readyState==="interactive"||document.readyState==="complete")&&to()),!document.body||!document.head?(clearTimeout($o),$o=setTimeout(()=>{ei(!0)},1)):to()}function to(){Xo||(Xo=!0,Vn(),xn(),wn(),Qo(),zn(),Nn(),Cn(),Bn())}let ft=setTimeout(()=>{},0);function ti(e){if(typeof e.data=="string")if(!document.body||!document.head?(clearTimeout(ft),ft=setTimeout(()=>{ti(e)},100)):e.data==="goodTube_proxyIframe_loaded"?Uo=!0:e.data==="goodTube_playerIframe_loaded"&&(Zt=!0,V.style.display="block"),e.data.indexOf("goodTube_pip_")!==-1)e.data.replace("goodTube_pip_","")==="true"?Fe=!0:(Fe=!1,typeof T.v>"u"&&ct());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")Rn();else if(e.data==="goodTube_nextVideo")eo();else if(e.data==="goodTube_videoEnded")Jo();else if(e.data==="goodTube_theater"&&!document.fullscreenElement){let t=document.querySelector(".ytp-size-button");t&&W(t)}else if(e.data==="goodTube_autoplay_false")p("goodTube_autoplay","false"),K="false";else if(e.data==="goodTube_autoplay_true")p("goodTube_autoplay","true"),K="true";else if(e.data.indexOf("goodTube_syncMainPlayer_")!==-1&&F()&&!_){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()&&(Wt=!0,d.playVideo(),d.seekTo(t-.5),d.mute(),d.setVolume(0),i.volume=0,i.muted=!0,clearTimeout(ft),ft=setTimeout(()=>{Wt=!1},1e3))}else if(e.data==="goodTube_fallback_enable")_=!0,document.body&&!document.body.classList.contains("goodTube_fallback")&&document.body.classList.add("goodTube_fallback"),Yo(),ri(),navigator.userAgent.toLowerCase().indexOf("firefox")!==-1&&pt(),document.fullscreenElement&&(document.exitFullscreen(),window.setTimeout(()=>{let t=document.querySelector(".ytp-fullscreen-button");t&&W(t)},100));else if(e.data==="goodTube_fallback_disable")_=!1,document.body&&document.body.classList.contains("goodTube_fallback")&&document.body.classList.remove("goodTube_fallback"),document.fullscreenElement&&(document.exitFullscreen(),window.setTimeout(()=>{V.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("_");Mn(t[0],t[1])}else e.data==="goodTube_cancelPlay"&&clearTimeout(qe)}function oi(){let e=Vo;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=Bo(),F()?(qo(),Pn()):ct(),Vo=window.location.href),F()?(On(),En(),_||Sn(),In(),Ln(),Fn()):V.contentWindow.postMessage("goodTube_stopVideo","*"),An(),Ge==="true"&&kn()}function Bn(){let e=document.createElement("div");document.body.appendChild(e);let t=" checked";he==="true"&&(t="");let i="";Ue==="true"&&(i=" checked");let n="";Ye==="true"&&(n=" checked");let l="";at==="true"&&(l=" checked");let u="";rt==="true"&&(u=" checked");let m="";dt==="true"&&(m=" checked");let w="";Ge==="true"&&(w=" checked");let x="";Qe==="true"&&(x=" checked");let k="";lt==="true"&&(k=" checked");let ie="",pe="",fe="",me="",ne="",ht="",Tt="",xt="";ie==="default"?ie=" selected":O==="2"?pe=" selected":O==="3"?fe=" selected":O==="4"?me=" selected":O==="5"?ne=" selected":O==="6"?ht=" selected":O==="7"?Tt=" selected":O==="8"&&(xt=" selected"),nt(e,`