@foxreis/tizentube 1.3.0 → 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.gitattributes CHANGED
File without changes
package/LICENSE CHANGED
File without changes
package/README.md CHANGED
File without changes
package/dist/service.js CHANGED
@@ -49779,11 +49779,12 @@ var apps = {
49779
49779
  allowStop: true,
49780
49780
  pid: null,
49781
49781
  launch: function launch(launchData) {
49782
- tizen.application.launchAppControl(new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/view", null, null, null, [new tizen.ApplicationControlData("module", {
49782
+ var tbPackageId = tizen.getAppInfo().packageId;
49783
+ tizen.application.launchAppControl(new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/view", null, null, null, [new tizen.ApplicationControlData("module", [JSON.stringify({
49783
49784
  moduleName: '@foxreis/tizentube',
49784
49785
  moduleType: 'npm',
49785
49786
  args: launchData
49786
- })]), 'xvvl3S1bvH.TizenBrewStandalone');
49787
+ })])]), "".concat(tbPackageId, ".TizenBrewStandalone"));
49787
49788
  }
49788
49789
  }
49789
49790
  };
@@ -1 +1 @@
1
- !function(){"use strict";function e(){e=function(){return t};var t={},n=Object.prototype,o=n.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",l=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,o){var i=t&&t.prototype instanceof p?t:p,a=Object.create(i.prototype),l=new C(o||[]);return r(a,"_invoke",{value:S(e,n,l)}),a}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var f={};function p(){}function h(){}function m(){}var v={};s(v,a,(function(){return this}));var g=Object.getPrototypeOf,y=g&&g(g(N([])));y&&y!==n&&o.call(y,a)&&(v=y);var b=m.prototype=p.prototype=Object.create(v);function w(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function k(e,t){function n(r,i,a,l){var c=d(e[r],e,i);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==typeof u&&o.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,l)}),(function(e){n("throw",e,a,l)})):t.resolve(u).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,l)}))}l(c.arg)}var i;r(this,"_invoke",{value:function(e,o){function r(){return new t((function(t,r){n(e,o,t,r)}))}return i=i?i.then(r,r):r()}})}function S(e,t,n){var o="suspendedStart";return function(r,i){if("executing"===o)throw new Error("Generator is already running");if("completed"===o){if("throw"===r)throw i;return P()}for(n.method=r,n.arg=i;;){var a=n.delegate;if(a){var l=_(a,n);if(l){if(l===f)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===o)throw o="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o="executing";var c=d(e,t,n);if("normal"===c.type){if(o=n.done?"completed":"suspendedYield",c.arg===f)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(o="completed",n.method="throw",n.arg=c.arg)}}}function _(e,t){var n=t.method,o=e.iterator[n];if(void 0===o)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,_(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;var r=d(o,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,f;var i=r.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function x(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function C(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function N(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n<e.length;)if(o.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return r.next=r}}return{next:P}}function P(){return{value:void 0,done:!0}}return h.prototype=m,r(b,"constructor",{value:m,configurable:!0}),r(m,"constructor",{value:h,configurable:!0}),h.displayName=s(m,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,s(e,c,"GeneratorFunction")),e.prototype=Object.create(b),e},t.awrap=function(e){return{__await:e}},w(k.prototype),s(k.prototype,l,(function(){return this})),t.AsyncIterator=k,t.async=function(e,n,o,r,i){void 0===i&&(i=Promise);var a=new k(u(e,n,o,r),i);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},w(b),s(b,c,"Generator"),s(b,a,(function(){return this})),s(b,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var o in t)n.push(o);return n.reverse(),function e(){for(;n.length;){var o=n.pop();if(o in t)return e.value=o,e.done=!1,e}return e.done=!0,e}},t.values=N,C.prototype={constructor:C,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!e)for(var t in this)"t"===t.charAt(0)&&o.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,o){return a.type="throw",a.arg=e,t.next=n,o&&(t.method="next",t.arg=void 0),!!o}for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var l=o.call(i,"catchLoc"),c=o.call(i,"finallyLoc");if(l&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&o.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),f},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),x(n),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var o=n.completion;if("throw"===o.type){var r=o.arg;x(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:N(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},t}function t(e,t,n,o,r,i,a){try{var l=e[i](a),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(o,r)}function n(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,i,a,l=[],c=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(o=i.call(n)).done)&&(l.push(o.value),l.length!==t);c=!0);}catch(e){s=!0,r=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw r}}return l}}(e,t)||r(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(e,t){if(e){if("string"==typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,t):void 0}}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function a(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=r(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0,i=function(){};return{s:i,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,l=!0,c=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return l=e.done,e},e:function(e){c=!0,a=e},f:function(){try{l||null==n.return||n.return()}finally{if(c)throw a}}}}!function(e){function t(e){return void 0===e?0:Number(e)}function n(e,t){return e!==t&&!(isNaN(e)&&isNaN(t))}self.DOMRect=function(e,o,r,i){var a,l,c,s,u,d,f,p;a=t(e),l=t(o),c=t(r),s=t(i),Object.defineProperties(this,{x:{get:function(){return a},set:function(e){n(a,e)&&(a=e,u=d=void 0)},enumerable:!0},y:{get:function(){return l},set:function(e){n(l,e)&&(l=e,f=p=void 0)},enumerable:!0},width:{get:function(){return c},set:function(e){n(c,e)&&(c=e,u=d=void 0)},enumerable:!0},height:{get:function(){return s},set:function(e){n(s,e)&&(s=e,f=p=void 0)},enumerable:!0},left:{get:function(){return void 0===u&&(u=a+Math.min(0,c)),u},enumerable:!0},right:{get:function(){return void 0===d&&(d=a+Math.max(0,c)),d},enumerable:!0},top:{get:function(){return void 0===f&&(f=l+Math.min(0,s)),f},enumerable:!0},bottom:{get:function(){return void 0===p&&(p=l+Math.max(0,s)),p},enumerable:!0}})}}();var l,c="ytaf-configuration",s={enableAdBlock:!0,enableSponsorBlock:!0,enableSponsorBlockSponsor:!0,enableSponsorBlockIntro:!0,enableSponsorBlockOutro:!0,enableSponsorBlockInteraction:!0,enableSponsorBlockSelfPromo:!0,enableSponsorBlockMusicOfftopic:!0,videoSpeed:1,enableDeArrow:!0,enableDeArrowThumbnails:!1,focusContainerColor:"#0f0f0f",routeColor:"#0f0f0f",enableFixedUI:!0};try{l=JSON.parse(window.localStorage[c])}catch(e){console.warn("Config read failed:",e),l=s}function u(e){return void 0===l[e]&&(console.warn("Populating key",e,"with default value",s[e]),l[e]=s[e]),l[e]}function d(e,t){console.info("Setting key",e,"to",t),l[e]=t,window.localStorage[c]=JSON.stringify(l)}var f=JSON.parse;function p(e){var t,n=a(e);try{for(n.s();!(t=n.n()).done;){var o=t.value;o.shelfRenderer&&h(o.shelfRenderer.content.horizontalListRenderer.items)}}catch(e){n.e(e)}finally{n.f()}}function h(e){var t,n=a(e);try{var o=function(){var n=t.value;if(n.adSlotRenderer){var o=e.indexOf(n);return e.splice(o,1),"continue"}if(u("enableDeArrow")){var r=n.tileRenderer.contentId;fetch(`https://sponsor.ajay.app/api/branding?videoID=${r}`).then((e=>e.json())).then((e=>{if(e.titles.length>0){var t=e.titles.reduce(((e,t)=>e.votes>t.votes?e:t));n.tileRenderer.metadata.tileMetadataRenderer.title.simpleText=t.title}if(e.thumbnails.length>0&&u("enableDeArrowThumbnails")){var o=e.thumbnails.reduce(((e,t)=>e.votes>t.votes?e:t));o.timestamp&&(n.tileRenderer.header.tileHeaderRenderer.thumbnail.thumbnails=[{url:`https://dearrow-thumb.ajay.app/api/v1/getThumbnail?videoID=${r}&time=${o.timestamp}`,width:1280,height:640}])}}))}};for(n.s();!(t=n.n()).done;)o()}catch(e){n.e(e)}finally{n.f()}}JSON.parse=function(){var e,t,n,o,r=f.apply(this,arguments);return r.adPlacements&&u("enableAdBlock")&&(r.adPlacements=[]),r.playerAds&&u("enableAdBlock")&&(r.playerAds=!1),r.adSlots&&u("enableAdBlock")&&(r.adSlots=[]),null!=r&&null!==(e=r.contents)&&void 0!==e&&null!==(e=e.tvBrowseRenderer)&&void 0!==e&&null!==(e=e.content)&&void 0!==e&&null!==(e=e.tvSurfaceContentRenderer)&&void 0!==e&&null!==(e=e.content)&&void 0!==e&&null!==(e=e.sectionListRenderer)&&void 0!==e&&e.contents&&u("enableAdBlock")&&(r.contents.tvBrowseRenderer.content.tvSurfaceContentRenderer.content.sectionListRenderer.contents=r.contents.tvBrowseRenderer.content.tvSurfaceContentRenderer.content.sectionListRenderer.contents.filter((e=>!e.adSlotRenderer))),null!=r&&null!==(t=r.contents)&&void 0!==t&&null!==(t=t.tvBrowseRenderer)&&void 0!==t&&null!==(t=t.content)&&void 0!==t&&null!==(t=t.tvSurfaceContentRenderer)&&void 0!==t&&null!==(t=t.content)&&void 0!==t&&null!==(t=t.sectionListRenderer)&&void 0!==t&&t.contents&&p(r.contents.tvBrowseRenderer.content.tvSurfaceContentRenderer.content.sectionListRenderer.contents),null!=r&&null!==(n=r.continuationContents)&&void 0!==n&&null!==(n=n.sectionListContinuation)&&void 0!==n&&n.contents&&p(r.continuationContents.sectionListContinuation.contents),null!=r&&null!==(o=r.continuationContents)&&void 0!==o&&null!==(o=o.horizontalListContinuation)&&void 0!==o&&o.items&&h(r.continuationContents.horizontalListContinuation.items),r};var m=function e(t){function n(e,t){return e>>>t|e<<32-t}for(var o,r,i=Math.pow,a=i(2,32),l="length",c="",s=[],u=8*t[l],d=e.h=e.h||[],f=e.k=e.k||[],p=f[l],h={},m=2;p<64;m++)if(!h[m]){for(o=0;o<313;o+=m)h[o]=m;d[p]=i(m,.5)*a|0,f[p++]=i(m,1/3)*a|0}for(t+="€";t[l]%64-56;)t+="\0";for(o=0;o<t[l];o++){if((r=t.charCodeAt(o))>>8)return;s[o>>2]|=r<<(3-o)%4*8}for(s[s[l]]=u/a|0,s[s[l]]=u,r=0;r<s[l];){var v=s.slice(r,r+=16),g=d;for(d=d.slice(0,8),o=0;o<64;o++){var y=v[o-15],b=v[o-2],w=d[0],k=d[4],S=d[7]+(n(k,6)^n(k,11)^n(k,25))+(k&d[5]^~k&d[6])+f[o]+(v[o]=o<16?v[o]:v[o-16]+(n(y,7)^n(y,18)^y>>>3)+v[o-7]+(n(b,17)^n(b,19)^b>>>10)|0);(d=[S+((n(w,2)^n(w,13)^n(w,22))+(w&d[1]^w&d[2]^d[1]&d[2]))|0].concat(d))[4]=d[4]+S|0}for(o=0;o<8;o++)d[o]=d[o]+g[o]|0}for(o=0;o<8;o++)for(r=3;r+1;r--){var _=d[o]>>8*r&255;c+=(_<16?0:"")+_.toString(16)}return c};!function(){if(!("navigate"in window)){var e={37:"left",38:"up",39:"right",40:"down"},t=null,n=null,o={element:null,rect:null},r=null;window.navigate=l,window.Element.prototype.spatialNavigationSearch=f,window.Element.prototype.focusableAreas=y,window.Element.prototype.getSpatialNavigationContainer=v,window.CSS&&CSS.registerProperty&&(""===window.getComputedStyle(document.documentElement).getPropertyValue("--spatial-navigation-contain")&&CSS.registerProperty({name:"--spatial-navigation-contain",syntax:"auto | contain",inherits:!1,initialValue:"auto"}),""===window.getComputedStyle(document.documentElement).getPropertyValue("--spatial-navigation-action")&&CSS.registerProperty({name:"--spatial-navigation-action",syntax:"auto | focus | scroll",inherits:!1,initialValue:"auto"}),""===window.getComputedStyle(document.documentElement).getPropertyValue("--spatial-navigation-function")&&CSS.registerProperty({name:"--spatial-navigation-function",syntax:"normal | grid",inherits:!1,initialValue:"normal"})),Y(!1),window.addEventListener("load",(()=>{i()}))}function i(){window.addEventListener("keydown",(o=>{var r=parent&&parent.__spatialNavigation__.keyMode||window.__spatialNavigation__.keyMode,i=document.activeElement,a=e[o.keyCode];if(9===o.keyCode&&(n=null),!(!r||"NONE"===r||"SHIFTARROW"===r&&!o.shiftKey||"ARROW"===r&&o.shiftKey||o.defaultPrevented)){var c={left:!0,up:!0,right:!0,down:!0};"INPUT"!==i.nodeName&&"TEXTAREA"!==i.nodeName||(c=function(t){var n=["email","date","month","number","time","week"],o=["password","text","search","tel","url",null],r=document.activeElement,i={left:!1,up:!1,right:!1,down:!1},a=e[t.keyCode];if(void 0===a)return i;if(!n.includes(r.getAttribute("type"))||"up"!==a&&"down"!==a)if(o.includes(r.getAttribute("type"))||"TEXTAREA"===r.nodeName){var l=r.selectionStart,c=r.selectionEnd;l===c&&(0===l&&(i.left=!0,i.up=!0),c===r.value.length&&(i.right=!0,i.down=!0))}else i[a]=!0;else i[a]=!0;return i}(o)),c[a]&&(o.preventDefault(),t=new Map,l(a),t=null,n=null)}})),document.addEventListener("mouseup",(e=>{n={x:e.clientX,y:e.clientY}})),window.addEventListener("focusin",(e=>{e.target!==window&&(o.element=e.target,o.rect=e.target.getBoundingClientRect())}))}function l(e){var t=function(){var e=document.activeElement;if(!e||e===document.body&&!document.querySelector(":focus")){if(o.element&&e!==o.element){var t=window.getComputedStyle(o.element,null),n=["hidden","collapse"];if(o.element.disabled||n.includes(t.getPropertyValue("visibility")))return e=o.element}e=document.documentElement}!o.element||0!==z(o.element).height&&0!==z(o.element).width||(r=o.rect);if(!I(e)){var i=g(e);if(i&&(i===window||"auto"===k(i)))return i}return e}(),i=t,a=null;n&&(null===(a=document.elementFromPoint(n.x,n.y))&&(a=document.body),A(a)&&!E(a)?n=null:i=E(a)?a:a.getSpatialNavigationContainer()),i!==document&&i!==document.documentElement||(i=document.body||document.documentElement);var l=null;if((E(i)||"BODY"===i.nodeName)&&"INPUT"!==i.nodeName){"IFRAME"===i.nodeName&&(i=i.contentDocument.documentElement),l=i;if(document.activeElement===t||document.activeElement===document.body&&t===document.documentElement){if("scroll"===k(i)){if(s(i,e))return}else if("focus"===k(i)){if(c(i.spatialNavigationSearch(e,{container:i,candidates:u(i,{mode:"all"})}),e))return}else if("auto"===k(i)&&(c(i.spatialNavigationSearch(e,{container:i}),e)||s(i,e)))return}else l=l.getSpatialNavigationContainer()}var d=(l=i.getSpatialNavigationContainer()).parentElement?l.getSpatialNavigationContainer():null;if(d||window.location===window.parent.location||(d=window.parent.document.documentElement),"scroll"===k(l)){if(s(l,e))return}else"focus"===k(l)?S(i,l,d,e,"all"):"auto"===k(l)&&S(i,l,d,e,"visible")}function c(e,t){if(e){if(!b("beforefocus",e,null,t))return!0;var o=e.getSpatialNavigationContainer();return o!==window&&"focus"===k(o)?e.focus():e.focus({preventScroll:!0}),n=null,!0}return!1}function s(e,t){return N(e,t)&&!T(e,t)?(_(e,t),!0):!e.parentElement&&!L(e,t)&&(_(e.ownerDocument.documentElement,t),!0)}function u(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{mode:"visible"},n=[];if(e.childElementCount>0){e.parentElement||(e=e.getElementsByTagName("body")[0]||document.body);var o,r=a(e.children);try{for(r.s();!(o=r.n()).done;){var i=o.value;x(i)?n.push(i):A(i)?(n.push(i),!E(i)&&i.childElementCount&&(n=n.concat(u(i,{mode:"all"})))):i.childElementCount&&(n=n.concat(u(i,{mode:"all"})))}}catch(e){r.e(e)}finally{r.f()}}return"all"===t.mode?n:n.filter(O)}function d(e,t,n,o){var r=e;return o=o||r.getSpatialNavigationContainer(),p(r,n=!n||n.length<=0?u(o):n,t,o)}function f(e,t){var o,i=this,a=[],l=[],c=function(e){var t=e.getSpatialNavigationContainer(),n=t.focusableAreas(),o=[];return n.forEach((t=>{e!==t&&M(t,e)&&o.push(t)})),o}(i);t||(t={});var s=i.getSpatialNavigationContainer(),f=u(s),p=t.container||s;t.container&&s.contains(t.container)&&(f=f.concat(u(p)));var v=t.candidates&&t.candidates.length>0?t.candidates.filter((e=>p.contains(e))):f.filter((e=>p.contains(e)&&p!==e));if(v&&v.length>0){v.forEach((e=>{e!==i&&(i.contains(e)&&i!==e?a:l).push(e)}));var g=c.filter((e=>!a.includes(e))),y=v.filter((e=>E(e)&&M(i,e))).map((e=>e.focusableAreas())).flat().filter((e=>e!==i));if(a=a.concat(g).filter((e=>p.contains(e))),(l=l.concat(y).filter((e=>p.contains(e)))).length>0&&(l=d(i,e,l,p)),r&&(o=h(i,d(i,e,a,p),e)),a&&a.length>0&&"INPUT"!==i.nodeName&&(o=function(e,t,o){return m(e,t,o,n?V:F)}(i,a,e)),(o=o||h(i,l,e))&&x(o)){var b=u(o,{mode:"all"}),w=b.length>0?i.spatialNavigationSearch(e,{candidates:b,container:o}):null;w?o=w:A(o)||(v.splice(v.indexOf(o),1),o=v.length?i.spatialNavigationSearch(e,{candidates:v,container:p}):null)}return o}return null}function p(e,t,n,o){var i,a=e.getSpatialNavigationContainer();return void 0===n?t:(i=a.parentElement&&o!==a&&!O(e)?z(a):r||z(e),!E(e)&&"BODY"!==e.nodeName||"INPUT"===e.nodeName?t.filter((t=>{var r=z(t),a="IFRAME"===t.nodeName?t.contentDocument.body:null;return o.contains(t)&&t!==e&&a!==e&&D(r,i,n)&&!R(i,r)})):t.filter((t=>{var r=z(t);return o.contains(t)&&(e.contains(t)&&R(i,r)&&t!==e||D(r,i,n))})))}function h(e,t,n){var o,i,a=e.getSpatialNavigationContainer(),l=getComputedStyle(a).getPropertyValue("--spatial-navigation-function"),c=r||z(e);if("grid"===l)(i=t.filter((e=>j(c,z(e),n)))).length>0&&(t=i),o=W;else o=U;return m(e,t,n,o)}function m(e,t,n,o){var i=null;window.location===window.parent.location||"BODY"!==e.nodeName&&"HTML"!==e.nodeName?i=r||e.getBoundingClientRect():((i=window.frameElement.getBoundingClientRect()).x=0,i.y=0);var a=Number.POSITIVE_INFINITY,l=[];if(t)for(var c=0;c<t.length;c++){var s=o(i,z(t[c]),n);s<a?(a=s,l=[t[c]]):s===a&&l.push(t[c])}return 0===l.length?null:l.length>1&&o===W?m(e,l,n,$):l[0]}function v(){var e=this;do{if(!e.parentElement){e=window.location!==window.parent.location?window.parent.document.documentElement:window.document.documentElement;break}e=e.parentElement}while(!E(e));return e}function g(e){var t=e;do{if(!t.parentElement){t=window.location!==window.parent.location?window.parent.document.documentElement:window.document.documentElement;break}t=t.parentElement}while(!C(t)||!O(t));return t!==document&&t!==document.documentElement||(t=window),t}function y(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{mode:"visible"},t=this.parentElement?this:document.body,n=Array.prototype.filter.call(t.getElementsByTagName("*"),A);return"all"===e.mode?n:n.filter(O)}function b(e,t,n,o){if(["beforefocus","notarget"].includes(e)){var r=new CustomEvent("nav"+e,{bubbles:!0,cancelable:!0,detail:{causedTarget:n,dir:o}});return t.dispatchEvent(r)}}function w(e,t){return(e.style.getPropertyValue(`--${t}`)||"").trim()}function k(e){return w(e,"spatial-navigation-action")||"auto"}function S(e,t,n,o,r){for(var i={candidates:u(t,{mode:r}),container:t};n;){if(c(e.spatialNavigationSearch(o,i),o))return;if("visible"===r&&s(t,o))return;if(!b("notarget",t,e,o))return;t===document||t===document.documentElement?window.location!==window.parent.location&&(t=(e=window.frameElement).ownerDocument.documentElement):t=n,i={candidates:u(t,{mode:r}),container:t};var a=t.getSpatialNavigationContainer();n=a!==t?a:null}i={candidates:u(t,{mode:r}),container:t},!n&&t&&c(e.spatialNavigationSearch(o,i),o)||b("notarget",i.container,e,o)&&("auto"!==k(t)||"visible"!==r||s(t,o))}function _(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(e)switch(t){case"left":e.scrollLeft-=40+n;break;case"right":e.scrollLeft+=40+n;break;case"up":e.scrollTop-=40+n;break;case"down":e.scrollTop+=40+n}}function E(e){return!e.parentElement||"IFRAME"===e.nodeName||C(e)||function(e){return"contain"===w(e,"spatial-navigation-contain")}(e)}function x(e){return"delegable"===w(e,"spatial-navigation-contain")}function C(e){var t=window.getComputedStyle(e,null),n=t.getPropertyValue("overflow-x"),o=t.getPropertyValue("overflow-y");return!!("visible"!==n&&"clip"!==n&&P(e,"left")||"visible"!==o&&"clip"!==o&&P(e,"down"))}function N(e,t){if(e&&"object"==typeof e){if(t&&"string"==typeof t){if(P(e,t)){var n=window.getComputedStyle(e,null),o=n.getPropertyValue("overflow-x"),r=n.getPropertyValue("overflow-y");switch(t){case"left":case"right":return"visible"!==o&&"clip"!==o&&"hidden"!==o;case"up":case"down":return"visible"!==r&&"clip"!==r&&"hidden"!==r}}return!1}return"HTML"===e.nodeName||"BODY"===e.nodeName||C(e)&&P(e)}}function P(e,t){if(e&&"object"==typeof e){if(!t||"string"!=typeof t)return e.scrollWidth>e.clientWidth||e.scrollHeight>e.clientHeight;switch(t){case"left":case"right":return e.scrollWidth>e.clientWidth;case"up":case"down":return e.scrollHeight>e.clientHeight}return!1}}function L(e,t){var n=!1;switch(t){case"left":n=0===e.scrollLeft;break;case"right":n=e.scrollWidth-e.scrollLeft-e.clientWidth==0;break;case"up":n=0===e.scrollTop;break;case"down":n=e.scrollHeight-e.scrollTop-e.clientHeight==0}return n}function T(e,t){if(N(e,t)){var n=e.scrollTop,o=e.scrollLeft,r=e.scrollHeight-e.clientHeight,i=e.scrollWidth-e.clientWidth;switch(t){case"left":return 0===o;case"right":return Math.abs(o-i)<=1;case"up":return 0===n;case"down":return Math.abs(n-r)<=1}}return!1}function I(e){var t=e.getBoundingClientRect(),n=g(e),o=null;return!(!R(o=n!==window?z(n):new DOMRect(0,0,window.innerWidth,window.innerHeight),t)||!R(o,t))}function A(e){return!(e.tabIndex<0||function(e){return"A"===e.tagName&&null===e.getAttribute("href")&&null===e.getAttribute("tabIndex")}(e)||function(e){return!!["BUTTON","INPUT","SELECT","TEXTAREA","OPTGROUP","OPTION","FIELDSET"].includes(e.tagName)&&e.disabled}(e)||function(e){return e.inert&&!e.ownerDocument.documentElement.inert}(e)||!function(e){return!!B(e.parentElement)&&!(!B(e)||"0"===e.style.opacity||"0px"===window.getComputedStyle(e).height||"0px"===window.getComputedStyle(e).width)}(e))&&(!!(!e.parentElement||N(e)&&P(e)||e.tabIndex>=0)||void 0)}function O(e){return!e.parentElement||B(e)&&function(e){var t=z(e);if("IFRAME"!==e.nodeName&&(t.top<0||t.left<0||t.top>e.ownerDocument.documentElement.clientHeight||t.left>e.ownerDocument.documentElement.clientWidth))return!1;var n=parseInt(e.offsetWidth)/10,o=parseInt(e.offsetHeight)/10;n=isNaN(n)?1:n,o=isNaN(o)?1:o;var r={middle:[(t.left+t.right)/2,(t.top+t.bottom)/2],leftTop:[t.left+n,t.top+o],rightBottom:[t.right-n,t.bottom-o]};for(var i in r){var a=e.ownerDocument.elementFromPoint(...r[i]);if(e===a||e.contains(a))return!0}return!1}(e)}function M(e,t){var n=z(e),o=z(t||e.getSpatialNavigationContainer());return!(n.left<o.left||n.right>o.right||n.top<o.top||n.bottom>o.bottom)}function B(e){var t=window.getComputedStyle(e,null),n=t.getPropertyValue("visibility");return"none"!==t.getPropertyValue("display")&&!["hidden","collapse"].includes(n)}function R(e,t){var n=e.left<=t.right&&e.right>=t.right,o=e.left<=t.left&&e.right>=t.left,r=e.top<=t.top&&e.bottom>=t.top,i=e.top<=t.bottom&&e.bottom>=t.bottom;return(n||o)&&(r||i)}function D(e,t,n){switch(n){case"left":return q(t,e);case"right":return q(e,t);case"up":return H(t,e);case"down":return H(e,t);default:return!1}}function q(e,t){return e.left>=t.right||e.left>=t.left&&e.right>t.right&&e.bottom>t.top&&e.top<t.bottom}function H(e,t){return e.top>=t.bottom||e.top>=t.top&&e.bottom>t.bottom&&e.left<t.right&&e.right>t.left}function j(e,t,n){switch(n){case"left":case"right":return e.bottom>t.top&&e.top<t.bottom;case"up":case"down":return e.right>t.left&&e.left<t.right;default:return!1}}function V(e,t,o){var r=G(o,n,t),i=Math.abs(r.entryPoint.x-r.exitPoint.x),a=Math.abs(r.entryPoint.y-r.exitPoint.y);return Math.sqrt(Math.pow(i,2)+Math.pow(a,2))}function F(e,t,n){var o={left:"right",right:"left",up:"bottom",down:"top"}[n];return Math.abs(e[o]-t[o])}function U(e,t,n){var o,r,i=0,a=0,l=G(n,e,t),c=Math.abs(l.entryPoint.x-l.exitPoint.x),s=Math.abs(l.entryPoint.y-l.exitPoint.y),u=Math.sqrt(Math.pow(c,2)+Math.pow(s,2)),d=function(e,t){var n={width:0,height:0,area:0},o=[Math.max(e.left,t.left),Math.max(e.top,t.top)],r=[Math.min(e.right,t.right),Math.min(e.bottom,t.bottom)];n.width=Math.abs(o[0]-r[0]),n.height=Math.abs(o[1]-r[1]),o[0]>=r[0]||o[1]>=r[1]||(n.area=Math.sqrt(n.width*n.height));return n}(e,t),f=d.area;switch(n){case"left":case"right":j(e,t,n)?a=Math.min(d.height/e.height,1):i=e.height/2,o=30*(s+i),r=5*a;break;case"up":case"down":j(e,t,n)?a=Math.min(d.width/e.width,1):i=e.width/2,o=2*(c+i),r=5*a;break;default:o=0,r=0}return u+o-r-f}function $(e,t,n){var o=G(n,e,t),r=Math.abs(o.entryPoint.x-o.exitPoint.x),i=Math.abs(o.entryPoint.y-o.exitPoint.y);return Math.sqrt(Math.pow(r,2)+Math.pow(i,2))}function W(e,t,n){var o=G(n,e,t);return"left"===n||"right"===n?Math.abs(o.entryPoint.x-o.exitPoint.x):Math.abs(o.entryPoint.y-o.exitPoint.y)}function G(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"down",t=arguments.length>1?arguments[1]:void 0,o=arguments.length>2?arguments[2]:void 0,r={entryPoint:{x:0,y:0},exitPoint:{x:0,y:0}};if(n){switch(r.exitPoint=t,e){case"left":r.entryPoint.x=o.right;break;case"up":r.entryPoint.y=o.bottom;break;case"right":r.entryPoint.x=o.left;break;case"down":r.entryPoint.y=o.top}switch(e){case"left":case"right":n.y<=o.top?r.entryPoint.y=o.top:n.y<o.bottom?r.entryPoint.y=n.y:r.entryPoint.y=o.bottom;break;case"up":case"down":n.x<=o.left?r.entryPoint.x=o.left:n.x<o.right?r.entryPoint.x=n.x:r.entryPoint.x=o.right}}else{switch(e){case"left":r.exitPoint.x=t.left,r.entryPoint.x=o.right<t.left?o.right:t.left;break;case"up":r.exitPoint.y=t.top,r.entryPoint.y=o.bottom<t.top?o.bottom:t.top;break;case"right":r.exitPoint.x=t.right,r.entryPoint.x=o.left>t.right?o.left:t.right;break;case"down":r.exitPoint.y=t.bottom,r.entryPoint.y=o.top>t.bottom?o.top:t.bottom}switch(e){case"left":case"right":H(t,o)?(r.exitPoint.y=t.top,r.entryPoint.y=o.bottom<t.top?o.bottom:t.top):H(o,t)?(r.exitPoint.y=t.bottom,r.entryPoint.y=o.top>t.bottom?o.top:t.bottom):(r.exitPoint.y=Math.max(t.top,o.top),r.entryPoint.y=r.exitPoint.y);break;case"up":case"down":q(t,o)?(r.exitPoint.x=t.left,r.entryPoint.x=o.right<t.left?o.right:t.left):q(o,t)?(r.exitPoint.x=t.right,r.entryPoint.x=o.left>t.right?o.left:t.right):(r.exitPoint.x=Math.max(t.left,o.left),r.entryPoint.x=r.exitPoint.x)}}return r}function z(e){var n=t&&t.get(e);if(!n){var o=e.getBoundingClientRect();n={top:Number(o.top.toFixed(2)),right:Number(o.right.toFixed(2)),bottom:Number(o.bottom.toFixed(2)),left:Number(o.left.toFixed(2)),width:Number(o.width.toFixed(2)),height:Number(o.height.toFixed(2))},t&&t.set(e,n)}return n}function Y(e){var t=window.__spatialNavigation__&&window.__spatialNavigation__.keyMode;window.__spatialNavigation__=!1===e?X():Object.assign(X(),function(){function e(e,t){return N(e,t)&&!T(e,t)||!e.parentElement&&!L(e,t)}function t(t,n,o,r){var i=n,a=null;if(i!==document&&i!==document.documentElement||(i=document.body||document.documentElement),(E(i)||"BODY"===i.nodeName)&&"INPUT"!==i.nodeName){"IFRAME"===i.nodeName&&(i=i.contentDocument.body);var l=u(i,r);if(Array.isArray(l)&&l.length>0)return t?d(i,o,l):i.spatialNavigationSearch(o,{candidates:l});if(e(i,o))return t?[]:i}var c=i.getSpatialNavigationContainer(),s=c.parentElement?c.getSpatialNavigationContainer():null;for(s||window.location===window.parent.location||(s=window.parent.document.documentElement);s;){var f=p(i,u(c,r),o,c);if(Array.isArray(f)&&f.length>0){if(a=i.spatialNavigationSearch(o,{candidates:f,container:c}))return t?f:a}else{if(e(c,o))return t?[]:i;if(c===document||c===document.documentElement){if(c=window.document.documentElement,window.location!==window.parent.location){if(i=window.frameElement,!(c=window.parent.document.documentElement).parentElement){s=null;break}s=c.getSpatialNavigationContainer()}}else{if(A(c)&&(i=c),!(c=s).parentElement){s=null;break}s=c.getSpatialNavigationContainer()}}}if(!s&&c){var h=p(i,u(c,r),o,c);if(Array.isArray(h)&&h.length>0&&(a=i.spatialNavigationSearch(o,{candidates:h,container:c})))return t?h:a}if(e(c,o))return i}return{isContainer:E,isScrollContainer:C,isVisibleInScroller:I,findCandidates:t.bind(null,!0),findNextTarget:t.bind(null,!1),getDistanceFromTarget:(e,t,n)=>(E(e)||"BODY"===e.nodeName)&&"INPUT"!==e.nodeName&&u(e).includes(t)?F(z(e),z(t),n):U(z(e),z(t),n)}}()),window.__spatialNavigation__.keyMode=t,Object.seal(window.__spatialNavigation__)}function X(){return{enableExperimentalAPIs:Y,get keyMode(){return this._keymode?this._keymode:"ARROW"},set keyMode(e){this._keymode=["SHIFTARROW","ARROW","NONE"].includes(e)?e:"ARROW"},setStartingPoint:function(e,t){n=e&&t?{x:e,y:t}:null}}}}();var v=".ytaf-ui-container {\r\n position: absolute;\r\n top: 10%;\r\n left: 10%;\r\n right: 10%;\r\n bottom: 10%;\r\n\r\n background: rgba(0, 0, 0, 0.8);\r\n color: white;\r\n border-radius: 20px;\r\n padding: 20px;\r\n font-size: 1.5rem;\r\n z-index: 1000;\r\n}\r\n\r\n.ytaf-ui-container :focus {\r\n outline: 4px red solid;\r\n}\r\n\r\n.ytaf-ui-container h1 {\r\n margin: 0;\r\n margin-bottom: 0.5em;\r\n text-align: center;\r\n}\r\n\r\n.ytaf-ui-container input[type='checkbox'] {\r\n width: 1.4rem;\r\n height: 1.4rem;\r\n}\r\n\r\n.ytaf-ui-container input[type='radio'] {\r\n width: 1.4rem;\r\n height: 1.4rem;\r\n}\r\n\r\n.ytaf-ui-container label {\r\n display: block;\r\n font-size: 1.4rem;\r\n}\r\n\r\n.ytaf-notification-container {\r\n position: absolute;\r\n right: 10px;\r\n bottom: 10px;\r\n font-size: 16pt;\r\n z-index: 1200;\r\n}\r\n\r\n.ytaf-notification-container .message {\r\n background: rgba(0, 0, 0, 0.7);\r\n color: white;\r\n padding: 1em;\r\n margin: 0.5em;\r\n transition: all 0.3s ease-in-out;\r\n opacity: 1;\r\n line-height: 1;\r\n border-right: 10px solid rgba(50, 255, 50, 0.3);\r\n display: inline-block;\r\n float: right;\r\n}\r\n\r\n.ytaf-notification-container .message-hidden {\r\n opacity: 0;\r\n margin: 0 0.5em;\r\n padding: 0 1em;\r\n line-height: 0;\r\n}\r\n",g=document.createElement("style");function y(){g.textContent=`\n ytlr-guide-response yt-focus-container {\n background-color: ${u("focusContainerColor")};\n }\n\n ytlr-surface-page {\n background-color: ${u("routeColor")};\n }\n\n ytlr-search-container {\n background-color: ${u("routeColor")};\n }\n\n ytlr-accounts-container {\n background-color: ${u("routeColor")};\n }\n`}document.head.appendChild(g),y();var b=setInterval((()=>{document.querySelector("video")&&(!function(){var e=document.querySelector("style[nonce]");if(e)e.textContent+=v;else{var t=document.createElement("style");t.textContent=v,document.head.appendChild(t)}if(u("enableFixedUI"))try{window.tectonicConfig.featureSwitches.isLimitedMemory=!1,window.tectonicConfig.clientData.legacyApplicationQuality="full-animation",window.tectonicConfig.featureSwitches.enableAnimations=!0,window.tectonicConfig.featureSwitches.enableOnScrollLinearAnimation=!0,window.tectonicConfig.featureSwitches.enableListAnimations=!0}catch(e){}window.__spatialNavigation__.keyMode="NONE";var n={37:"left",38:"up",39:"right",40:"down"},o=document.createElement("div");o.classList.add("ytaf-ui-container"),o.style.display="none",o.setAttribute("tabindex",0),o.addEventListener("focus",(()=>console.info("uiContainer focused!")),!0),o.addEventListener("blur",(()=>console.info("uiContainer blured!")),!0),o.addEventListener("keydown",(e=>{if(console.info("uiContainer key event:",e.type,e.keyCode),404!==e.keyCode&&172!==e.keyCode){if(e.keyCode in n)navigate(n[e.keyCode]);else if(13===e.keyCode||32===e.keyCode)document.querySelector(":focus").click();else if(27===e.keyCode&&"text"!==document.querySelector(":focus").type)o.style.display="none",o.blur();else if("text"===document.querySelector(":focus").type&&27===e.keyCode){var t=document.querySelector(":focus");t.value=t.value.slice(0,-1)}e.preventDefault(),e.stopPropagation()}}),!0),o.innerHTML='\n<h1>TizenTube Configuration</h1>\n<label for="__adblock"><input type="checkbox" id="__adblock" /> Enable AdBlocking</label>\n<label for="__fixedUI"><input type="checkbox" id="__fixedUI" /> Enable Fixed UI</label>\n<label for="__sponsorblock"><input type="checkbox" id="__sponsorblock" /> Enable SponsorBlock</label>\n<blockquote>\n<label for="__sponsorblock_sponsor"><input type="checkbox" id="__sponsorblock_sponsor" /> Skip Sponsor Segments</label>\n<label for="__sponsorblock_intro"><input type="checkbox" id="__sponsorblock_intro" /> Skip Intro Segments</label>\n<label for="__sponsorblock_outro"><input type="checkbox" id="__sponsorblock_outro" /> Skip Outro Segments</label>\n<label for="__sponsorblock_interaction"><input type="checkbox" id="__sponsorblock_interaction" /> Skip Interaction Reminder Segments</label>\n<label for="__sponsorblock_selfpromo"><input type="checkbox" id="__sponsorblock_selfpromo" /> Skip Self Promotion Segments</label>\n<label for="__sponsorblock_music_offtopic"><input type="checkbox" id="__sponsorblock_music_offtopic" /> Skip Music and Off-topic Segments</label>\n</blockquote>\n<label for="__dearrow"><input type="checkbox" id="__dearrow" /> Enable DeArrow</label>\n<blockquote>\n<label for="__dearrow_thumbnails"><input type="checkbox" id="__dearrow_thumbnails" /> Enable DeArrow Thumbnails</label>\n<div><small>DeArrow Thumbnail changing might break the shelve renderer. Be warned.</small></div>\n</blockquote>\n<label for="__barColor">Navigation Bar Color: <input type="text" id="__barColor"/></label>\n<label for="__routeColor">Main Content Color: <input type="text" id="__routeColor"/></label>\n<div><small>Sponsor segments skipping - https://sponsor.ajay.app</small></div>\n',document.querySelector("body").appendChild(o),o.querySelector("#__adblock").checked=u("enableAdBlock"),o.querySelector("#__adblock").addEventListener("change",(e=>{d("enableAdBlock",e.target.checked)})),o.querySelector("#__sponsorblock").checked=u("enableSponsorBlock"),o.querySelector("#__sponsorblock").addEventListener("change",(e=>{d("enableSponsorBlock",e.target.checked)})),o.querySelector("#__sponsorblock_sponsor").checked=u("enableSponsorBlockSponsor"),o.querySelector("#__sponsorblock_sponsor").addEventListener("change",(e=>{d("enableSponsorBlockSponsor",e.target.checked)})),o.querySelector("#__sponsorblock_intro").checked=u("enableSponsorBlockIntro"),o.querySelector("#__sponsorblock_intro").addEventListener("change",(e=>{d("enableSponsorBlockIntro",e.target.checked)})),o.querySelector("#__sponsorblock_outro").checked=u("enableSponsorBlockOutro"),o.querySelector("#__sponsorblock_outro").addEventListener("change",(e=>{d("enableSponsorBlockOutro",e.target.checked)})),o.querySelector("#__sponsorblock_interaction").checked=u("enableSponsorBlockInteraction"),o.querySelector("#__sponsorblock_interaction").addEventListener("change",(e=>{d("enableSponsorBlockInteraction",e.target.checked)})),o.querySelector("#__sponsorblock_selfpromo").checked=u("enableSponsorBlockSelfPromo"),o.querySelector("#__sponsorblock_selfpromo").addEventListener("change",(e=>{d("enableSponsorBlockSelfPromo",e.target.checked)})),o.querySelector("#__sponsorblock_music_offtopic").checked=u("enableSponsorBlockMusicOfftopic"),o.querySelector("#__sponsorblock_music_offtopic").addEventListener("change",(e=>{d("enableSponsorBlockMusicOfftopic",e.target.checked)})),o.querySelector("#__dearrow").checked=u("enableDeArrow"),o.querySelector("#__dearrow").addEventListener("change",(e=>{d("enableDeArrow",e.target.checked)})),o.querySelector("#__dearrow_thumbnails").checked=u("enableDeArrowThumbnails"),o.querySelector("#__dearrow_thumbnails").addEventListener("change",(e=>{d("enableDeArrowThumbnails",e.target.checked)})),o.querySelector("#__barColor").value=u("focusContainerColor"),o.querySelector("#__barColor").addEventListener("change",(e=>{d("focusContainerColor",e.target.value),y()})),o.querySelector("#__routeColor").value=u("routeColor"),o.querySelector("#__routeColor").addEventListener("change",(e=>{d("routeColor",e.target.value),y()})),o.querySelector("#__fixedUI").checked=u("enableFixedUI"),o.querySelector("#__fixedUI").addEventListener("change",(e=>{d("enableFixedUI",e.target.checked)}));var r=e=>(console.info("Key event:",e.type,e.keyCode,e.keyCode,e.defaultPrevented),404!=e.keyCode&&172!=e.keyCode||(console.info("Taking over!"),e.preventDefault(),e.stopPropagation(),"keydown"===e.type&&("none"===o.style.display?(console.info("Showing and focusing!"),o.style.display="block",o.focus()):(console.info("Hiding!"),o.style.display="none",o.blur())),!1));if(document.addEventListener("keydown",r,!0),document.addEventListener("keypress",r,!0),document.addEventListener("keyup",r,!0),setTimeout((()=>{w("Press [GREEN] to open TizenTube configuration screen\nPress [BLUE] to open Video Speed configuration screen")}),2e3),u("enableFixedUI"))try{new MutationObserver(((e,t)=>{var n=document.querySelector("body");n.classList.contains("app-quality-root")&&n.classList.remove("app-quality-root")})).observe(document.getElementsByTagName("body")[0],{attributes:!0,childList:!1,subtree:!1})}catch(e){}}(),clearInterval(b))}),250);function w(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3e3;if(!document.querySelector(".ytaf-notification-container")){console.info("Adding notification container");var n=document.createElement("div");n.classList.add("ytaf-notification-container"),document.body.appendChild(n)}var o=document.createElement("div"),r=document.createElement("div");r.innerText=e,r.classList.add("message"),r.classList.add("message-hidden"),o.appendChild(r),document.querySelector(".ytaf-notification-container").appendChild(o),setTimeout((()=>{r.classList.remove("message-hidden")}),100),setTimeout((()=>{r.classList.add("message-hidden"),setTimeout((()=>{o.remove()}),1e3)}),t)}var k={sponsor:{color:"#00d400",opacity:"0.7",name:"sponsored segment"},intro:{color:"#00ffff",opacity:"0.7",name:"intro"},outro:{color:"#0202ed",opacity:"0.7",name:"outro"},interaction:{color:"#cc00ff",opacity:"0.7",name:"interaction reminder"},selfpromo:{color:"#ffff00",opacity:"0.7",name:"self-promotion"},music_offtopic:{color:"#ff9900",opacity:"0.7",name:"non-music part"}};class S{constructor(e){n(this,"video",null),n(this,"active",!0),n(this,"attachVideoTimeout",null),n(this,"nextSkipTimeout",null),n(this,"sliderInterval",null),n(this,"observer",null),n(this,"scheduleSkipHandler",null),n(this,"durationChangeHandler",null),n(this,"segments",null),n(this,"skippableCategories",[]),this.videoID=e}init(){var n,o=this;return(n=e().mark((function t(){var n,r,i,a,l;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=m(o.videoID).substring(0,4),r=["sponsor","intro","outro","interaction","selfpromo","music_offtopic"],e.next=4,fetch(`https://sponsorblock.inf.re/api/skipSegments/${n}?categories=${encodeURIComponent(JSON.stringify(r))}`);case 4:return i=e.sent,e.next=7,i.json();case 7:if(a=e.sent,l=a.find((e=>e.videoID===o.videoID)),console.info(o.videoID,"Got it:",l),l&&l.segments&&l.segments.length){e.next=13;break}return console.info(o.videoID,"No segments found."),e.abrupt("return");case 13:o.segments=l.segments,o.skippableCategories=o.getSkippableCategories(),o.scheduleSkipHandler=()=>o.scheduleSkip(),o.durationChangeHandler=()=>o.buildOverlay(),o.attachVideo(),o.buildOverlay();case 19:case"end":return e.stop()}}),t)})),function(){var e=this,o=arguments;return new Promise((function(r,i){var a=n.apply(e,o);function l(e){t(a,r,i,l,c,"next",e)}function c(e){t(a,r,i,l,c,"throw",e)}l(void 0)}))})()}getSkippableCategories(){var e=[];return u("enableSponsorBlockSponsor")&&e.push("sponsor"),u("enableSponsorBlockIntro")&&e.push("intro"),u("enableSponsorBlockOutro")&&e.push("outro"),u("enableSponsorBlockInteraction")&&e.push("interaction"),u("enableSponsorBlockSelfPromo")&&e.push("selfpromo"),u("enableSponsorBlockMusicOfftopic")&&e.push("music_offtopic"),e}attachVideo(){if(clearTimeout(this.attachVideoTimeout),this.attachVideoTimeout=null,this.video=document.querySelector("video"),!this.video)return console.info(this.videoID,"No video yet..."),void(this.attachVideoTimeout=setTimeout((()=>this.attachVideo()),100));console.info(this.videoID,"Video found, binding..."),this.video.addEventListener("play",this.scheduleSkipHandler),this.video.addEventListener("pause",this.scheduleSkipHandler),this.video.addEventListener("timeupdate",this.scheduleSkipHandler),this.video.addEventListener("durationchange",this.durationChangeHandler)}buildOverlay(){if(this.segmentsoverlay)console.info("Overlay already built");else if(this.video&&this.video.duration){var e=this.video.duration;this.segmentsoverlay=document.createElement("div"),this.segments.forEach((t=>{var n=o(t.segment,2),r=n[0],i=n[1],a=k[t.category]||{color:"blue",opacity:.7},l=`translateX(${r/e*100}%) scaleX(${(i-r)/e})`,c=document.createElement("div");c.classList.add("ytlr-progress-bar__played"),c.style.background=a.color,c.style.opacity=a.opacity,c.style["-webkit-transform"]=l,console.info("Generated element",c,"from",t,l),this.segmentsoverlay.appendChild(c)})),this.observer=new MutationObserver((e=>{e.forEach((e=>{if(e.removedNodes){var t,n=a(e.removedNodes);try{for(n.s();!(t=n.n()).done;){t.value===this.segmentsoverlay&&(console.info("bringing back segments overlay"),this.slider.appendChild(this.segmentsoverlay))}}catch(e){n.e(e)}finally{n.f()}}}))})),this.sliderInterval=setInterval((()=>{this.slider=document.querySelector(".ytlr-progress-bar__slider"),this.slider&&(clearInterval(this.sliderInterval),this.sliderInterval=null,this.observer.observe(this.slider,{childList:!0}),this.slider.appendChild(this.segmentsoverlay))}),500)}else console.info("No video duration yet")}scheduleSkip(){if(clearTimeout(this.nextSkipTimeout),this.nextSkipTimeout=null,this.active)if(this.video.paused)console.info(this.videoID,"Currently paused, ignoring...");else{var e=this.segments.filter((e=>e.segment[0]>this.video.currentTime-.3&&e.segment[1]>this.video.currentTime-.3));if(e.sort(((e,t)=>e.segment[0]-t.segment[0])),e.length){var t=o(e,1)[0],n=o(t.segment,2),r=n[0],i=n[1];console.info(this.videoID,"Scheduling skip of",t,"in",r-this.video.currentTime),this.nextSkipTimeout=setTimeout((()=>{var e;if(this.video.paused)console.info(this.videoID,"Currently paused, ignoring...");else if(this.skippableCategories.includes(t.category)){var n=(null===(e=k[t.category])||void 0===e?void 0:e.name)||t.category;console.info(this.videoID,"Skipping",t),w(`Skipping ${n}`),this.video.currentTime=i,this.scheduleSkip()}else console.info(this.videoID,"Segment",t.category,"is not skippable, ignoring...")}),1e3*(r-this.video.currentTime))}else console.info(this.videoID,"No more segments")}else console.info(this.videoID,"No longer active, ignoring...")}destroy(){console.info(this.videoID,"Destroying"),this.active=!1,this.nextSkipTimeout&&(clearTimeout(this.nextSkipTimeout),this.nextSkipTimeout=null),this.attachVideoTimeout&&(clearTimeout(this.attachVideoTimeout),this.attachVideoTimeout=null),this.sliderInterval&&(clearInterval(this.sliderInterval),this.sliderInterval=null),this.observer&&(this.observer.disconnect(),this.observer=null),this.segmentsoverlay&&(this.segmentsoverlay.remove(),this.segmentsoverlay=null),this.video&&(this.video.removeEventListener("play",this.scheduleSkipHandler),this.video.removeEventListener("pause",this.scheduleSkipHandler),this.video.removeEventListener("timeupdate",this.scheduleSkipHandler),this.video.removeEventListener("durationchange",this.durationChangeHandler))}}window.sponsorblock=null,window.addEventListener("hashchange",(()=>{var e=new URL(location.hash.substring(1),location.href).search.replace("?v=","").split("&")[0],t=e&&(!window.sponsorblock||window.sponsorblock.videoID!=e);if(console.info("hashchange",e,window.sponsorblock,window.sponsorblock?window.sponsorblock.videoID:null,t),t){if(window.sponsorblock){try{window.sponsorblock.destroy()}catch(e){console.warn("window.sponsorblock.destroy() failed!",e)}window.sponsorblock=null}u("enableSponsorBlock")?(window.sponsorblock=new S(e),window.sponsorblock.init()):console.info("SponsorBlock disabled, not loading")}}),!1);var _=setInterval((()=>{document.querySelector("video")&&(!function(){var e=null,t=u("videoSpeed");window.__spatialNavigation__.keyMode="NONE";var n={37:"left",38:"up",39:"right",40:"down"},o=document.createElement("div");o.classList.add("ytaf-ui-container"),o.style.display="none",o.setAttribute("tabindex",0),o.addEventListener("focus",(()=>console.info("speedUIContainer focused!")),!0),o.addEventListener("blur",(()=>console.info("speedUIContainer blured!")),!0),o.addEventListener("navbeforefocus",(t=>{console.info("navbeforefocus",t.target),e=t.target})),o.addEventListener("keydown",(r=>{if(console.info("speedUIContainer key event:",r.type,r.keyCode),404!==r.keyCode&&172!==r.keyCode){if(r.keyCode in n)navigate(n[r.keyCode]);else if(13===r.keyCode||32===r.keyCode){if(e){e.checked=!0;var i=document.querySelector('input[name="speed"]:checked').value;d("videoSpeed",i),t=i,document.getElementsByTagName("video")[0].playbackRate=t}}else 27===r.keyCode&&(o.style.display="none",o.blur());r.preventDefault(),r.stopPropagation()}}),!0),document.querySelector("video").addEventListener("canplay",(()=>{document.getElementsByTagName("video")[0].playbackRate=t})),o.innerHTML="\n <h1>TizenTube Video Speed Settings</h1>\n ";for(var r=4,i=.25,a=i;a<=r;a+=i){var l=`speed${a.toString().replace(".","_")}`;if(o.innerHTML+=`\n <label for="${l}"><input type="radio" id="${l}" name="speed" value="${a}">${a}x</label>\n `,1==a){var c=`speed${(a=1.0001).toString().replace(".","_")}`;o.innerHTML+=`\n <label for="${c}"><input type="radio" id="${c}" name="speed" value="${a}">${a}x</label>\n `,a=1}}document.querySelector("body").appendChild(o);var s=e=>406!=e.keyCode&&191!=e.keyCode||(console.info("Taking over!"),e.preventDefault(),e.stopPropagation(),"keydown"===e.type&&("none"===o.style.display?(console.info("Showing and focusing!"),o.style.display="block",o.focus()):(console.info("Hiding!"),o.style.display="none",o.blur())),!1);document.addEventListener("keydown",s,!0),document.addEventListener("keypress",s,!0),document.addEventListener("keyup",s,!0)}(),clearInterval(_))}),1e3)}();
1
+ !function(){"use strict";function e(){e=function(){return t};var t={},n=Object.prototype,o=n.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",l=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,o){var i=t&&t.prototype instanceof h?t:h,a=Object.create(i.prototype),l=new C(o||[]);return r(a,"_invoke",{value:S(e,n,l)}),a}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var f={};function h(){}function p(){}function m(){}var v={};s(v,a,(function(){return this}));var g=Object.getPrototypeOf,y=g&&g(g(N([])));y&&y!==n&&o.call(y,a)&&(v=y);var b=m.prototype=h.prototype=Object.create(v);function w(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function k(e,t){function n(r,i,a,l){var c=d(e[r],e,i);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==typeof u&&o.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,l)}),(function(e){n("throw",e,a,l)})):t.resolve(u).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,l)}))}l(c.arg)}var i;r(this,"_invoke",{value:function(e,o){function r(){return new t((function(t,r){n(e,o,t,r)}))}return i=i?i.then(r,r):r()}})}function S(e,t,n){var o="suspendedStart";return function(r,i){if("executing"===o)throw new Error("Generator is already running");if("completed"===o){if("throw"===r)throw i;return P()}for(n.method=r,n.arg=i;;){var a=n.delegate;if(a){var l=_(a,n);if(l){if(l===f)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===o)throw o="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o="executing";var c=d(e,t,n);if("normal"===c.type){if(o=n.done?"completed":"suspendedYield",c.arg===f)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(o="completed",n.method="throw",n.arg=c.arg)}}}function _(e,t){var n=t.method,o=e.iterator[n];if(void 0===o)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,_(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;var r=d(o,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,f;var i=r.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function x(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function C(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function N(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n<e.length;)if(o.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return r.next=r}}return{next:P}}function P(){return{value:void 0,done:!0}}return p.prototype=m,r(b,"constructor",{value:m,configurable:!0}),r(m,"constructor",{value:p,configurable:!0}),p.displayName=s(m,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,s(e,c,"GeneratorFunction")),e.prototype=Object.create(b),e},t.awrap=function(e){return{__await:e}},w(k.prototype),s(k.prototype,l,(function(){return this})),t.AsyncIterator=k,t.async=function(e,n,o,r,i){void 0===i&&(i=Promise);var a=new k(u(e,n,o,r),i);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},w(b),s(b,c,"Generator"),s(b,a,(function(){return this})),s(b,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var o in t)n.push(o);return n.reverse(),function e(){for(;n.length;){var o=n.pop();if(o in t)return e.value=o,e.done=!1,e}return e.done=!0,e}},t.values=N,C.prototype={constructor:C,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!e)for(var t in this)"t"===t.charAt(0)&&o.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,o){return a.type="throw",a.arg=e,t.next=n,o&&(t.method="next",t.arg=void 0),!!o}for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var l=o.call(i,"catchLoc"),c=o.call(i,"finallyLoc");if(l&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&o.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),f},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),x(n),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var o=n.completion;if("throw"===o.type){var r=o.arg;x(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:N(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},t}function t(e,t,n,o,r,i,a){try{var l=e[i](a),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(o,r)}function n(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,i,a,l=[],c=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(o=i.call(n)).done)&&(l.push(o.value),l.length!==t);c=!0);}catch(e){s=!0,r=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw r}}return l}}(e,t)||r(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(e,t){if(e){if("string"==typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,t):void 0}}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function a(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=r(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0,i=function(){};return{s:i,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,l=!0,c=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return l=e.done,e},e:function(e){c=!0,a=e},f:function(){try{l||null==n.return||n.return()}finally{if(c)throw a}}}}!function(e){function t(e){return void 0===e?0:Number(e)}function n(e,t){return e!==t&&!(isNaN(e)&&isNaN(t))}self.DOMRect=function(e,o,r,i){var a,l,c,s,u,d,f,h;a=t(e),l=t(o),c=t(r),s=t(i),Object.defineProperties(this,{x:{get:function(){return a},set:function(e){n(a,e)&&(a=e,u=d=void 0)},enumerable:!0},y:{get:function(){return l},set:function(e){n(l,e)&&(l=e,f=h=void 0)},enumerable:!0},width:{get:function(){return c},set:function(e){n(c,e)&&(c=e,u=d=void 0)},enumerable:!0},height:{get:function(){return s},set:function(e){n(s,e)&&(s=e,f=h=void 0)},enumerable:!0},left:{get:function(){return void 0===u&&(u=a+Math.min(0,c)),u},enumerable:!0},right:{get:function(){return void 0===d&&(d=a+Math.max(0,c)),d},enumerable:!0},top:{get:function(){return void 0===f&&(f=l+Math.min(0,s)),f},enumerable:!0},bottom:{get:function(){return void 0===h&&(h=l+Math.max(0,s)),h},enumerable:!0}})}}();var l,c="ytaf-configuration",s={enableAdBlock:!0,enableSponsorBlock:!0,enableSponsorBlockSponsor:!0,enableSponsorBlockIntro:!0,enableSponsorBlockOutro:!0,enableSponsorBlockInteraction:!0,enableSponsorBlockSelfPromo:!0,enableSponsorBlockMusicOfftopic:!0,videoSpeed:1,enableDeArrow:!0,enableDeArrowThumbnails:!1,focusContainerColor:"#0f0f0f",routeColor:"#0f0f0f",enableFixedUI:!0};try{l=JSON.parse(window.localStorage[c])}catch(e){console.warn("Config read failed:",e),l=s}function u(e){return void 0===l[e]&&(console.warn("Populating key",e,"with default value",s[e]),l[e]=s[e]),l[e]}function d(e,t){console.info("Setting key",e,"to",t),l[e]=t,window.localStorage[c]=JSON.stringify(l)}var f=JSON.parse;function h(e){var t,n=a(e);try{for(n.s();!(t=n.n()).done;){var o=t.value;o.shelfRenderer&&p(o.shelfRenderer.content.horizontalListRenderer.items)}}catch(e){n.e(e)}finally{n.f()}}function p(e){var t,n=a(e);try{var o=function(){var n=t.value;if(n.adSlotRenderer){var o=e.indexOf(n);return e.splice(o,1),"continue"}if(u("enableDeArrow")){var r=n.tileRenderer.contentId;fetch(`https://sponsor.ajay.app/api/branding?videoID=${r}`).then((e=>e.json())).then((e=>{if(e.titles.length>0){var t=e.titles.reduce(((e,t)=>e.votes>t.votes?e:t));n.tileRenderer.metadata.tileMetadataRenderer.title.simpleText=t.title}if(e.thumbnails.length>0&&u("enableDeArrowThumbnails")){var o=e.thumbnails.reduce(((e,t)=>e.votes>t.votes?e:t));o.timestamp&&(n.tileRenderer.header.tileHeaderRenderer.thumbnail.thumbnails=[{url:`https://dearrow-thumb.ajay.app/api/v1/getThumbnail?videoID=${r}&time=${o.timestamp}`,width:1280,height:640}])}}))}};for(n.s();!(t=n.n()).done;)o()}catch(e){n.e(e)}finally{n.f()}}JSON.parse=function(){var e,t,n,o,r=f.apply(this,arguments);return r.adPlacements&&u("enableAdBlock")&&(r.adPlacements=[]),r.playerAds&&u("enableAdBlock")&&(r.playerAds=!1),r.adSlots&&u("enableAdBlock")&&(r.adSlots=[]),null!=r&&null!==(e=r.contents)&&void 0!==e&&null!==(e=e.tvBrowseRenderer)&&void 0!==e&&null!==(e=e.content)&&void 0!==e&&null!==(e=e.tvSurfaceContentRenderer)&&void 0!==e&&null!==(e=e.content)&&void 0!==e&&null!==(e=e.sectionListRenderer)&&void 0!==e&&e.contents&&u("enableAdBlock")&&(r.contents.tvBrowseRenderer.content.tvSurfaceContentRenderer.content.sectionListRenderer.contents=r.contents.tvBrowseRenderer.content.tvSurfaceContentRenderer.content.sectionListRenderer.contents.filter((e=>!e.adSlotRenderer))),null!=r&&null!==(t=r.contents)&&void 0!==t&&null!==(t=t.tvBrowseRenderer)&&void 0!==t&&null!==(t=t.content)&&void 0!==t&&null!==(t=t.tvSurfaceContentRenderer)&&void 0!==t&&null!==(t=t.content)&&void 0!==t&&null!==(t=t.sectionListRenderer)&&void 0!==t&&t.contents&&h(r.contents.tvBrowseRenderer.content.tvSurfaceContentRenderer.content.sectionListRenderer.contents),null!=r&&null!==(n=r.continuationContents)&&void 0!==n&&null!==(n=n.sectionListContinuation)&&void 0!==n&&n.contents&&h(r.continuationContents.sectionListContinuation.contents),null!=r&&null!==(o=r.continuationContents)&&void 0!==o&&null!==(o=o.horizontalListContinuation)&&void 0!==o&&o.items&&p(r.continuationContents.horizontalListContinuation.items),r};var m=function e(t){function n(e,t){return e>>>t|e<<32-t}for(var o,r,i=Math.pow,a=i(2,32),l="length",c="",s=[],u=8*t[l],d=e.h=e.h||[],f=e.k=e.k||[],h=f[l],p={},m=2;h<64;m++)if(!p[m]){for(o=0;o<313;o+=m)p[o]=m;d[h]=i(m,.5)*a|0,f[h++]=i(m,1/3)*a|0}for(t+="€";t[l]%64-56;)t+="\0";for(o=0;o<t[l];o++){if((r=t.charCodeAt(o))>>8)return;s[o>>2]|=r<<(3-o)%4*8}for(s[s[l]]=u/a|0,s[s[l]]=u,r=0;r<s[l];){var v=s.slice(r,r+=16),g=d;for(d=d.slice(0,8),o=0;o<64;o++){var y=v[o-15],b=v[o-2],w=d[0],k=d[4],S=d[7]+(n(k,6)^n(k,11)^n(k,25))+(k&d[5]^~k&d[6])+f[o]+(v[o]=o<16?v[o]:v[o-16]+(n(y,7)^n(y,18)^y>>>3)+v[o-7]+(n(b,17)^n(b,19)^b>>>10)|0);(d=[S+((n(w,2)^n(w,13)^n(w,22))+(w&d[1]^w&d[2]^d[1]&d[2]))|0].concat(d))[4]=d[4]+S|0}for(o=0;o<8;o++)d[o]=d[o]+g[o]|0}for(o=0;o<8;o++)for(r=3;r+1;r--){var _=d[o]>>8*r&255;c+=(_<16?0:"")+_.toString(16)}return c};!function(){if(!("navigate"in window)){var e={37:"left",38:"up",39:"right",40:"down"},t=null,n=null,o={element:null,rect:null},r=null;window.navigate=l,window.Element.prototype.spatialNavigationSearch=f,window.Element.prototype.focusableAreas=y,window.Element.prototype.getSpatialNavigationContainer=v,window.CSS&&CSS.registerProperty&&(""===window.getComputedStyle(document.documentElement).getPropertyValue("--spatial-navigation-contain")&&CSS.registerProperty({name:"--spatial-navigation-contain",syntax:"auto | contain",inherits:!1,initialValue:"auto"}),""===window.getComputedStyle(document.documentElement).getPropertyValue("--spatial-navigation-action")&&CSS.registerProperty({name:"--spatial-navigation-action",syntax:"auto | focus | scroll",inherits:!1,initialValue:"auto"}),""===window.getComputedStyle(document.documentElement).getPropertyValue("--spatial-navigation-function")&&CSS.registerProperty({name:"--spatial-navigation-function",syntax:"normal | grid",inherits:!1,initialValue:"normal"})),Y(!1),window.addEventListener("load",(()=>{i()}))}function i(){window.addEventListener("keydown",(o=>{var r=parent&&parent.__spatialNavigation__.keyMode||window.__spatialNavigation__.keyMode,i=document.activeElement,a=e[o.keyCode];if(9===o.keyCode&&(n=null),!(!r||"NONE"===r||"SHIFTARROW"===r&&!o.shiftKey||"ARROW"===r&&o.shiftKey||o.defaultPrevented)){var c={left:!0,up:!0,right:!0,down:!0};"INPUT"!==i.nodeName&&"TEXTAREA"!==i.nodeName||(c=function(t){var n=["email","date","month","number","time","week"],o=["password","text","search","tel","url",null],r=document.activeElement,i={left:!1,up:!1,right:!1,down:!1},a=e[t.keyCode];if(void 0===a)return i;if(!n.includes(r.getAttribute("type"))||"up"!==a&&"down"!==a)if(o.includes(r.getAttribute("type"))||"TEXTAREA"===r.nodeName){var l=r.selectionStart,c=r.selectionEnd;l===c&&(0===l&&(i.left=!0,i.up=!0),c===r.value.length&&(i.right=!0,i.down=!0))}else i[a]=!0;else i[a]=!0;return i}(o)),c[a]&&(o.preventDefault(),t=new Map,l(a),t=null,n=null)}})),document.addEventListener("mouseup",(e=>{n={x:e.clientX,y:e.clientY}})),window.addEventListener("focusin",(e=>{e.target!==window&&(o.element=e.target,o.rect=e.target.getBoundingClientRect())}))}function l(e){var t=function(){var e=document.activeElement;if(!e||e===document.body&&!document.querySelector(":focus")){if(o.element&&e!==o.element){var t=window.getComputedStyle(o.element,null),n=["hidden","collapse"];if(o.element.disabled||n.includes(t.getPropertyValue("visibility")))return e=o.element}e=document.documentElement}!o.element||0!==z(o.element).height&&0!==z(o.element).width||(r=o.rect);if(!I(e)){var i=g(e);if(i&&(i===window||"auto"===k(i)))return i}return e}(),i=t,a=null;n&&(null===(a=document.elementFromPoint(n.x,n.y))&&(a=document.body),A(a)&&!E(a)?n=null:i=E(a)?a:a.getSpatialNavigationContainer()),i!==document&&i!==document.documentElement||(i=document.body||document.documentElement);var l=null;if((E(i)||"BODY"===i.nodeName)&&"INPUT"!==i.nodeName){"IFRAME"===i.nodeName&&(i=i.contentDocument.documentElement),l=i;if(document.activeElement===t||document.activeElement===document.body&&t===document.documentElement){if("scroll"===k(i)){if(s(i,e))return}else if("focus"===k(i)){if(c(i.spatialNavigationSearch(e,{container:i,candidates:u(i,{mode:"all"})}),e))return}else if("auto"===k(i)&&(c(i.spatialNavigationSearch(e,{container:i}),e)||s(i,e)))return}else l=l.getSpatialNavigationContainer()}var d=(l=i.getSpatialNavigationContainer()).parentElement?l.getSpatialNavigationContainer():null;if(d||window.location===window.parent.location||(d=window.parent.document.documentElement),"scroll"===k(l)){if(s(l,e))return}else"focus"===k(l)?S(i,l,d,e,"all"):"auto"===k(l)&&S(i,l,d,e,"visible")}function c(e,t){if(e){if(!b("beforefocus",e,null,t))return!0;var o=e.getSpatialNavigationContainer();return o!==window&&"focus"===k(o)?e.focus():e.focus({preventScroll:!0}),n=null,!0}return!1}function s(e,t){return N(e,t)&&!T(e,t)?(_(e,t),!0):!e.parentElement&&!L(e,t)&&(_(e.ownerDocument.documentElement,t),!0)}function u(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{mode:"visible"},n=[];if(e.childElementCount>0){e.parentElement||(e=e.getElementsByTagName("body")[0]||document.body);var o,r=a(e.children);try{for(r.s();!(o=r.n()).done;){var i=o.value;x(i)?n.push(i):A(i)?(n.push(i),!E(i)&&i.childElementCount&&(n=n.concat(u(i,{mode:"all"})))):i.childElementCount&&(n=n.concat(u(i,{mode:"all"})))}}catch(e){r.e(e)}finally{r.f()}}return"all"===t.mode?n:n.filter(O)}function d(e,t,n,o){var r=e;return o=o||r.getSpatialNavigationContainer(),h(r,n=!n||n.length<=0?u(o):n,t,o)}function f(e,t){var o,i=this,a=[],l=[],c=function(e){var t=e.getSpatialNavigationContainer(),n=t.focusableAreas(),o=[];return n.forEach((t=>{e!==t&&M(t,e)&&o.push(t)})),o}(i);t||(t={});var s=i.getSpatialNavigationContainer(),f=u(s),h=t.container||s;t.container&&s.contains(t.container)&&(f=f.concat(u(h)));var v=t.candidates&&t.candidates.length>0?t.candidates.filter((e=>h.contains(e))):f.filter((e=>h.contains(e)&&h!==e));if(v&&v.length>0){v.forEach((e=>{e!==i&&(i.contains(e)&&i!==e?a:l).push(e)}));var g=c.filter((e=>!a.includes(e))),y=v.filter((e=>E(e)&&M(i,e))).map((e=>e.focusableAreas())).flat().filter((e=>e!==i));if(a=a.concat(g).filter((e=>h.contains(e))),(l=l.concat(y).filter((e=>h.contains(e)))).length>0&&(l=d(i,e,l,h)),r&&(o=p(i,d(i,e,a,h),e)),a&&a.length>0&&"INPUT"!==i.nodeName&&(o=function(e,t,o){return m(e,t,o,n?V:F)}(i,a,e)),(o=o||p(i,l,e))&&x(o)){var b=u(o,{mode:"all"}),w=b.length>0?i.spatialNavigationSearch(e,{candidates:b,container:o}):null;w?o=w:A(o)||(v.splice(v.indexOf(o),1),o=v.length?i.spatialNavigationSearch(e,{candidates:v,container:h}):null)}return o}return null}function h(e,t,n,o){var i,a=e.getSpatialNavigationContainer();return void 0===n?t:(i=a.parentElement&&o!==a&&!O(e)?z(a):r||z(e),!E(e)&&"BODY"!==e.nodeName||"INPUT"===e.nodeName?t.filter((t=>{var r=z(t),a="IFRAME"===t.nodeName?t.contentDocument.body:null;return o.contains(t)&&t!==e&&a!==e&&D(r,i,n)&&!R(i,r)})):t.filter((t=>{var r=z(t);return o.contains(t)&&(e.contains(t)&&R(i,r)&&t!==e||D(r,i,n))})))}function p(e,t,n){var o,i,a=e.getSpatialNavigationContainer(),l=getComputedStyle(a).getPropertyValue("--spatial-navigation-function"),c=r||z(e);if("grid"===l)(i=t.filter((e=>j(c,z(e),n)))).length>0&&(t=i),o=W;else o=U;return m(e,t,n,o)}function m(e,t,n,o){var i=null;window.location===window.parent.location||"BODY"!==e.nodeName&&"HTML"!==e.nodeName?i=r||e.getBoundingClientRect():((i=window.frameElement.getBoundingClientRect()).x=0,i.y=0);var a=Number.POSITIVE_INFINITY,l=[];if(t)for(var c=0;c<t.length;c++){var s=o(i,z(t[c]),n);s<a?(a=s,l=[t[c]]):s===a&&l.push(t[c])}return 0===l.length?null:l.length>1&&o===W?m(e,l,n,$):l[0]}function v(){var e=this;do{if(!e.parentElement){e=window.location!==window.parent.location?window.parent.document.documentElement:window.document.documentElement;break}e=e.parentElement}while(!E(e));return e}function g(e){var t=e;do{if(!t.parentElement){t=window.location!==window.parent.location?window.parent.document.documentElement:window.document.documentElement;break}t=t.parentElement}while(!C(t)||!O(t));return t!==document&&t!==document.documentElement||(t=window),t}function y(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{mode:"visible"},t=this.parentElement?this:document.body,n=Array.prototype.filter.call(t.getElementsByTagName("*"),A);return"all"===e.mode?n:n.filter(O)}function b(e,t,n,o){if(["beforefocus","notarget"].includes(e)){var r=new CustomEvent("nav"+e,{bubbles:!0,cancelable:!0,detail:{causedTarget:n,dir:o}});return t.dispatchEvent(r)}}function w(e,t){return(e.style.getPropertyValue(`--${t}`)||"").trim()}function k(e){return w(e,"spatial-navigation-action")||"auto"}function S(e,t,n,o,r){for(var i={candidates:u(t,{mode:r}),container:t};n;){if(c(e.spatialNavigationSearch(o,i),o))return;if("visible"===r&&s(t,o))return;if(!b("notarget",t,e,o))return;t===document||t===document.documentElement?window.location!==window.parent.location&&(t=(e=window.frameElement).ownerDocument.documentElement):t=n,i={candidates:u(t,{mode:r}),container:t};var a=t.getSpatialNavigationContainer();n=a!==t?a:null}i={candidates:u(t,{mode:r}),container:t},!n&&t&&c(e.spatialNavigationSearch(o,i),o)||b("notarget",i.container,e,o)&&("auto"!==k(t)||"visible"!==r||s(t,o))}function _(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(e)switch(t){case"left":e.scrollLeft-=40+n;break;case"right":e.scrollLeft+=40+n;break;case"up":e.scrollTop-=40+n;break;case"down":e.scrollTop+=40+n}}function E(e){return!e.parentElement||"IFRAME"===e.nodeName||C(e)||function(e){return"contain"===w(e,"spatial-navigation-contain")}(e)}function x(e){return"delegable"===w(e,"spatial-navigation-contain")}function C(e){var t=window.getComputedStyle(e,null),n=t.getPropertyValue("overflow-x"),o=t.getPropertyValue("overflow-y");return!!("visible"!==n&&"clip"!==n&&P(e,"left")||"visible"!==o&&"clip"!==o&&P(e,"down"))}function N(e,t){if(e&&"object"==typeof e){if(t&&"string"==typeof t){if(P(e,t)){var n=window.getComputedStyle(e,null),o=n.getPropertyValue("overflow-x"),r=n.getPropertyValue("overflow-y");switch(t){case"left":case"right":return"visible"!==o&&"clip"!==o&&"hidden"!==o;case"up":case"down":return"visible"!==r&&"clip"!==r&&"hidden"!==r}}return!1}return"HTML"===e.nodeName||"BODY"===e.nodeName||C(e)&&P(e)}}function P(e,t){if(e&&"object"==typeof e){if(!t||"string"!=typeof t)return e.scrollWidth>e.clientWidth||e.scrollHeight>e.clientHeight;switch(t){case"left":case"right":return e.scrollWidth>e.clientWidth;case"up":case"down":return e.scrollHeight>e.clientHeight}return!1}}function L(e,t){var n=!1;switch(t){case"left":n=0===e.scrollLeft;break;case"right":n=e.scrollWidth-e.scrollLeft-e.clientWidth==0;break;case"up":n=0===e.scrollTop;break;case"down":n=e.scrollHeight-e.scrollTop-e.clientHeight==0}return n}function T(e,t){if(N(e,t)){var n=e.scrollTop,o=e.scrollLeft,r=e.scrollHeight-e.clientHeight,i=e.scrollWidth-e.clientWidth;switch(t){case"left":return 0===o;case"right":return Math.abs(o-i)<=1;case"up":return 0===n;case"down":return Math.abs(n-r)<=1}}return!1}function I(e){var t=e.getBoundingClientRect(),n=g(e),o=null;return!(!R(o=n!==window?z(n):new DOMRect(0,0,window.innerWidth,window.innerHeight),t)||!R(o,t))}function A(e){return!(e.tabIndex<0||function(e){return"A"===e.tagName&&null===e.getAttribute("href")&&null===e.getAttribute("tabIndex")}(e)||function(e){return!!["BUTTON","INPUT","SELECT","TEXTAREA","OPTGROUP","OPTION","FIELDSET"].includes(e.tagName)&&e.disabled}(e)||function(e){return e.inert&&!e.ownerDocument.documentElement.inert}(e)||!function(e){return!!B(e.parentElement)&&!(!B(e)||"0"===e.style.opacity||"0px"===window.getComputedStyle(e).height||"0px"===window.getComputedStyle(e).width)}(e))&&(!!(!e.parentElement||N(e)&&P(e)||e.tabIndex>=0)||void 0)}function O(e){return!e.parentElement||B(e)&&function(e){var t=z(e);if("IFRAME"!==e.nodeName&&(t.top<0||t.left<0||t.top>e.ownerDocument.documentElement.clientHeight||t.left>e.ownerDocument.documentElement.clientWidth))return!1;var n=parseInt(e.offsetWidth)/10,o=parseInt(e.offsetHeight)/10;n=isNaN(n)?1:n,o=isNaN(o)?1:o;var r={middle:[(t.left+t.right)/2,(t.top+t.bottom)/2],leftTop:[t.left+n,t.top+o],rightBottom:[t.right-n,t.bottom-o]};for(var i in r){var a=e.ownerDocument.elementFromPoint(...r[i]);if(e===a||e.contains(a))return!0}return!1}(e)}function M(e,t){var n=z(e),o=z(t||e.getSpatialNavigationContainer());return!(n.left<o.left||n.right>o.right||n.top<o.top||n.bottom>o.bottom)}function B(e){var t=window.getComputedStyle(e,null),n=t.getPropertyValue("visibility");return"none"!==t.getPropertyValue("display")&&!["hidden","collapse"].includes(n)}function R(e,t){var n=e.left<=t.right&&e.right>=t.right,o=e.left<=t.left&&e.right>=t.left,r=e.top<=t.top&&e.bottom>=t.top,i=e.top<=t.bottom&&e.bottom>=t.bottom;return(n||o)&&(r||i)}function D(e,t,n){switch(n){case"left":return q(t,e);case"right":return q(e,t);case"up":return H(t,e);case"down":return H(e,t);default:return!1}}function q(e,t){return e.left>=t.right||e.left>=t.left&&e.right>t.right&&e.bottom>t.top&&e.top<t.bottom}function H(e,t){return e.top>=t.bottom||e.top>=t.top&&e.bottom>t.bottom&&e.left<t.right&&e.right>t.left}function j(e,t,n){switch(n){case"left":case"right":return e.bottom>t.top&&e.top<t.bottom;case"up":case"down":return e.right>t.left&&e.left<t.right;default:return!1}}function V(e,t,o){var r=G(o,n,t),i=Math.abs(r.entryPoint.x-r.exitPoint.x),a=Math.abs(r.entryPoint.y-r.exitPoint.y);return Math.sqrt(Math.pow(i,2)+Math.pow(a,2))}function F(e,t,n){var o={left:"right",right:"left",up:"bottom",down:"top"}[n];return Math.abs(e[o]-t[o])}function U(e,t,n){var o,r,i=0,a=0,l=G(n,e,t),c=Math.abs(l.entryPoint.x-l.exitPoint.x),s=Math.abs(l.entryPoint.y-l.exitPoint.y),u=Math.sqrt(Math.pow(c,2)+Math.pow(s,2)),d=function(e,t){var n={width:0,height:0,area:0},o=[Math.max(e.left,t.left),Math.max(e.top,t.top)],r=[Math.min(e.right,t.right),Math.min(e.bottom,t.bottom)];n.width=Math.abs(o[0]-r[0]),n.height=Math.abs(o[1]-r[1]),o[0]>=r[0]||o[1]>=r[1]||(n.area=Math.sqrt(n.width*n.height));return n}(e,t),f=d.area;switch(n){case"left":case"right":j(e,t,n)?a=Math.min(d.height/e.height,1):i=e.height/2,o=30*(s+i),r=5*a;break;case"up":case"down":j(e,t,n)?a=Math.min(d.width/e.width,1):i=e.width/2,o=2*(c+i),r=5*a;break;default:o=0,r=0}return u+o-r-f}function $(e,t,n){var o=G(n,e,t),r=Math.abs(o.entryPoint.x-o.exitPoint.x),i=Math.abs(o.entryPoint.y-o.exitPoint.y);return Math.sqrt(Math.pow(r,2)+Math.pow(i,2))}function W(e,t,n){var o=G(n,e,t);return"left"===n||"right"===n?Math.abs(o.entryPoint.x-o.exitPoint.x):Math.abs(o.entryPoint.y-o.exitPoint.y)}function G(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"down",t=arguments.length>1?arguments[1]:void 0,o=arguments.length>2?arguments[2]:void 0,r={entryPoint:{x:0,y:0},exitPoint:{x:0,y:0}};if(n){switch(r.exitPoint=t,e){case"left":r.entryPoint.x=o.right;break;case"up":r.entryPoint.y=o.bottom;break;case"right":r.entryPoint.x=o.left;break;case"down":r.entryPoint.y=o.top}switch(e){case"left":case"right":n.y<=o.top?r.entryPoint.y=o.top:n.y<o.bottom?r.entryPoint.y=n.y:r.entryPoint.y=o.bottom;break;case"up":case"down":n.x<=o.left?r.entryPoint.x=o.left:n.x<o.right?r.entryPoint.x=n.x:r.entryPoint.x=o.right}}else{switch(e){case"left":r.exitPoint.x=t.left,r.entryPoint.x=o.right<t.left?o.right:t.left;break;case"up":r.exitPoint.y=t.top,r.entryPoint.y=o.bottom<t.top?o.bottom:t.top;break;case"right":r.exitPoint.x=t.right,r.entryPoint.x=o.left>t.right?o.left:t.right;break;case"down":r.exitPoint.y=t.bottom,r.entryPoint.y=o.top>t.bottom?o.top:t.bottom}switch(e){case"left":case"right":H(t,o)?(r.exitPoint.y=t.top,r.entryPoint.y=o.bottom<t.top?o.bottom:t.top):H(o,t)?(r.exitPoint.y=t.bottom,r.entryPoint.y=o.top>t.bottom?o.top:t.bottom):(r.exitPoint.y=Math.max(t.top,o.top),r.entryPoint.y=r.exitPoint.y);break;case"up":case"down":q(t,o)?(r.exitPoint.x=t.left,r.entryPoint.x=o.right<t.left?o.right:t.left):q(o,t)?(r.exitPoint.x=t.right,r.entryPoint.x=o.left>t.right?o.left:t.right):(r.exitPoint.x=Math.max(t.left,o.left),r.entryPoint.x=r.exitPoint.x)}}return r}function z(e){var n=t&&t.get(e);if(!n){var o=e.getBoundingClientRect();n={top:Number(o.top.toFixed(2)),right:Number(o.right.toFixed(2)),bottom:Number(o.bottom.toFixed(2)),left:Number(o.left.toFixed(2)),width:Number(o.width.toFixed(2)),height:Number(o.height.toFixed(2))},t&&t.set(e,n)}return n}function Y(e){var t=window.__spatialNavigation__&&window.__spatialNavigation__.keyMode;window.__spatialNavigation__=!1===e?X():Object.assign(X(),function(){function e(e,t){return N(e,t)&&!T(e,t)||!e.parentElement&&!L(e,t)}function t(t,n,o,r){var i=n,a=null;if(i!==document&&i!==document.documentElement||(i=document.body||document.documentElement),(E(i)||"BODY"===i.nodeName)&&"INPUT"!==i.nodeName){"IFRAME"===i.nodeName&&(i=i.contentDocument.body);var l=u(i,r);if(Array.isArray(l)&&l.length>0)return t?d(i,o,l):i.spatialNavigationSearch(o,{candidates:l});if(e(i,o))return t?[]:i}var c=i.getSpatialNavigationContainer(),s=c.parentElement?c.getSpatialNavigationContainer():null;for(s||window.location===window.parent.location||(s=window.parent.document.documentElement);s;){var f=h(i,u(c,r),o,c);if(Array.isArray(f)&&f.length>0){if(a=i.spatialNavigationSearch(o,{candidates:f,container:c}))return t?f:a}else{if(e(c,o))return t?[]:i;if(c===document||c===document.documentElement){if(c=window.document.documentElement,window.location!==window.parent.location){if(i=window.frameElement,!(c=window.parent.document.documentElement).parentElement){s=null;break}s=c.getSpatialNavigationContainer()}}else{if(A(c)&&(i=c),!(c=s).parentElement){s=null;break}s=c.getSpatialNavigationContainer()}}}if(!s&&c){var p=h(i,u(c,r),o,c);if(Array.isArray(p)&&p.length>0&&(a=i.spatialNavigationSearch(o,{candidates:p,container:c})))return t?p:a}if(e(c,o))return i}return{isContainer:E,isScrollContainer:C,isVisibleInScroller:I,findCandidates:t.bind(null,!0),findNextTarget:t.bind(null,!1),getDistanceFromTarget:(e,t,n)=>(E(e)||"BODY"===e.nodeName)&&"INPUT"!==e.nodeName&&u(e).includes(t)?F(z(e),z(t),n):U(z(e),z(t),n)}}()),window.__spatialNavigation__.keyMode=t,Object.seal(window.__spatialNavigation__)}function X(){return{enableExperimentalAPIs:Y,get keyMode(){return this._keymode?this._keymode:"ARROW"},set keyMode(e){this._keymode=["SHIFTARROW","ARROW","NONE"].includes(e)?e:"ARROW"},setStartingPoint:function(e,t){n=e&&t?{x:e,y:t}:null}}}}();var v=".ytaf-ui-container {\r\n position: absolute;\r\n top: 10%;\r\n left: 10%;\r\n right: 10%;\r\n bottom: 10%;\r\n\r\n background: rgba(0, 0, 0, 0.8);\r\n color: white;\r\n border-radius: 20px;\r\n padding: 20px;\r\n font-size: 1.5rem;\r\n z-index: 1000;\r\n}\r\n\r\n.ytaf-ui-container :focus {\r\n outline: 4px red solid;\r\n}\r\n\r\n.ytaf-ui-container h1 {\r\n margin: 0;\r\n margin-bottom: 0.5em;\r\n text-align: center;\r\n}\r\n\r\n.ytaf-ui-container input[type='checkbox'] {\r\n width: 1.4rem;\r\n height: 1.4rem;\r\n}\r\n\r\n.ytaf-ui-container input[type='radio'] {\r\n width: 1.4rem;\r\n height: 1.4rem;\r\n}\r\n\r\n.ytaf-ui-container label {\r\n display: block;\r\n font-size: 1.4rem;\r\n}\r\n\r\n.ytaf-notification-container {\r\n position: absolute;\r\n right: 10px;\r\n bottom: 10px;\r\n font-size: 16pt;\r\n z-index: 1200;\r\n}\r\n\r\n.ytaf-notification-container .message {\r\n background: rgba(0, 0, 0, 0.7);\r\n color: white;\r\n padding: 1em;\r\n margin: 0.5em;\r\n transition: all 0.3s ease-in-out;\r\n opacity: 1;\r\n line-height: 1;\r\n border-right: 10px solid rgba(50, 255, 50, 0.3);\r\n display: inline-block;\r\n float: right;\r\n}\r\n\r\n.ytaf-notification-container .message-hidden {\r\n opacity: 0;\r\n margin: 0 0.5em;\r\n padding: 0 1em;\r\n line-height: 0;\r\n}\r\n",g=document.createElement("style"),y="";function b(){y=`\n ytlr-guide-response yt-focus-container {\n background-color: ${u("focusContainerColor")};\n }\n\n ytlr-surface-page {\n background-color: ${u("routeColor")};\n }\n\n ytlr-search-container {\n background-color: ${u("routeColor")};\n }\n\n ytlr-accounts-container {\n background-color: ${u("routeColor")};\n }\n`;var e=document.querySelector("style[nonce]");e?e.textContent+=y:g.textContent=y}document.head.appendChild(g),b();var w=setInterval((()=>{document.querySelector("video")&&(!function(){var e=document.querySelector("style[nonce]");if(e)e.textContent+=v;else{var t=document.createElement("style");t.textContent=v,document.head.appendChild(t)}if(u("enableFixedUI"))try{window.tectonicConfig.featureSwitches.isLimitedMemory=!1,window.tectonicConfig.clientData.legacyApplicationQuality="full-animation",window.tectonicConfig.featureSwitches.enableAnimations=!0,window.tectonicConfig.featureSwitches.enableOnScrollLinearAnimation=!0,window.tectonicConfig.featureSwitches.enableListAnimations=!0}catch(e){}window.__spatialNavigation__.keyMode="NONE";var n={37:"left",38:"up",39:"right",40:"down"},o=document.createElement("div");o.classList.add("ytaf-ui-container"),o.style.display="none",o.setAttribute("tabindex",0),o.addEventListener("focus",(()=>console.info("uiContainer focused!")),!0),o.addEventListener("blur",(()=>console.info("uiContainer blured!")),!0),o.addEventListener("keydown",(e=>{if(console.info("uiContainer key event:",e.type,e.keyCode),404!==e.keyCode&&172!==e.keyCode){if(e.keyCode in n)navigate(n[e.keyCode]);else if(13===e.keyCode||32===e.keyCode)document.querySelector(":focus").click();else if(27===e.keyCode&&"text"!==document.querySelector(":focus").type)o.style.display="none",o.blur();else if("text"===document.querySelector(":focus").type&&27===e.keyCode){var t=document.querySelector(":focus");t.value=t.value.slice(0,-1)}e.Uc&&1===e.Uc.key.length&&(document.querySelector(":focus").value+=e.Uc.key)}}),!0),o.innerHTML='\n<h1>TizenTube Configuration</h1>\n<label for="__adblock"><input type="checkbox" id="__adblock" /> Enable AdBlocking</label>\n<label for="__fixedUI"><input type="checkbox" id="__fixedUI" /> Enable Fixed UI</label>\n<label for="__sponsorblock"><input type="checkbox" id="__sponsorblock" /> Enable SponsorBlock</label>\n<blockquote>\n<label for="__sponsorblock_sponsor"><input type="checkbox" id="__sponsorblock_sponsor" /> Skip Sponsor Segments</label>\n<label for="__sponsorblock_intro"><input type="checkbox" id="__sponsorblock_intro" /> Skip Intro Segments</label>\n<label for="__sponsorblock_outro"><input type="checkbox" id="__sponsorblock_outro" /> Skip Outro Segments</label>\n<label for="__sponsorblock_interaction"><input type="checkbox" id="__sponsorblock_interaction" /> Skip Interaction Reminder Segments</label>\n<label for="__sponsorblock_selfpromo"><input type="checkbox" id="__sponsorblock_selfpromo" /> Skip Self Promotion Segments</label>\n<label for="__sponsorblock_music_offtopic"><input type="checkbox" id="__sponsorblock_music_offtopic" /> Skip Music and Off-topic Segments</label>\n</blockquote>\n<label for="__dearrow"><input type="checkbox" id="__dearrow" /> Enable DeArrow</label>\n<blockquote>\n<label for="__dearrow_thumbnails"><input type="checkbox" id="__dearrow_thumbnails" /> Enable DeArrow Thumbnails</label>\n<div><small>DeArrow Thumbnail changing might break the shelve renderer. Be warned.</small></div>\n</blockquote>\n<label for="__barColor">Navigation Bar Color: <input type="text" id="__barColor"/></label>\n<label for="__routeColor">Main Content Color: <input type="text" id="__routeColor"/></label>\n<div><small>Sponsor segments skipping - https://sponsor.ajay.app</small></div>\n',document.querySelector("body").appendChild(o),o.querySelector("#__adblock").checked=u("enableAdBlock"),o.querySelector("#__adblock").addEventListener("change",(e=>{d("enableAdBlock",e.target.checked)})),o.querySelector("#__sponsorblock").checked=u("enableSponsorBlock"),o.querySelector("#__sponsorblock").addEventListener("change",(e=>{d("enableSponsorBlock",e.target.checked)})),o.querySelector("#__sponsorblock_sponsor").checked=u("enableSponsorBlockSponsor"),o.querySelector("#__sponsorblock_sponsor").addEventListener("change",(e=>{d("enableSponsorBlockSponsor",e.target.checked)})),o.querySelector("#__sponsorblock_intro").checked=u("enableSponsorBlockIntro"),o.querySelector("#__sponsorblock_intro").addEventListener("change",(e=>{d("enableSponsorBlockIntro",e.target.checked)})),o.querySelector("#__sponsorblock_outro").checked=u("enableSponsorBlockOutro"),o.querySelector("#__sponsorblock_outro").addEventListener("change",(e=>{d("enableSponsorBlockOutro",e.target.checked)})),o.querySelector("#__sponsorblock_interaction").checked=u("enableSponsorBlockInteraction"),o.querySelector("#__sponsorblock_interaction").addEventListener("change",(e=>{d("enableSponsorBlockInteraction",e.target.checked)})),o.querySelector("#__sponsorblock_selfpromo").checked=u("enableSponsorBlockSelfPromo"),o.querySelector("#__sponsorblock_selfpromo").addEventListener("change",(e=>{d("enableSponsorBlockSelfPromo",e.target.checked)})),o.querySelector("#__sponsorblock_music_offtopic").checked=u("enableSponsorBlockMusicOfftopic"),o.querySelector("#__sponsorblock_music_offtopic").addEventListener("change",(e=>{d("enableSponsorBlockMusicOfftopic",e.target.checked)})),o.querySelector("#__dearrow").checked=u("enableDeArrow"),o.querySelector("#__dearrow").addEventListener("change",(e=>{d("enableDeArrow",e.target.checked)})),o.querySelector("#__dearrow_thumbnails").checked=u("enableDeArrowThumbnails"),o.querySelector("#__dearrow_thumbnails").addEventListener("change",(e=>{d("enableDeArrowThumbnails",e.target.checked)})),o.querySelector("#__barColor").value=u("focusContainerColor"),o.querySelector("#__barColor").addEventListener("change",(e=>{d("focusContainerColor",e.target.value),b()})),o.querySelector("#__routeColor").value=u("routeColor"),o.querySelector("#__routeColor").addEventListener("change",(e=>{d("routeColor",e.target.value),b()})),o.querySelector("#__fixedUI").checked=u("enableFixedUI"),o.querySelector("#__fixedUI").addEventListener("change",(e=>{d("enableFixedUI",e.target.checked)}));var r=e=>(console.info("Key event:",e.type,e.keyCode,e.keyCode,e.defaultPrevented),404!=e.keyCode&&172!=e.keyCode||(console.info("Taking over!"),e.preventDefault(),e.stopPropagation(),"keydown"===e.type&&("none"===o.style.display?(console.info("Showing and focusing!"),o.style.display="block",o.focus()):(console.info("Hiding!"),o.style.display="none",o.blur())),!1));if(document.addEventListener("keydown",r,!0),document.addEventListener("keypress",r,!0),document.addEventListener("keyup",r,!0),setTimeout((()=>{k("Press [GREEN] to open TizenTube configuration screen\nPress [BLUE] to open Video Speed configuration screen")}),2e3),u("enableFixedUI"))try{new MutationObserver(((e,t)=>{var n=document.querySelector("body");n.classList.contains("app-quality-root")&&n.classList.remove("app-quality-root")})).observe(document.getElementsByTagName("body")[0],{attributes:!0,childList:!1,subtree:!1})}catch(e){}}(),clearInterval(w))}),250);function k(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3e3;if(!document.querySelector(".ytaf-notification-container")){console.info("Adding notification container");var n=document.createElement("div");n.classList.add("ytaf-notification-container"),document.body.appendChild(n)}var o=document.createElement("div"),r=document.createElement("div");r.innerText=e,r.classList.add("message"),r.classList.add("message-hidden"),o.appendChild(r),document.querySelector(".ytaf-notification-container").appendChild(o),setTimeout((()=>{r.classList.remove("message-hidden")}),100),setTimeout((()=>{r.classList.add("message-hidden"),setTimeout((()=>{o.remove()}),1e3)}),t)}var S={sponsor:{color:"#00d400",opacity:"0.7",name:"sponsored segment"},intro:{color:"#00ffff",opacity:"0.7",name:"intro"},outro:{color:"#0202ed",opacity:"0.7",name:"outro"},interaction:{color:"#cc00ff",opacity:"0.7",name:"interaction reminder"},selfpromo:{color:"#ffff00",opacity:"0.7",name:"self-promotion"},music_offtopic:{color:"#ff9900",opacity:"0.7",name:"non-music part"}};class _{constructor(e){n(this,"video",null),n(this,"active",!0),n(this,"attachVideoTimeout",null),n(this,"nextSkipTimeout",null),n(this,"sliderInterval",null),n(this,"observer",null),n(this,"scheduleSkipHandler",null),n(this,"durationChangeHandler",null),n(this,"segments",null),n(this,"skippableCategories",[]),this.videoID=e}init(){var n,o=this;return(n=e().mark((function t(){var n,r,i,a,l;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=m(o.videoID).substring(0,4),r=["sponsor","intro","outro","interaction","selfpromo","music_offtopic"],e.next=4,fetch(`https://sponsorblock.inf.re/api/skipSegments/${n}?categories=${encodeURIComponent(JSON.stringify(r))}`);case 4:return i=e.sent,e.next=7,i.json();case 7:if(a=e.sent,l=a.find((e=>e.videoID===o.videoID)),console.info(o.videoID,"Got it:",l),l&&l.segments&&l.segments.length){e.next=13;break}return console.info(o.videoID,"No segments found."),e.abrupt("return");case 13:o.segments=l.segments,o.skippableCategories=o.getSkippableCategories(),o.scheduleSkipHandler=()=>o.scheduleSkip(),o.durationChangeHandler=()=>o.buildOverlay(),o.attachVideo(),o.buildOverlay();case 19:case"end":return e.stop()}}),t)})),function(){var e=this,o=arguments;return new Promise((function(r,i){var a=n.apply(e,o);function l(e){t(a,r,i,l,c,"next",e)}function c(e){t(a,r,i,l,c,"throw",e)}l(void 0)}))})()}getSkippableCategories(){var e=[];return u("enableSponsorBlockSponsor")&&e.push("sponsor"),u("enableSponsorBlockIntro")&&e.push("intro"),u("enableSponsorBlockOutro")&&e.push("outro"),u("enableSponsorBlockInteraction")&&e.push("interaction"),u("enableSponsorBlockSelfPromo")&&e.push("selfpromo"),u("enableSponsorBlockMusicOfftopic")&&e.push("music_offtopic"),e}attachVideo(){if(clearTimeout(this.attachVideoTimeout),this.attachVideoTimeout=null,this.video=document.querySelector("video"),!this.video)return console.info(this.videoID,"No video yet..."),void(this.attachVideoTimeout=setTimeout((()=>this.attachVideo()),100));console.info(this.videoID,"Video found, binding..."),this.video.addEventListener("play",this.scheduleSkipHandler),this.video.addEventListener("pause",this.scheduleSkipHandler),this.video.addEventListener("timeupdate",this.scheduleSkipHandler),this.video.addEventListener("durationchange",this.durationChangeHandler)}buildOverlay(){if(this.segmentsoverlay)console.info("Overlay already built");else if(this.video&&this.video.duration){var e=this.video.duration;this.segmentsoverlay=document.createElement("div"),this.segments.forEach((t=>{var n=o(t.segment,2),r=n[0],i=n[1],a=S[t.category]||{color:"blue",opacity:.7},l=`translateX(${r/e*100}%) scaleX(${(i-r)/e})`,c=document.createElement("div");c.classList.add("ytlr-progress-bar__played"),c.style.background=a.color,c.style.opacity=a.opacity,c.style["-webkit-transform"]=l,console.info("Generated element",c,"from",t,l),this.segmentsoverlay.appendChild(c)})),this.observer=new MutationObserver((e=>{e.forEach((e=>{if(e.removedNodes){var t,n=a(e.removedNodes);try{for(n.s();!(t=n.n()).done;){t.value===this.segmentsoverlay&&(console.info("bringing back segments overlay"),this.slider.appendChild(this.segmentsoverlay))}}catch(e){n.e(e)}finally{n.f()}}}))})),this.sliderInterval=setInterval((()=>{this.slider=document.querySelector(".ytlr-progress-bar__slider"),this.slider&&(clearInterval(this.sliderInterval),this.sliderInterval=null,this.observer.observe(this.slider,{childList:!0}),this.slider.appendChild(this.segmentsoverlay))}),500)}else console.info("No video duration yet")}scheduleSkip(){if(clearTimeout(this.nextSkipTimeout),this.nextSkipTimeout=null,this.active)if(this.video.paused)console.info(this.videoID,"Currently paused, ignoring...");else{var e=this.segments.filter((e=>e.segment[0]>this.video.currentTime-.3&&e.segment[1]>this.video.currentTime-.3));if(e.sort(((e,t)=>e.segment[0]-t.segment[0])),e.length){var t=o(e,1)[0],n=o(t.segment,2),r=n[0],i=n[1];console.info(this.videoID,"Scheduling skip of",t,"in",r-this.video.currentTime),this.nextSkipTimeout=setTimeout((()=>{var e;if(this.video.paused)console.info(this.videoID,"Currently paused, ignoring...");else if(this.skippableCategories.includes(t.category)){var n=(null===(e=S[t.category])||void 0===e?void 0:e.name)||t.category;console.info(this.videoID,"Skipping",t),k(`Skipping ${n}`),this.video.currentTime=i,this.scheduleSkip()}else console.info(this.videoID,"Segment",t.category,"is not skippable, ignoring...")}),1e3*(r-this.video.currentTime))}else console.info(this.videoID,"No more segments")}else console.info(this.videoID,"No longer active, ignoring...")}destroy(){console.info(this.videoID,"Destroying"),this.active=!1,this.nextSkipTimeout&&(clearTimeout(this.nextSkipTimeout),this.nextSkipTimeout=null),this.attachVideoTimeout&&(clearTimeout(this.attachVideoTimeout),this.attachVideoTimeout=null),this.sliderInterval&&(clearInterval(this.sliderInterval),this.sliderInterval=null),this.observer&&(this.observer.disconnect(),this.observer=null),this.segmentsoverlay&&(this.segmentsoverlay.remove(),this.segmentsoverlay=null),this.video&&(this.video.removeEventListener("play",this.scheduleSkipHandler),this.video.removeEventListener("pause",this.scheduleSkipHandler),this.video.removeEventListener("timeupdate",this.scheduleSkipHandler),this.video.removeEventListener("durationchange",this.durationChangeHandler))}}window.sponsorblock=null,window.addEventListener("hashchange",(()=>{var e=new URL(location.hash.substring(1),location.href).search.replace("?v=","").split("&")[0],t=e&&(!window.sponsorblock||window.sponsorblock.videoID!=e);if(console.info("hashchange",e,window.sponsorblock,window.sponsorblock?window.sponsorblock.videoID:null,t),t){if(window.sponsorblock){try{window.sponsorblock.destroy()}catch(e){console.warn("window.sponsorblock.destroy() failed!",e)}window.sponsorblock=null}u("enableSponsorBlock")?(window.sponsorblock=new _(e),window.sponsorblock.init()):console.info("SponsorBlock disabled, not loading")}}),!1);var E=setInterval((()=>{document.querySelector("video")&&(!function(){var e=null,t=u("videoSpeed");window.__spatialNavigation__.keyMode="NONE";var n={37:"left",38:"up",39:"right",40:"down"},o=document.createElement("div");o.classList.add("ytaf-ui-container"),o.style.display="none",o.setAttribute("tabindex",0),o.addEventListener("focus",(()=>console.info("speedUIContainer focused!")),!0),o.addEventListener("blur",(()=>console.info("speedUIContainer blured!")),!0),o.addEventListener("navbeforefocus",(t=>{console.info("navbeforefocus",t.target),e=t.target})),o.addEventListener("keydown",(r=>{if(console.info("speedUIContainer key event:",r.type,r.keyCode),404!==r.keyCode&&172!==r.keyCode){if(r.keyCode in n)navigate(n[r.keyCode]);else if(13===r.keyCode||32===r.keyCode){if(e){e.checked=!0;var i=document.querySelector('input[name="speed"]:checked').value;d("videoSpeed",i),t=i,document.getElementsByTagName("video")[0].playbackRate=t}}else 27===r.keyCode&&(o.style.display="none",o.blur());r.preventDefault(),r.stopPropagation()}}),!0),document.querySelector("video").addEventListener("canplay",(()=>{document.getElementsByTagName("video")[0].playbackRate=t})),o.innerHTML="\n <h1>TizenTube Video Speed Settings</h1>\n ";for(var r=4,i=.25,a=i;a<=r;a+=i){var l=`speed${a.toString().replace(".","_")}`;if(o.innerHTML+=`\n <label for="${l}"><input type="radio" id="${l}" name="speed" value="${a}">${a}x</label>\n `,1==a){var c=`speed${(a=1.0001).toString().replace(".","_")}`;o.innerHTML+=`\n <label for="${c}"><input type="radio" id="${c}" name="speed" value="${a}">${a}x</label>\n `,a=1}}document.querySelector("body").appendChild(o);var s=e=>406!=e.keyCode&&191!=e.keyCode||(console.info("Taking over!"),e.preventDefault(),e.stopPropagation(),"keydown"===e.type&&("none"===o.style.display?(console.info("Showing and focusing!"),o.style.display="block",o.focus()):(console.info("Hiding!"),o.style.display="none",o.blur())),!1);document.addEventListener("keydown",s,!0),document.addEventListener("keypress",s,!0),document.addEventListener("keyup",s,!0)}(),clearInterval(E))}),1e3)}();
package/package.json CHANGED
@@ -1,14 +1,23 @@
1
1
  {
2
2
  "name": "@foxreis/tizentube",
3
3
  "appName": "TizenTube",
4
- "version": "1.3.0",
4
+ "version": "1.3.2",
5
5
  "description": "TizenTube is an ad-free and sponsor-free solution for your favourite streaming website on your Tizen (Samsung) TVs.",
6
6
  "packageType": "mods",
7
7
  "websiteURL": "https://youtube.com/tv",
8
8
  "main": "dist/userScript.js",
9
9
  "author": "Reis Can",
10
10
  "serviceFile": "dist/service.js",
11
- "keys": ["MediaPlayPause"],
11
+ "keys": [
12
+ "MediaPlayPause",
13
+ "MediaPlay",
14
+ "MediaPause",
15
+ "MediaStop",
16
+ "MediaFastForward",
17
+ "MediaRewind",
18
+ "MediaTrackNext",
19
+ "MediaTrackPrevious"
20
+ ],
12
21
  "repository": {
13
22
  "url": "https://github.com/reisxd/TizenTube"
14
23
  },
package/mods/adblock.js DELETED
@@ -1,99 +0,0 @@
1
- import { configRead } from './config.js';
2
-
3
- /**
4
- * This is a minimal reimplementation of the following uBlock Origin rule:
5
- * https://github.com/uBlockOrigin/uAssets/blob/3497eebd440f4871830b9b45af0afc406c6eb593/filters/filters.txt#L116
6
- *
7
- * This in turn calls the following snippet:
8
- * https://github.com/gorhill/uBlock/blob/bfdc81e9e400f7b78b2abc97576c3d7bf3a11a0b/assets/resources/scriptlets.js#L365-L470
9
- *
10
- * Seems like for now dropping just the adPlacements is enough for YouTube TV
11
- */
12
- const origParse = JSON.parse;
13
- JSON.parse = function () {
14
- const r = origParse.apply(this, arguments);
15
- if (r.adPlacements && configRead('enableAdBlock')) {
16
- r.adPlacements = [];
17
- }
18
-
19
- // Also set playerAds to false, just incase.
20
- if (r.playerAds && configRead('enableAdBlock')) {
21
- r.playerAds = false;
22
- }
23
-
24
- // Also set adSlots to an empty array, emptying only the adPlacements won't work.
25
- if (r.adSlots && configRead('enableAdBlock')) {
26
- r.adSlots = [];
27
- }
28
-
29
- // Drop "masthead" ad from home screen
30
- if (
31
- r?.contents?.tvBrowseRenderer?.content?.tvSurfaceContentRenderer?.content
32
- ?.sectionListRenderer?.contents &&
33
- configRead('enableAdBlock')
34
- ) {
35
- r.contents.tvBrowseRenderer.content.tvSurfaceContentRenderer.content.sectionListRenderer.contents =
36
- r.contents.tvBrowseRenderer.content.tvSurfaceContentRenderer.content.sectionListRenderer.contents.filter(
37
- (elm) => !elm.adSlotRenderer
38
- );
39
- }
40
-
41
- // DeArrow Implementation. I think this is the best way to do it. (DOM manipulation would be a pain)
42
-
43
- if (
44
- r?.contents?.tvBrowseRenderer?.content?.tvSurfaceContentRenderer?.content
45
- ?.sectionListRenderer?.contents
46
- ) {
47
- processShelves(r.contents.tvBrowseRenderer.content.tvSurfaceContentRenderer.content.sectionListRenderer.contents);
48
- }
49
-
50
- if (r?.continuationContents?.sectionListContinuation?.contents) {
51
- processShelves(r.continuationContents.sectionListContinuation.contents);
52
- }
53
-
54
- if (r?.continuationContents?.horizontalListContinuation?.items) {
55
- deArrowify(r.continuationContents.horizontalListContinuation.items);
56
- }
57
- return r;
58
- };
59
-
60
-
61
- function processShelves(shelves) {
62
- for (const shelve of shelves) {
63
- if (shelve.shelfRenderer) {
64
- deArrowify(shelve.shelfRenderer.content.horizontalListRenderer.items)
65
- }
66
- }
67
- }
68
-
69
- function deArrowify(items) {
70
- for (const item of items) {
71
- if (item.adSlotRenderer) {
72
- const index = items.indexOf(item);
73
- items.splice(index, 1);
74
- continue;
75
- }
76
- if (configRead('enableDeArrow')) {
77
- const videoID = item.tileRenderer.contentId;
78
- fetch(`https://sponsor.ajay.app/api/branding?videoID=${videoID}`).then(res => res.json()).then(data => {
79
- if (data.titles.length > 0) {
80
- const mostVoted = data.titles.reduce((max, title) => max.votes > title.votes ? max : title);
81
- item.tileRenderer.metadata.tileMetadataRenderer.title.simpleText = mostVoted.title;
82
- }
83
-
84
- if (data.thumbnails.length > 0 && configRead('enableDeArrowThumbnails')) {
85
- const mostVotedThumbnail = data.thumbnails.reduce((max, thumbnail) => max.votes > thumbnail.votes ? max : thumbnail);
86
- if (mostVotedThumbnail.timestamp) {
87
- item.tileRenderer.header.tileHeaderRenderer.thumbnail.thumbnails = [
88
- {
89
- url: `https://dearrow-thumb.ajay.app/api/v1/getThumbnail?videoID=${videoID}&time=${mostVotedThumbnail.timestamp}`,
90
- width: 1280,
91
- height: 640
92
- }
93
- ]
94
- }
95
- }
96
- });
97
- }
98
- }
99
- }
package/mods/config.js DELETED
@@ -1,46 +0,0 @@
1
- const CONFIG_KEY = 'ytaf-configuration';
2
- const defaultConfig = {
3
- enableAdBlock: true,
4
- enableSponsorBlock: true,
5
- enableSponsorBlockSponsor: true,
6
- enableSponsorBlockIntro: true,
7
- enableSponsorBlockOutro: true,
8
- enableSponsorBlockInteraction: true,
9
- enableSponsorBlockSelfPromo: true,
10
- enableSponsorBlockMusicOfftopic: true,
11
- videoSpeed: 1,
12
- enableDeArrow: true,
13
- enableDeArrowThumbnails: false,
14
- focusContainerColor: '#0f0f0f',
15
- routeColor: '#0f0f0f',
16
- enableFixedUI: true
17
- };
18
-
19
- let localConfig;
20
-
21
- try {
22
- localConfig = JSON.parse(window.localStorage[CONFIG_KEY]);
23
- } catch (err) {
24
- console.warn('Config read failed:', err);
25
- localConfig = defaultConfig;
26
- }
27
-
28
- export function configRead(key) {
29
- if (localConfig[key] === undefined) {
30
- console.warn(
31
- 'Populating key',
32
- key,
33
- 'with default value',
34
- defaultConfig[key]
35
- );
36
- localConfig[key] = defaultConfig[key];
37
- }
38
-
39
- return localConfig[key];
40
- }
41
-
42
- export function configWrite(key, value) {
43
- console.info('Setting key', key, 'to', value);
44
- localConfig[key] = value;
45
- window.localStorage[CONFIG_KEY] = JSON.stringify(localConfig);
46
- }
@@ -1,104 +0,0 @@
1
- //
2
- // https://raw.githubusercontent.com/Financial-Times/polyfill-library/c25c30e4463bef60fba1213ecb697f3e3f253d7b/polyfills/DOMRect/polyfill.js
3
- // License: MIT
4
- //
5
-
6
- (function (global) {
7
- function number(v) {
8
- return v === undefined ? 0 : Number(v);
9
- }
10
-
11
- function different(u, v) {
12
- return u !== v && !(isNaN(u) && isNaN(v));
13
- }
14
-
15
- function DOMRect(xArg, yArg, wArg, hArg) {
16
- var x, y, width, height, left, right, top, bottom;
17
-
18
- x = number(xArg);
19
- y = number(yArg);
20
- width = number(wArg);
21
- height = number(hArg);
22
-
23
- Object.defineProperties(this, {
24
- x: {
25
- get: function () { return x; },
26
- set: function (newX) {
27
- if (different(x, newX)) {
28
- x = newX;
29
- left = right = undefined;
30
- }
31
- },
32
- enumerable: true
33
- },
34
- y: {
35
- get: function () { return y; },
36
- set: function (newY) {
37
- if (different(y, newY)) {
38
- y = newY;
39
- top = bottom = undefined;
40
- }
41
- },
42
- enumerable: true
43
- },
44
- width: {
45
- get: function () { return width; },
46
- set: function (newWidth) {
47
- if (different(width, newWidth)) {
48
- width = newWidth;
49
- left = right = undefined;
50
- }
51
- },
52
- enumerable: true
53
- },
54
- height: {
55
- get: function () { return height; },
56
- set: function (newHeight) {
57
- if (different(height, newHeight)) {
58
- height = newHeight;
59
- top = bottom = undefined;
60
- }
61
- },
62
- enumerable: true
63
- },
64
- left: {
65
- get: function () {
66
- if (left === undefined) {
67
- left = x + Math.min(0, width);
68
- }
69
- return left;
70
- },
71
- enumerable: true
72
- },
73
- right: {
74
- get: function () {
75
- if (right === undefined) {
76
- right = x + Math.max(0, width);
77
- }
78
- return right;
79
- },
80
- enumerable: true
81
- },
82
- top: {
83
- get: function () {
84
- if (top === undefined) {
85
- top = y + Math.min(0, height);
86
- }
87
- return top;
88
- },
89
- enumerable: true
90
- },
91
- bottom: {
92
- get: function () {
93
- if (bottom === undefined) {
94
- bottom = y + Math.max(0, height);
95
- }
96
- return bottom;
97
- },
98
- enumerable: true
99
- }
100
- });
101
- }
102
-
103
- global.DOMRect = DOMRect;
104
- }(self));