NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name BetterTank // @match https://*.fishtank.live/* // @version 1.0.0 // @description Adds more options to Fishtank.live to make it better. // @author tankanon // @run-at document-start // @grant none // @license MIT // @updateURL https://openuserjs.org/meta/tankanon/BetterTank.meta.js // ==/UserScript== (()=>{var fe=Object.defineProperty;var ue=(e,o)=>{for(var n in o)fe(e,n,{get:o[n],enumerable:!0})};var A={};ue(A,{after:()=>me,before:()=>de,instead:()=>pe,unpatchAll:()=>Y});var H=["a","b","i"],w=new Map;function Q(e,o,n,t,i){let c=w.get(o)?.[e];if(!c)return i?Reflect.construct(o[e],n,t):o[e].apply(t,n);for(let a of c.b.values()){let m=a.call(t,n);Array.isArray(m)&&(n=m)}let r=(...a)=>i?Reflect.construct(c.o,a,t):c.o.apply(t,a);for(let a of c.i.values()){let m=r;r=(...g)=>a.call(t,g,m)}let s=r(...n);for(let a of c.a.values())s=a.call(t,n,s)??s;return s}function D(e,o,n,t){let i=w.get(e),c=i?.[o];return c?.[t].has(n)?(c[t].delete(n),H.every(r=>c[r].size===0)&&(Reflect.defineProperty(e,o,{value:c.o,writable:!0,configurable:!0})||(e[o]=c.o),delete i[o]),Object.keys(i).length==0&&w.delete(e),!0):!1}function Y(){for(let[e,o]of w.entries())for(let n in o)for(let t of H)for(let i of o[n]?.[t].keys()??[])D(e,n,i,t)}var R=e=>(o,n,t,i=!1)=>{if(typeof n[o]!="function")throw new Error(`${o} is not a function in ${n.constructor.name}`);w.has(n)||w.set(n,{});let c=w.get(n);if(!c[o]){let a=n[o];c[o]={o:a,b:new Map,i:new Map,a:new Map};let m=(p,u,l)=>{let f=Q(o,n,u,p,l);return i&&s(),f},g=new Proxy(a,{apply:(p,u,l)=>m(u,l,!1),construct:(p,u)=>m(a,u,!0),get:(p,u,l)=>u=="toString"?a.toString.bind(a):Reflect.get(p,u,l)});Reflect.defineProperty(n,o,{value:g,configurable:!0,writable:!0})||(n[o]=g)}let r=Symbol(),s=()=>D(n,o,r,e);return c[o][e].set(r,t),s};var de=R("b"),pe=R("i"),me=R("a");var he=new Set;function C(e,o){if(he[e])throw new Error(`Already exfiltrating ${e}!`);let n=Symbol(e),t=!1;return new Promise(i=>{Object.defineProperty(Object.prototype,e,{configurable:!0,enumerable:!1,set(c){if(this===Object.prototype){t=!0,Object.prototype[n]=c;return}Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:c}),(!o||o(this))&&(i(this),t||delete Object.prototype[e])},get(){return this[n]}})})}function v(...e){return document.querySelector(e.map(o=>`[class*="${o}"]`).join(""))}var T=new Set,X=new Set;function F(e){return typeof e=="function"&&!!e.isT}function O(e){return typeof e=="object"&&e!==null&&"$on"in e&&typeof e.$on=="function"}function ge(e){return"$on"in e}function ye(e){return(o,n)=>{function t(){let i=Array.from(T);T.clear();let c=Array.from(X);X.clear(),i.forEach(r=>r(o,n)),c.forEach(r=>r()),T.size&&setTimeout(t)}T.size||setTimeout(t),T.add(e)}}var E=new Map;function $(e,o={}){if(O(e)||typeof e!="object")return e;let n=o.o||new Map,t=o.op||new Map,i=Array.isArray(e),c=[],r=i?[]:Object.create(e,{});for(let l in e){let f=e[l];typeof f=="object"&&f!==null?(r[l]=O(f)?f:$(f),c.push(l)):r[l]=f}let s=l=>(f,h)=>{let d=n.get(f),y=t.get(h);d||(d=new Set,n.set(f,d)),y||(y=new Set,t.set(h,y)),d[l](h),y[l](f)},a=s("add"),m=s("delete"),g=(l,f,h)=>{n.has(l)&&n.get(l).forEach(d=>d(f,h))},p={$on:a,$off:m,_em:g,_st:()=>({o:n,op:t,r,p:u._p}),_p:void 0},u=new Proxy(r,{has(l,f){return f in p||f in l},get(...l){let[,f]=l;if(Reflect.has(p,f))return Reflect.get(p,f);let h=Reflect.get(...l);return be(u,f),i&&f in Array.prototype?_e(f,r,u,h):h},set(...l){let[f,h,d]=l,y=Reflect.get(f,h);if(Reflect.has(p,h))return Reflect.set(p,h,d);if(d&&O(y)){let x=y,M=x._st(),I=O(d)?ve(d,x):$(d,M);return Reflect.set(f,h,I),g(h,I),M.o.forEach(($e,L)=>{let K=Reflect.get(y,L),N=Reflect.get(I,L);K!==N&&x._em(L,N,K)}),!0}let b=Reflect.set(...l);return b&&(y!==d&&g(h,d,y),u._p&&u._p[1]._em(...u._p)),b}});return o.p&&(u._p=o.p),c.map(l=>{u[l]._p=[l,u]}),u}function be(e,o){E.forEach(n=>{let t=n.get(e);t||(t=new Set,n.set(e,t)),t.add(o)})}function _e(e,o,n,t){let i=(...c)=>{let r=Array.prototype[e].call(o,...c);if(o.forEach((s,a)=>n._em(String(a),s)),n._p){let[s,a]=n._p;a._em(s,n)}return r};switch(e){case"shift":case"pop":case"sort":case"reverse":case"copyWithin":return i;case"unshift":case"push":case"fill":return(...c)=>i(...c.map(r=>$(r)));case"splice":return(c,r,...s)=>i(c,r,...s.map(a=>$(a)));default:return t}}function ve(e,o){let n=o._st();return n.o&&n.o.forEach((t,i)=>{t.forEach(c=>{e.$on(i,c)})}),n.p&&(e._p=n.p),e}function B(e,o){let n=Symbol();E.has(n)||E.set(n,new Map);let t=new Map,i=ye(c);function c(){E.set(n,new Map);let r=e(),s=E.get(n);return E.delete(n),t.forEach((a,m)=>{let g=s.get(m);g&&g.forEach(k=>a.delete(k)),a.forEach(k=>m.$off(k,i))}),s.forEach((a,m)=>{a.forEach(g=>m.$on(g,i))}),t=s,o?o(r):r}return ge(e)&&e.$on(c),c()}var j=new WeakMap,Z={},ee="\u27B3\u274D",te="\u274D\u21DA",oe=`<!--${ee}-->`,we=`<!--${te}-->`;function ne(e,...o){let n=[],t="",i=(s,a)=>{if(typeof s=="function"){let m=()=>{};return n.push(Object.assign((...g)=>s(...g),{e:s,$on:g=>{m=g},_up:g=>{s=g,m()}})),a+oe}return Array.isArray(s)?s.reduce((m,g)=>i(g,m),a):a+s},c=()=>(t||(!o.length&&e.length===1&&e[0]===""?t="<!---->":t=e.reduce(function(a,m,g){return a+=m,o[g]!==void 0?i(o[g],a):a},"")),t),r=s=>{let a=re(c()),m=V(a,{i:0,e:n});return s?m(s):m()};return r.isT=!0,r._k=0,r._h=()=>[c(),n,r._k],r.key=s=>(r._k=s,r),r}function V(e,o){let n=document.createDocumentFragment(),t;for(;t=e.item(0);){if(t.nodeType===8&&t.nodeValue===ee){n.append(xe(t,o));continue}t instanceof Element&&Se(t,o),t.hasChildNodes()&&V(t.childNodes,o)(t),n.append(t),t instanceof HTMLOptionElement&&(t.selected=t.defaultSelected)}return i=>i?(i.appendChild(n),i):n}function Se(e,o){var n;let t=[],i=0,c;for(;c=e.attributes[i++];){if(o.i>=o.e.length)return;if(c.value!==oe)continue;let r=c.name,s=o.e[o.i++];if(r.charAt(0)==="@"){let a=r.substring(1);e.addEventListener(a,s),j.has(e)||j.set(e,new Map),(n=j.get(e))===null||n===void 0||n.set(a,s),t.push(r)}else{let a=r==="value"&&"value"in e||r==="checked"||r.startsWith(".")&&(r=r.substring(1));B(s,m=>{a&&(e[r]=m,e.getAttribute(r)!=m&&(m=!1)),m!==!1?e.setAttribute(r,m):(e.removeAttribute(r),i--)})}}t.forEach(r=>e.removeAttribute(r))}function ke(e){e.forEach(Ee)}function Ee(e){var o;e.remove(),(o=j.get(e))===null||o===void 0||o.forEach((n,t)=>e.removeEventListener(t,n))}function xe(e,o){let n=document.createDocumentFragment();e.remove();let t=o.e[o.i++];if(t&&F(t.e))n.appendChild(U().add(t.e)());else{let i;n.appendChild((i=B(t,c=>Ce(c,i)))())}return n}function Ce(e,o){let n=typeof o=="function",t=n?o:U();return Array.isArray(e)?e.forEach(i=>t.add(i)):t.add(e),n&&t._up(),t}function re(e){var o;let t=((o=Z[e])!==null&&o!==void 0?o:(()=>{let i=document.createElement("template");return i.innerHTML=e,Z[e]=i})()).content.cloneNode(!0);return t.normalize(),t.childNodes}function U(e=Symbol()){let o="",n={i:0,e:[]},t=[],i=[],c=new Map,r=[],s=()=>{let p;if(t.length||m(),t.length===1&&!F(t[0].tpl)){let u=t[0];u.dom.length?u.dom[0].nodeValue=u.tpl:u.dom.push(document.createTextNode(u.tpl)),p=u.dom[0]}else p=g(V(re(o),n)());return a(),p};s.ch=()=>i,s.l=0,s.add=p=>{if(!p&&p!==0)return s;let u=[],l,f="";F(p)&&([f,u,l]=p._h()),o+=f,o+=we;let h=l&&c.get(l),d=h||{html:f,exp:u,dom:[],tpl:p,key:l};return t.push(d),l&&(h?h.exp.forEach((y,b)=>y._up(u[b].e)):c.set(l,d)),n.e.push(...u),s.l++,s},s._up=()=>{let p=U(e),u=0,l=i[0].dom[0];t.length||m(document.createComment(""));let f=()=>{if(!p.l)return;let d=p(),y=d.lastChild;l[u?"after":"before"](d),k(p,t,u),l=y};t.forEach((d,y)=>{let b=i[y];d.key&&d.dom.length?(f(),(!b||b.dom!==d.dom)&&l[y?"after":"before"](...d.dom),l=d.dom[d.dom.length-1]):b&&d.html===b.html&&!b.key?(f(),b.exp.forEach((x,M)=>x._up(d.exp[M].e)),d.exp=b.exp,d.dom=b.dom,l=d.dom[d.dom.length-1],Te(d)&&l instanceof Text&&(l.nodeValue=d.tpl)):(b&&d.html!==b.html&&!b.key&&r.push(...b.dom),p.l||(u=y),p.add(d.tpl))}),f();let h=l?.nextSibling;for(;h&&e in h;)r.push(h),h=h.nextSibling;ke(r),a()};let a=()=>{r.length=0,o="",s.l=0,n={i:0,e:[]},i=[...t],t=[]},m=p=>{o="<!---->",t.push({html:o,exp:[],dom:p?[p]:[],tpl:ne`${o}`,key:0})},g=p=>{let u=0,l=[];return p.childNodes.forEach(f=>{if(f.nodeType===8&&f.data===te){u++,l.push(f);return}Object.defineProperty(f,e,{value:e}),t[u].dom.push(f)}),l.forEach(f=>f.remove()),p},k=(p,u,l)=>{p.ch().forEach((f,h)=>{u[l+h].dom=f.dom})};return s}function Te(e){return e.dom.length===1&&!F(e.tpl)}var _=ne,ie=$,se=B;var ce=()=>Array.from(v("AdditionalLinksPanel_additional-links-panel__").firstChild.classList);async function le(e,o){v("UserPanelTokens_tokens_").click(),setTimeout(()=>{v("ModalHeader_modal-header__").firstChild.innerText=e;let n=v("TokensModal_tokens-modal__");n.innerHTML="",o(n)},0)}var q=localStorage.getItem("BT_SETTINGS");q||(q="{}");var S=ie({value:JSON.parse(q)});se(()=>{localStorage.setItem("BT_SETTINGS",JSON.stringify(S.value))});var z=document.head.appendChild(document.createElement("style"));_`${()=>S.value.HidePaidContent?'[class^="AdditionalLinksPanel_additional-links-panel__"] :nth-child(-n+3), [class^="ChatInput_tts-button__"], [class^="UserPanelTokens_tokens_"] { display: none !important; }':""}`(z);_`${()=>S.value.HideChat?` [class^="Chat_chat__"] { visibility: hidden; pointer-events: none; } `:""}`(z);_`${()=>S.value.DisableFilter?` [class^="AppShell_app-shell__"]:after { all: unset !important; } `:""}`(z);function P(e,o){return _` <label for="${e}"> <input checked="${()=>S.value[e]??null}" @change="${n=>{S.value[e]=!S.value[e]}}" type="checkbox" id="${e}" />${o}</label > `}function J(){return _`<div style="display: grid; grid-template-columns: 1fr 1fr; width: 500px;grid-gap: 10px; flex: 50%; flex-grow: 1;" > ${P("HidePaidContent","Hide Paid Content")} ${P("HideChat","Hide Chat")} ${P("DisableFilter","Disable CRT Filter")} </div>`}function W(){let e=ce();return _`<button @click="${()=>le("BetterTank Settings",J())}" style="margin: 8px" class="${e.join(" ")}">BetterTank Settings</button>`}var G,ae;Promise.all([C("createContext").then(e=>G=e),C("createRoot").then(e=>ae=e)]).then(()=>{let e={};function o(t,i,c){return A.after("useContext",G,function(r,s){if(typeof s[t]==i)return c(s)})}let n=!1;o("signUpAndLogIn","function",t=>{e.account=t}),o("chatMessages","object",()=>{let t=v("Footer_footer__");t&&!n&&(n=!0,W()(t.parentElement),v("LiveStreamsList_filler__").innerHTML.includes("Offline")&&document.getElementById("live-streams-grid").replaceWith(_`<iframe style="width: 100%; height: 100%" src="https://www.youtube.com/embed/TCeUNxKJuJg" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen ></iframe>`()))}),o("signUpAndLogIn","function",t=>{t.currentUser||(t.currentUser={displayName:"Sam Hyde",emailVerified:!0}),t.hasSeasonPass=!0})});setTimeout(()=>{document.getElementById("__next")&&(!G||!ae)&&document.location.reload()},250);})();