// ==UserScript== // @name Advanced Streaming | aniworld.to & s.to // @name:de Erweitertes Streaming | aniworld.to & s.to // @namespace https://greasyfork.org/users/928242 // @version 3.3.7 // @description Minimizing page elements to fit smaller screens and adding some usability improvements. // @description:de Minimierung der Seitenelemente zur Anpassung an kleinere Bildschirme und Verbesserung der Benutzerfreundlichkeit. // @author Kamikaze (https://github.com/Kamiikaze) // @supportURL https://github.com/Kamiikaze/Tampermonkey/issues // @iconURL https://s.to/favicon.ico // @match https://s.to/serie/stream/* // @match https://s.to/serienkalender* // @match https://s.to/serien* // @match https://s.to/account/subscribed // @match https://aniworld.to/anime/stream/* // @match https://aniworld.to/animekalender* // @match https://aniworld.to/animes* // @match https://aniworld.to/account/subscribed // @require https://greasyfork.org/scripts/455253-kamikaze-script-utils/code/Kamikaze'%20Script%20Utils.js // @grant none // @license MIT // @downloadURL none // ==/UserScript== // # # # # # # // CONFIG // You can disable features by replacing the value true with false. // # # # # # # // Enables shorter Window Tab Title // Example: S3E8 - Black Clover | AniWorld.to const enableShortWindowTitle = true // Hides the section of Season Suggestions below the video const enableHideSeasonSuggestions = true // Closing the dropdown menu when mouse leaves (fix the perma-open menu) const enableCloseMenuOnHoverLeave = true // Adding a Link below "Watch Trailer" to search for it on YT (Because sometimes there is a Homepage linked to the Anime) const enableAddTrailerSearchLink = true // Adding a small box at bottom left to search the Anime on sites like MyAnimeList, Crunchyroll & more const enableAddAnimeSearchBox = true // Enable/Disable search providers by changing the value either to true or false // If you want to add your own provider let me know const animeSearchProviderList = { 'Crunchyroll': false, 'aniSearch': false, 'AnimePlanet': false, 'MyAnimeList': true, 'AmazonVideo': true, } // Adding a small box at bottom left to search the Series on sites like Amazon, Netflix & more const enableAddSeriesSearchBox = true // Enable/Disable search providers by changing the value either to true or false // If you want to add your own provider let me know const seriesSearchProviderList = { 'AmazonVideo': true, 'Netflix': true, } // Adding a small button at the right corner of the video frame to get to the next episode const enableEpisodeNavButtons = true // Allows filtering the Series Calendar by subscribed series // To use this feature you need to go to https://s.to/account/subscribed and wait for the script to save the // subscribed series. After that you can go to https://s.to/serienkalender and use the filter. const enableFilterSeriesCalendar = true // Adds a link to search series in the release calendar const enableAddCalendarSearch = true // Enable improved Search Box // When pressing a key, search box will be automatically focused. Clicking the search box will select all input. // By clicking outside the search box and pressing a key, the search box will be focused and cleared for new input. const enableImprovedSearchBox = true // # # # # # # // Styling // Some adjustments to layout. // You can disable features by replacing the value true with false. // # # # # # # // Set the height of the video player. (in pixel) // Set to 0 to disabled it. Default: 480 const reducePlayerHeight = 150 // Hides the text to show/edit the description of the episode below episode title const hideDescriptionEdit = true // Hides the language box above the video player const hideLanguageBox = true // Hides seen episodes (marked green) from the Episode-List (You can still see them in the season overview const hideSeenEpisodes = true // Use Scrollbar for Episode-List (good for seasons with a large amount of episodes) const useScrollbarForEpisodeList = true /*** DO NOT CHANGE BELOW ***/ /* global Logger getStreamData waitForElm addGlobalStyle searchSeries */ const log = new Logger( "Advanced Streaming" ); let streamData = null; ( async () => { if ( enableFilterSeriesCalendar ) filterSeriesCalendar() if ( enableImprovedSearchBox ) improvedSearchBox() streamData = await getStreamData() // Features if ( enableShortWindowTitle ) shortWindowTitle() if ( enableHideSeasonSuggestions ) hideSeasonSuggestions() if ( enableCloseMenuOnHoverLeave ) closeMenuOnHoverLeave() if ( enableAddTrailerSearchLink ) addTrailerSearchLink() if ( enableAddAnimeSearchBox ) addAnimeSearchBox() if ( enableAddSeriesSearchBox ) addSeriesSearchBox() if ( enableEpisodeNavButtons ) addEpisodeNavButtons() if ( enableAddCalendarSearch ) addCalendarSearch() fixAnimeTrailerWatchButton() // Styles if ( reducePlayerHeight > 0 ) { addGlobalStyle( ` .inSiteWebStream, .inSiteWebStream iframe {height: ${ reducePlayerHeight }px; } .hosterSiteTitle {padding: 5px 0 10px;} ` ) } if ( hideDescriptionEdit ) { addGlobalStyle( ` .descriptionSpoilerLink, .descriptionSpoilerPlaceholder, .submitNewDescription, .submitNewTitle, .hosterSectionTitle { display: none; } ` ) } if ( hideLanguageBox ) { addGlobalStyle( ` .changeLanguageBox { display: none; } ` ) } if ( hideSeenEpisodes ) { if ( streamData.currentEpisode === 0 ) return addGlobalStyle( ` #stream > ul:nth-child(4) li .seen { display: none; } ` ) } if ( useScrollbarForEpisodeList ) { addGlobalStyle( ` #stream > ul:nth-child(4) { overflow-x: auto; display: flex; flex-direction: row; justify-content: flex-start; flex-wrap: nowrap; align-items: center; } #stream > ul:nth-child(4) li:nth-child(1) { position: absolute; } #stream > ul:nth-child(4) > li:nth-child(2) { margin-left: 119px; } /* ===== Scrollbar CSS ===== */ /* Firefox */ * { scrollbar-height: auto; scrollbar-color: #637cf9 #243743; } /* Chrome, Edge, and Safari */ #stream > ul:nth-child(4)::-webkit-scrollbar { height: 10px; } #stream > ul:nth-child(4)::-webkit-scrollbar-track { background: #243743; } #stream > ul:nth-child(4)::-webkit-scrollbar-thumb { background-color: #637cf9; border-radius: 10px; border: 1px solid #ffffff; } ` ) } } )(); function shortWindowTitle() { let pageTitle = "" if ( streamData.currentSeason > 0 ) pageTitle += "S" + streamData.currentSeason if ( streamData.currentEpisode > 0 ) pageTitle += "E" + streamData.currentEpisode window.document.title = `${ ( pageTitle.length > 1 ) ? pageTitle + " - " : "" }${ streamData.title } | ${ streamData.host }` } async function hideSeasonSuggestions() { const container = await waitForElm( ".ContentContainerBox" ) if ( !container ) return container.style = "display: none;" log.info( "Season suggestions hidden" ) } async function closeMenuOnHoverLeave() { const menu = await waitForElm( ".dd" ) const modal = await waitForElm( ".modal" ) menu.addEventListener( 'mouseleave', () => { modal.style = "display:none" } ) } async function addTrailerSearchLink() { const seriesTitle = streamData.title const trailerBoxEl = await waitForElm( ".add-series .collections" ) const ytSearchLink = "https://www.youtube.com/results?search_query=" const searchTrailerEl = document.createElement( "li" ) searchTrailerEl.classList.add( 'col-md-12', 'col-sm-12', 'col-xs-6', 'buttonAction' ); searchTrailerEl.innerHTML = `
` increaseHeaderSize() addLinkToList( trailerBoxEl, searchTrailerEl ) } async function addCalendarSearch() { const seriesTitle = streamData.title const trailerBoxEl = await waitForElm( ".add-series .collections" ) const calendarUrl = (() => { if ( getStreamPageLocation().host === "s.to" ) { return "https://s.to/serienkalender?q=" + seriesTitle } else if ( getStreamPageLocation().host === "aniworld.to" ) { return "https://aniworld.to/animekalender?q=" + seriesTitle } else { log.error( "Host not supported" ) } })(); const searchCalendarEl = document.createElement( "li" ) searchCalendarEl.classList.add( 'col-md-12', 'col-sm-12', 'col-xs-6', 'buttonAction' ); searchCalendarEl.innerHTML = ` ` increaseHeaderSize() addLinkToList( trailerBoxEl, searchCalendarEl ) } async function fixAnimeTrailerWatchButton() { const seriesTitle = streamData.title const watchButton = await waitForElm( ".trailerButton" ) watchButton.style.display = "none" if ( !watchButton ) return const trailerBoxEl = await waitForElm( ".add-series .collections" ) const watchTrailerPlaceholder = trailerBoxEl.querySelector( `li:nth-child(3)` ); watchTrailerPlaceholder.removeChild( watchTrailerPlaceholder.children[0] ) const watchTrailerEl = document.createElement( "div" ) watchTrailerEl.innerHTML = ` ` watchTrailerPlaceholder.append( watchTrailerEl) } function addLinkToList( parent, el ) { const beforeElement = parent.querySelector( `li:nth-child(${ parent.childElementCount })` ); parent.insertBefore( el, beforeElement ) } async function increaseHeaderSize() { /** * @type {HTMLElement} */ const header = await waitForElm( "section.title" ) const headerHeight = header.offsetHeight if ( headerHeight === 0) { log.debug("Header is not visible. Waiting for header to be visible") const observer = new MutationObserver( () => { if ( header.offsetHeight > 0 ) { log.info("Header is visible. Increasing Header height") setTimeout( () => { increaseHeaderSize() }, 500 ) observer.disconnect() } }) observer.observe( header, { attributes: true, attributeFilter: ['style'] } ) return } addGlobalStyle( ` section.title, section.title .backdrop { height: ${ headerHeight + 20 }px; }`, true ) } async function addAnimeSearchBox() { if ( window.location.hostname !== 'aniworld.to' ) return const rightColEl = await waitForElm( ".add-series" ) const seriesTitel = streamData.title const searchBoxEl = document.createElement( 'div' ) searchBoxEl.classList.add( 'anime-search' ) const searchBoxTitel = document.createElement( 'p' ) searchBoxTitel.innerText = "Anime suchen auf:" rightColEl.append( searchBoxEl ) searchBoxEl.append( searchBoxTitel ) const sites = [ { domain: "crunchyroll.com", searchUrl: "https://www.crunchyroll.com/de/search?q=#TITEL#", name: "Crunchyroll" }, { domain: "anisearch.de", searchUrl: "https://www.anisearch.de/anime/index?text=#TITEL#", name: "aniSearch" }, { domain: "anime-planet.com", searchUrl: "https://www.anime-planet.com/anime/all?name=#TITEL#", name: "AnimePlanet" }, { domain: "myanimelist.net", searchUrl: "https://myanimelist.net/anime.php?q=#TITEL#&cat=anime", name: "MyAnimeList" }, { domain: "amazon.de", searchUrl: "https://www.amazon.de/s?k=#TITEL#&i=instant-video", name: "AmazonVideo" }, ] for ( let i = 0; i < sites.length; i++ ) { const site = sites[i] if ( animeSearchProviderList[site.name] ) { const siteElement = document.createElement( 'a' ); siteElement.classList.add( "sites" ) siteElement.target = "_blank" siteElement.href = site.searchUrl.replace( "#TITEL#", seriesTitel ) siteElement.innerHTML = `