// ==UserScript== // @name Yohoho Watch // @namespace https://git.lzrdblzzrd.xyz/lzrdblzzrd/Yohoho-Watch // @author lzrdblzzrd // @description Смотрите фильмы с Kinopoisk.ru на Yohoho бесплатно! // @downloadURL https://git.lzrdblzzrd.xyz/lzrdblzzrd/Yohoho-Watch/raw/branch/master/yohoho-watch.user.js // @updateURL https://git.lzrdblzzrd.xyz/lzrdblzzrd/Yohoho-Watch/raw/branch/master/yohoho-watch.user.js // @icon https://git.lzrdblzzrd.xyz/lzrdblzzrd/Yohoho-Watch/raw/branch/master/yohoho-watch.png // @version 1.2 // @match *://*.kinopoisk.ru/* // ==/UserScript== const BANNER_IMAGE = ` `; const BANNER_ID = 'yohoho-watch'; const MOVIE_TYPES = ['film', 'series']; let currentMovieId = null; let lastUrl = '/'; function openPlayer() { if (!currentMovieId) return; const link = new URL('https://4h0y.gitlab.io/'); link.hash = currentMovieId; window.open(link.toString(), '_blank').focus(); } function mountBanner() { const banner = document.createElement('div'); banner.id = BANNER_ID; banner.innerHTML = BANNER_IMAGE; banner.style.width = '32px'; banner.style.height = '128px'; banner.style.top = '-128px'; banner.style.left = '8px'; banner.style.outline = 'none'; banner.style.cursor = 'pointer'; banner.style.position = 'fixed'; banner.style.zIndex = '9000'; banner.style.transition = 'top 0.2s ease'; banner.title = 'Смотреть на Yohoho' banner.addEventListener('click', () => openPlayer()); banner.addEventListener('mouseover', () => { banner.style.top = '-24px' }); banner.addEventListener('mouseout', () => { banner.style.top = '-32px' }); setTimeout(() => { banner.style.top = '-32px' }, 1000); document.body.appendChild(banner); } function unmountBanner() { const banner = document.getElementById(BANNER_ID); if (banner) banner.remove(); } function updateBanner() { const url = location.href; if (url === lastUrl) return; lastUrl = url; const banner = document.getElementById(BANNER_ID); const urlData = url.split('/'); const movieId = urlData[4]; const movieType = urlData[3]; if (!movieId || !movieType || !MOVIE_TYPES.includes(movieType)) { if (banner) unmountBanner(); currentMovieId = null; } else { if (!banner) mountBanner(); currentMovieId = movieId; } } function init() { const observer = new MutationObserver(() => updateBanner()); observer.observe(document, { subtree: true, childList: true }); updateBanner(); console.log('Yohoho Watch started! 🎥'); } init();