UNPKG

@zyrecx/tflix

Version:

TFlix transforms Cineby.gd into a TV-friendly experience for Samsung TVs running TizenBrew with enhanced remote navigation.

2 lines (1 loc) 26.2 kB
!function(){"use strict";function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function t(t,n){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,n){if(t){if("string"==typeof t)return e(t,n);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?e(t,n):void 0}}(t))||n&&t&&"number"==typeof t.length){r&&(t=r);var o=0,i=function(){};return{s:i,n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[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,c=!0,l=!1;return{s:function(){r=r.call(t)},n:function(){var e=r.next();return c=e.done,e},e:function(e){l=!0,a=e},f:function(){try{c||null==r.return||r.return()}finally{if(l)throw a}}}}!function(){if(!("navigate"in window)){var e={37:"left",38:"up",39:"right",40:"down"};document.addEventListener("keydown",r),window.__spatialNavigation__={keyMode:"ARROW",findNextFocusableElement:n,ensureElementIsVisible:o},window.navigate=function(e){var t=n(document.activeElement||document.body,e);if(t){var r=document.querySelector(".tflix-focused");return r&&r.classList.remove("tflix-focused"),t.classList.add("tflix-focused"),o(t),t.focus(),!0}return!1}}function n(e,n){var r=document.querySelectorAll('a, button, input, select, textarea, [tabindex]:not([tabindex="-1"])'),o=Array.from(r).filter(function(e){var t=window.getComputedStyle(e);return"none"!==t.display&&"hidden"!==t.visibility&&!e.disabled});if(!o.length)return null;var i,a=e.getBoundingClientRect(),c=null,l=1/0,s=t(o);try{for(s.s();!(i=s.n()).done;){var d=i.value;if(d!==e){var u=d.getBoundingClientRect(),f=!1;switch(n){case"up":f=u.bottom<a.top;break;case"down":f=u.top>a.bottom;break;case"left":f=u.right<a.left;break;case"right":f=u.left>a.right}if(f){var m=u.left+u.width/2-(a.left+a.width/2),v=u.top+u.height/2-(a.top+a.height/2),p=void 0;switch(n){case"up":case"down":p=Math.abs(v)+.5*Math.abs(m);break;case"left":case"right":p=Math.abs(m)+.5*Math.abs(v)}p<l&&(l=p,c=d)}}}}catch(e){s.e(e)}finally{s.f()}return c}function r(t){var r=function(t){return e[t.keyCode]}(t);if(r){t.preventDefault();var i=n(document.activeElement||document.body,r);if(i){var a=document.querySelector(".tflix-focused");a&&a.classList.remove("tflix-focused"),i.classList.add("tflix-focused"),o(i),i.focus()}}}function o(e){var t=e.getBoundingClientRect();t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)||e.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}}();var n=null,r=null,o=null,i=null,a=null;function c(){var e,t,r=document.createElement("style");r.textContent="/* TFlix UI Enhancement Styles */\r\n\r\n/* Focus highlighting for navigation */\r\n.tflix-focused {\r\n transform: scale(1.05);\r\n box-shadow: 0 0 10px 2px rgba(255, 255, 255, 0.8);\r\n transition: all 0.2s ease;\r\n z-index: 100;\r\n position: relative;\r\n outline: none !important;\r\n}\r\n\r\n/* Ensure focused items are clearly visible */\r\n.tflix-focused img {\r\n border: 2px solid rgba(255, 255, 255, 0.9);\r\n}\r\n\r\n/* Add a glow effect for movie/show tiles */\r\n.tflix-focused::before {\r\n content: '';\r\n position: absolute;\r\n top: -3px;\r\n left: -3px;\r\n right: -3px;\r\n bottom: -3px;\r\n border: 2px solid #FFFFFF;\r\n border-radius: 3px;\r\n box-shadow: 0 0 15px 3px rgba(255, 255, 255, 0.5);\r\n pointer-events: none;\r\n z-index: -1;\r\n}\r\n\r\n/* Hide cursor when using remote navigation */\r\nbody.tflix-navigation-mode {\r\n cursor: none !important;\r\n}\r\n\r\n/* Video player controls enhancements for TV remote */\r\n.tflix-player-controls {\r\n position: absolute;\r\n bottom: 0;\r\n width: 100%;\r\n background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));\r\n padding: 20px;\r\n z-index: 999;\r\n display: flex;\r\n justify-content: space-between;\r\n align-items: center;\r\n opacity: 0;\r\n transition: opacity 0.3s ease;\r\n}\r\n\r\n.tflix-player-controls.show {\r\n opacity: 1;\r\n}\r\n\r\n.tflix-control-button {\r\n width: 50px;\r\n height: 50px;\r\n border-radius: 50%;\r\n background: rgba(255, 255, 255, 0.3);\r\n border: 2px solid rgba(255, 255, 255, 0.5);\r\n color: white;\r\n font-size: 24px;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n margin: 0 10px;\r\n cursor: pointer;\r\n}\r\n\r\n.tflix-control-button.focused,\r\n.tflix-control-button:hover {\r\n background: rgba(255, 255, 255, 0.6);\r\n transform: scale(1.1);\r\n}\r\n\r\n.tflix-progress-bar {\r\n width: 70%;\r\n height: 8px;\r\n background: rgba(255, 255, 255, 0.3);\r\n border-radius: 5px;\r\n margin: 0 20px;\r\n position: relative;\r\n}\r\n\r\n.tflix-progress-filled {\r\n height: 100%;\r\n background: rgba(255, 255, 255, 0.8);\r\n border-radius: 5px;\r\n width: 0%;\r\n}\r\n\r\n.tflix-toast {\r\n position: absolute;\r\n top: 20px;\r\n right: 20px;\r\n background: rgba(0, 0, 0, 0.7);\r\n color: white;\r\n padding: 10px 20px;\r\n border-radius: 5px;\r\n z-index: 9999;\r\n font-size: 18px;\r\n opacity: 0;\r\n transform: translateY(-20px);\r\n transition: all 0.3s ease;\r\n}\r\n\r\n.tflix-toast.show {\r\n opacity: 1;\r\n transform: translateY(0);\r\n}\r\n\r\n/* Enhanced Search Element Styling */\r\n.tflix-search-element {\r\n transition: all 0.2s ease;\r\n position: relative;\r\n}\r\n\r\n.tflix-search-element:focus,\r\n.tflix-search-element:hover {\r\n transform: scale(1.1);\r\n box-shadow: 0 0 15px 3px rgba(255, 255, 255, 0.5);\r\n z-index: 200;\r\n}\r\n\r\n/* Video info toast */\r\n.tflix-video-toast {\r\n position: absolute;\r\n top: 50%;\r\n left: 50%;\r\n transform: translate(-50%, -50%) scale(0.9);\r\n background: rgba(0, 0, 0, 0.8);\r\n color: white;\r\n padding: 15px 30px;\r\n border-radius: 8px;\r\n z-index: 10000;\r\n font-size: 24px;\r\n opacity: 0;\r\n transition: all 0.3s ease;\r\n}\r\n\r\n.tflix-video-toast.show {\r\n opacity: 1;\r\n transform: translate(-50%, -50%) scale(1);\r\n}\r\n\r\n/* Video time display */\r\n.tflix-video-time {\r\n position: absolute;\r\n top: 20px;\r\n right: 20px;\r\n background: rgba(0, 0, 0, 0.7);\r\n color: white;\r\n padding: 8px 12px;\r\n border-radius: 5px;\r\n font-size: 16px;\r\n z-index: 9998;\r\n}\r\n\r\n/* Enhanced Play Button styling */\r\n.tflix-play-button {\r\n transform: scale(1.05);\r\n transition: all 0.2s ease;\r\n position: relative;\r\n z-index: 100;\r\n box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);\r\n}\r\n\r\n.tflix-play-button::before {\r\n content: '';\r\n position: absolute;\r\n top: -5px;\r\n left: -5px;\r\n right: -5px;\r\n bottom: -5px;\r\n border: 2px solid rgba(255, 255, 255, 0.7);\r\n border-radius: 5px;\r\n pointer-events: none;\r\n z-index: -1;\r\n opacity: 0.8;\r\n}\r\n\r\n.tflix-play-button:hover,\r\n.tflix-play-button:focus,\r\n.tflix-play-button.tflix-focused {\r\n transform: scale(1.1);\r\n box-shadow: 0 0 20px rgba(255, 255, 255, 0.6);\r\n}\r\n\r\n.tflix-play-button:hover::before,\r\n.tflix-play-button:focus::before,\r\n.tflix-play-button.tflix-focused::before {\r\n border-color: white;\r\n box-shadow: 0 0 15px 5px rgba(255, 255, 255, 0.5);\r\n}\r\n\r\n/* Loading indicator for video */\r\n.tflix-loading {\r\n position: fixed;\r\n top: 50%;\r\n left: 50%;\r\n transform: translate(-50%, -50%);\r\n background: rgba(0, 0, 0, 0.7);\r\n color: white;\r\n padding: 20px 40px;\r\n border-radius: 10px;\r\n font-size: 20px;\r\n z-index: 9999;\r\n}\r\n",document.head.appendChild(r),document.body.classList.add("tflix-navigation-mode"),(t=[document.querySelector("nav a"),document.querySelector(".navigation a"),document.querySelector("header a"),document.querySelector(".movie-card"),document.querySelector(".content-item"),document.querySelector(".film-item"),document.querySelector("a"),document.querySelector("button")].find(function(e){return null!==e}))&&(t.classList.add("tflix-focused"),t.focus(),(e=t)&&e.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})),document.addEventListener("keydown",function(e){switch(e.key){case"MediaPlayPause":p();break;case"MediaPlay":n&&(n.play(),b("Playing"));break;case"MediaPause":n&&(n.pause(),b("Paused"));break;case"MediaStop":n&&(n.pause(),n.currentTime=0,b("Stopped"));break;case"MediaFastForward":h(30);break;case"MediaRewind":h(-30);break;case"MediaTrackNext":h(10);break;case"MediaTrackPrevious":h(-10);break;case"Back":case"XF86Back":!function(e){if(e.preventDefault(),window.location.hostname.includes("cineby.gd")&&n&&n.parentElement&&(document.fullscreenElement||n.closest(".video-player-container")||"fixed"===n.style.position||"fixed"===n.parentElement.style.position)){document.fullscreenElement&&document.exitFullscreen().catch(function(){}),n.pause();var t=document.querySelector(".close-button, .back-button, .exit-button");t?t.click():window.tflixLastMovieUrl&&window.tflixLastMovieUrl.includes("/movie/")?window.location.href=window.tflixLastMovieUrl:window.history.back()}else if(n&&n.parentElement&&(document.fullscreenElement||n.closest(".video-player-container"))){document.fullscreenElement&&document.exitFullscreen().catch(function(){}),n.pause();var r=document.querySelector(".close-button, .back-button, .exit-button");r?r.click():window.history.back()}else if(window.history.length>1)window.history.back();else{var o=document.querySelector('.back-button, [aria-label="Back"], [aria-label="Go back"]');o&&o.click()}}(e)}}),new MutationObserver(function(e){e.forEach(function(e){if(e.addedNodes.length){var t=Array.from(e.addedNodes).find(function(e){return"VIDEO"===e.nodeName||e.querySelector&&e.querySelector("video")});t&&(n="VIDEO"===t.nodeName?t:t.querySelector("video"))&&l(n)}})}).observe(document.body,{childList:!0,subtree:!0}),(n=document.querySelector("video"))&&l(n)}function l(e){n=e,function(e){if(!e)return;e.style.display="block",e.style.opacity="1",e.style.visibility="visible";var t=e.parentElement;if(t){t.style.display="block",t.style.opacity="1",t.style.visibility="visible",t.style.backgroundColor="#000",t.classList.add("tflix-video-container");var n=window.getComputedStyle(t);"absolute"!==n.position&&"fixed"!==n.position||(t.style.top="0",t.style.left="0",t.style.width="100%",t.style.height="100%",t.style.zIndex="9999")}e.autoplay=!0,e.controls=!0,e.style.width="100%",e.style.height="auto",e.style.maxHeight="100vh",e.style.maxWidth="100vw",e.style.objectFit="contain",e.setAttribute("playsinline",""),e.hasAttribute("crossorigin")||e.setAttribute("crossorigin","anonymous");e.hasAttribute("preload")||e.setAttribute("preload","auto");if(window.location.hostname.includes("cineby.gd")){e.setAttribute("controlsList","nodownload"),window.tflixVideoElement=e,window.tflixLastMovieUrl=window.location.href,document.addEventListener("keydown",s);var r=0,o=function(){e.play().catch(function(){++r<5?setTimeout(o,500*r):b("Press Enter to start playback")})};setTimeout(o,1e3)}}(e),function(){if(r)return;(r=document.createElement("div")).className="tflix-player-controls";var e=document.createElement("button");e.className="tflix-control-button play-pause",e.innerHTML="⏸️",e.addEventListener("click",p);var t=document.createElement("button");t.className="tflix-control-button rewind",t.innerHTML="⏪",t.addEventListener("click",function(){return h(-10)});var a=document.createElement("button");a.className="tflix-control-button fast-forward",a.innerHTML="⏩",a.addEventListener("click",function(){return h(10)}),(o=document.createElement("div")).className="tflix-progress-bar",(i=document.createElement("div")).className="tflix-progress-filled",o.appendChild(i),r.appendChild(t),r.appendChild(e),r.appendChild(o),r.appendChild(a);var c=n.parentElement;c?(c.style.position="relative",c.appendChild(r)):document.body.appendChild(r)}(),n.addEventListener("play",f),n.addEventListener("pause",f),n.addEventListener("timeupdate",m),n.addEventListener("ended",v),n.addEventListener("error",d),document.addEventListener("keydown",function(e){Object.values(y).includes(e.key)&&u()})}function s(e){var t=window.tflixVideoElement;if(t&&window.location.pathname.includes("/movie/")&&"none"!==t.style.display&&"hidden"!==t.style.visibility)switch(e.key){case"Enter":e.preventDefault(),t.paused?(b("Starting playback..."),t.play().catch(function(){b("Unable to play. Try pressing Back and selecting again.")})):(t.pause(),b("Paused"));break;case"ArrowUp":e.preventDefault(),t.volume=Math.min(1,t.volume+.1),b("Volume: ".concat(Math.round(100*t.volume),"%"));break;case"ArrowDown":e.preventDefault(),t.volume=Math.max(0,t.volume-.1),b("Volume: ".concat(Math.round(100*t.volume),"%"));break;case"ArrowLeft":e.preventDefault(),t.currentTime=Math.max(0,t.currentTime-10),b("- 10 seconds");break;case"ArrowRight":e.preventDefault(),t.currentTime=Math.min(t.duration,t.currentTime+10),b("+ 10 seconds")}}function d(e){var r=function(e){switch(e){case 1:return"Fetching process aborted";case 2:return"Network error";case 3:return"Decoding error";case 4:return"Video not supported";default:return"Unknown error"}}(n.error?n.error.code:0);b("Video error: ".concat(r,". Trying to recover..."));var o=n.src,i=n.currentTime||0;if(window.location.hostname.includes("cineby.gd")&&(!o||"undefined"===o||""===o)){var a=Array.from(document.querySelectorAll("video")).filter(function(e){return e!==n});if(a.length>0){var c,l=t(a);try{for(l.s();!(c=l.n()).done;){var s=c.value;if(s.src&&""!==s.src)return n.src=s.src,n.load(),n.currentTime=i,void n.play().catch(function(){b("Still having trouble. Try using the back button and selecting again.")})}}catch(e){l.e(e)}finally{l.f()}}}setTimeout(function(){n&&(n.src="",setTimeout(function(){n.src=o,n.load(),n.currentTime=i,n.play().catch(function(){b("Could not play video. Try exiting and selecting again.")})},1e3))},2e3)}function u(){r&&(r.classList.add("show"),a&&clearTimeout(a),a=setTimeout(function(){r.classList.remove("show")},3e3))}function f(){if(n&&r){var e=r.querySelector(".play-pause");e&&(e.innerHTML=n.paused?"▶️":"⏸️"),u()}}function m(){if(n&&i){var e=n.currentTime/n.duration*100;i.style.width="".concat(e,"%")}}function v(){if(r){var e=r.querySelector(".play-pause");e&&(e.innerHTML="▶️"),u()}}function p(){n&&(n.paused?n.play():n.pause(),b(n.paused?"Paused":"Playing"))}function h(e){n&&(n.currentTime=Math.max(0,Math.min(n.duration,n.currentTime+e)),b("".concat(e>0?"+":"").concat(e," seconds")))}function b(e){var t=document.querySelector(".tflix-toast");t||((t=document.createElement("div")).className="tflix-toast",document.body.appendChild(t)),t.textContent=e,t.classList.add("show"),setTimeout(function(){t.classList.remove("show")},2e3)}var y={ArrowLeft:"left",ArrowUp:"up",ArrowRight:"right",ArrowDown:"down"},w=setInterval(function(){if("complete"===document.readyState||"interactive"===document.readyState){try{c()}catch(e){setTimeout(c,1e3)}clearInterval(w)}},250);if("undefined"!=typeof tizen&&tizen.tvinputdevice)try{tizen.tvinputdevice.registerKey("Back")}catch(e){}function x(){document.querySelectorAll(['input[type="search"]','input[placeholder*="search" i]','input[placeholder*="find" i]','button[aria-label*="search" i]',".search-button",".search-icon",'a[href*="search"]','svg[class*="search" i]','i[class*="search" i]',".search-container",'form[action*="search"]'].join(", ")).forEach(function(e){e.setAttribute("tabindex","0"),e.setAttribute("data-tflix-search","true"),e.classList.add("tflix-search-element"),e.parentElement&&!e.parentElement.getAttribute("tabindex")&&(e.parentElement.setAttribute("tabindex","0"),e.parentElement.setAttribute("data-tflix-search-parent","true")),e.addEventListener("click",function(){!function(e){var t;if("input"===e.tagName.toLowerCase())return void e.focus();if("a"===e.tagName.toLowerCase()&&(e.href.includes("search")||null!==(t=e.getAttribute("href"))&&void 0!==t&&t.includes("search")))return void(window.location.href=e.href);var n=e.closest("form");if(n)return void n.submit();if(window.location.hostname.includes("cineby.gd"))window.location.href="https://www.cineby.gd/search"}(e)}),e.addEventListener("focus",function(){var e;(e=document.createElement("div")).className="tflix-toast",e.textContent="Press OK to access search",document.body.appendChild(e),setTimeout(function(){e.classList.add("show")},10),setTimeout(function(){e.classList.remove("show"),setTimeout(function(){e.remove()},300)},2e3)})}),function(){if(document.querySelectorAll("header, nav, .header, .navigation, .top-bar").forEach(function(e){var t=Array.from(e.querySelectorAll("a")).find(function(e){var t;return e.textContent.toLowerCase().includes("search")||e.href.includes("search")||(null===(t=e.getAttribute("aria-label"))||void 0===t?void 0:t.toLowerCase().includes("search"))});t&&(t.setAttribute("tabindex","0"),t.setAttribute("data-tflix-search-nav","true"),t.classList.add("tflix-search-element"),t.addEventListener("keydown",function(e){"Enter"===e.key&&(e.preventDefault(),window.location.href=t.href)}))}),window.location.hostname.includes("cineby.gd")){document.querySelectorAll('a[href*="search"]').forEach(function(e){e.setAttribute("tabindex","0"),e.classList.add("tflix-search-element")})}}()}function g(e){e&&(window.tflixVideoElement=e,e.style.display="block",e.style.opacity="1",e.style.visibility="visible",e.controls=!0,document.addEventListener("keydown",E),e.volume>.8&&(e.volume=.8),function(e){if(!e)return;var t=document.createElement("div");t.className="tflix-video-time";var n=e.parentElement;n&&n.appendChild(t);function r(){if(!e.paused){var n=o(e.currentTime),r=o(e.duration);t.textContent="".concat(n," / ").concat(r),t.style.display="block",setTimeout(function(){e.paused||(t.style.display="none")},3e3)}}function o(e){if(isNaN(e))return"00:00";var t=Math.floor(e/60),n=Math.floor(e%60);return"".concat(t.toString().padStart(2,"0"),":").concat(n.toString().padStart(2,"0"))}e.addEventListener("timeupdate",r),e.addEventListener("play",r),e.addEventListener("pause",r),e.addEventListener("seeking",r)}(e))}function E(e){var t=window.tflixVideoElement;if(t&&window.location.pathname.includes("/movie/"))switch(e.key){case"Enter":e.preventDefault(),t.paused?t.play():t.pause();break;case"ArrowUp":e.preventDefault(),t.volume=Math.min(1,t.volume+.1),L("Volume: ".concat(Math.round(100*t.volume),"%"));break;case"ArrowDown":e.preventDefault(),t.volume=Math.max(0,t.volume-.1),L("Volume: ".concat(Math.round(100*t.volume),"%"));break;case"ArrowLeft":e.preventDefault(),t.currentTime=Math.max(0,t.currentTime-10),L("- 10 seconds");break;case"ArrowRight":e.preventDefault(),t.currentTime=Math.min(t.duration,t.currentTime+10),L("+ 10 seconds")}}function L(e){var t=document.querySelector(".tflix-video-toast");t||((t=document.createElement("div")).className="tflix-video-toast",document.body.appendChild(t)),t.textContent=e,t.classList.add("show"),setTimeout(function(){t.classList.remove("show")},1500)}function k(){window.location.pathname.includes("/movie/")&&document.querySelectorAll('button, a, div[role="button"]').forEach(function(e){var n,r,o,i,a,c;((null===(n=e.textContent)||void 0===n?void 0:n.toLowerCase().includes("play"))||(null===(r=e.textContent)||void 0===r?void 0:r.toLowerCase().includes("watch"))||(null===(o=e.getAttribute("aria-label"))||void 0===o?void 0:o.toLowerCase().includes("play"))||(null===(i=e.getAttribute("aria-label"))||void 0===i?void 0:i.toLowerCase().includes("watch"))||e.classList.contains("play-button")||e.classList.contains("watch-button")||(null===(a=e.id)||void 0===a?void 0:a.toLowerCase().includes("play"))||(null===(c=e.id)||void 0===c?void 0:c.toLowerCase().includes("watch"))||e.querySelector("svg")||e.querySelector('i[class*="play" i]'))&&(e.setAttribute("tabindex","0"),e.setAttribute("data-tflix-play-button","true"),e.classList.add("tflix-play-button"),e.addEventListener("click",function(n){n.preventDefault(),L("Starting playback..."),function(){window.tflixLastMovieUrl=window.location.href;var e=new MutationObserver(function(e){var n,r=t(e);try{for(r.s();!(n=r.n()).done;){var o=n.value;if(o.addedNodes.length){var i,a=t(o.addedNodes);try{var c=function(){var e=i.value;if("VIDEO"===e.nodeName||e.querySelector&&e.querySelector("video")||e.classList&&(e.classList.contains("player")||e.classList.contains("video-player")||e.classList.contains("player-container"))){var t="VIDEO"===e.nodeName?e:e.querySelector("video");t&&(g(t),setTimeout(function(){t.paused&&t.play().catch(function(){L("Press Enter to play")})},1e3))}};for(a.s();!(i=a.n()).done;)c()}catch(e){a.e(e)}finally{a.f()}}}}catch(e){r.e(e)}finally{r.f()}});e.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style","class"]}),setTimeout(function(){e.disconnect()},1e4)}(),setTimeout(function(){if("A"===e.tagName&&e.href)window.location.href=e.href;else{var t=e.onclick;t&&t.call(e)}},50)}),e.addEventListener("focus",function(){e.classList.add("tflix-focused")}),e.addEventListener("blur",function(){e.classList.remove("tflix-focused")}))})}function A(){var e;e=[".movie-card",".content-item",".film-item",".show-card",".grid-item",".card",".poster-container",".thumbnail","a:has(img)"].join(", "),document.querySelectorAll(e).forEach(function(e,t){if(e.getAttribute("tabindex")||e.setAttribute("tabindex","0"),e.setAttribute("data-tflix-item",t),window.location.hostname.includes("cineby.gd")){var n="A"===e.tagName?e:e.querySelector("a");n&&n.href&&n.href.includes("/movie/")?e.addEventListener("click",function(e){e.preventDefault(),L("Loading movie info..."),window.location.href=n.href}):"A"===e.tagName||e.onclick||e.addEventListener("click",function(){var t=e.querySelector("a");t&&t.click()})}else"A"===e.tagName||e.onclick||e.addEventListener("click",function(){var t=e.querySelector("a");t&&t.click()});e.addEventListener("focus",function(){e.classList.add("tflix-focused")}),e.addEventListener("blur",function(){e.classList.remove("tflix-focused")})}),window.location.hostname.includes("cineby.gd")&&k(),document.querySelectorAll(["nav","header nav",".main-nav",".navigation",".menu",".sidebar"].join(", ")).forEach(function(e){e.querySelectorAll("a, button").forEach(function(e,t){e.getAttribute("tabindex")||e.setAttribute("tabindex","0"),e.setAttribute("data-tflix-nav-item",t),e.addEventListener("focus",function(){e.classList.add("tflix-focused")}),e.addEventListener("blur",function(){e.classList.remove("tflix-focused")})})}),document.querySelector("video")&&document.querySelectorAll(".video-controls button, .player-controls button").forEach(function(e,t){e.getAttribute("tabindex")||e.setAttribute("tabindex","0"),e.setAttribute("data-tflix-control",t),e.addEventListener("focus",function(){e.classList.add("tflix-focused")}),e.addEventListener("blur",function(){e.classList.remove("tflix-focused")})}),x(),function(){if(window.location.pathname.includes("/movie/")){var e=document.querySelectorAll("video");if(e.length)e.forEach(g);else{var n=new MutationObserver(function(e){var r,o=t(e);try{for(o.s();!(r=o.n()).done;){var i=r.value;if(i.addedNodes.length){var a,c=t(i.addedNodes);try{for(c.s();!(a=c.n()).done;){var l=a.value;if("VIDEO"===l.nodeName||l.querySelector&&l.querySelector("video"))return g("VIDEO"===l.nodeName?l:l.querySelector("video")),void n.disconnect()}}catch(e){c.e(e)}finally{c.f()}}}}catch(e){o.e(e)}finally{o.f()}});n.observe(document.body,{childList:!0,subtree:!0})}}}(),window.location.hostname.includes("cineby.gd")&&window.location.pathname.includes("/movie/")&&k()}var S=setInterval(function(){"complete"!==document.readyState&&"interactive"!==document.readyState||(A(),new MutationObserver(function(){A()}).observe(document.body,{childList:!0,subtree:!0}),clearInterval(S))},250);function T(){var e,t,n,r;!function(){if(document.querySelectorAll("img:not([loading])").forEach(function(e){if(e.setAttribute("loading","lazy"),e.setAttribute("decoding","async"),!e.hasAttribute("width")&&!e.hasAttribute("height")){var t=window.getComputedStyle(e),n=t.width,r=t.height;n&&"auto"!==n&&r&&"auto"!==r&&(e.setAttribute("width",parseInt(n)),e.setAttribute("height",parseInt(r)))}}),"IntersectionObserver"in window){var e=new IntersectionObserver(function(e,t){e.forEach(function(e){if(e.isIntersecting){var n=e.target;n.dataset.src&&(n.src=n.dataset.src,delete n.dataset.src),t.unobserve(n)}})});document.querySelectorAll("img[data-src]").forEach(function(t){e.observe(t)})}}(),(e=document.createElement("style")).textContent="\n /* Reduce CSS animation complexity */\n * {\n animation-duration: 0.001s !important;\n transition-duration: 0.001s !important;\n }\n \n /* Only keep essential animations */\n .tflix-focused {\n animation-duration: 0.2s !important;\n transition-duration: 0.2s !important;\n }\n \n /* Reduce motion for users who prefer it */\n @media (prefers-reduced-motion: reduce) {\n * {\n animation: none !important;\n transition: none !important;\n }\n }\n ",document.head.appendChild(e),document.querySelectorAll("div, main, section").forEach(function(e){var t=window.getComputedStyle(e),n=t.getPropertyValue("overflow"),r=t.getPropertyValue("overflow-y");"auto"!==n&&"scroll"!==n&&"auto"!==r&&"scroll"!==r||(e.style.willChange="transform",e.style.transform="translate3d(0,0,0)")}),r=EventTarget.prototype.addEventListener,EventTarget.prototype.addEventListener=function(e,o,i){if("scroll"===e){var a=function(e){var n=this;clearTimeout(t),t=setTimeout(function(){o.call(n,e)},100)};return r.call(this,e,a,i)}if("resize"===e){var c=function(e){var t=this;clearTimeout(n),n=setTimeout(function(){o.call(t,e)},100)};return r.call(this,e,c,i)}return r.call(this,e,o,i)},setInterval(function(){for(var e=[],t=0;t<1e3;t++)e.push(new Array(1e4).join("x"));e.length=0},6e4)}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",T):T()}();