// ==UserScript== // @name Host selecter // @namespace http://tampermonkey.net/ // @version 0.3 // @description Enhanced GUI for aniworld.to and s.to websites, allowing you to effortlessly choose your preferred video host and have it automatically opened. A convenient green button positioned at the bottom right corner of the page will appear, prompting you to click and select your desired host from a user-friendly drop-down menu. Enjoy seamless video streaming with the host of your choice! // @author Budumz // @license MIT // @match https://aniworld.to/* // @match https://s.to/serie/stream/* // @grant GM_addStyle // @downloadURL none // ==/UserScript== (function () { 'use strict'; // Function to create and show the GUI pop-up function createGUI() { const popupDiv = document.createElement('div'); popupDiv.innerHTML = `

Hoster Selection


Preferred Hoster


`; document.body.appendChild(popupDiv); // Check if there's a previously selected hoster in localStorage and pre-select it const storedHoster = localStorage.getItem('selectedHoster'); const hosterSelect = document.getElementById('hosterSelect'); if (storedHoster && Array.from(hosterSelect.options).some(option => option.value === storedHoster)) { hosterSelect.value = storedHoster; } // Check if there's a previously selected preferred hoster in localStorage and pre-select it const storedPreferredHoster = localStorage.getItem('preferredHoster'); const preferredHosterSelect = document.getElementById('preferredHoster'); if (storedPreferredHoster && Array.from(preferredHosterSelect.options).some(option => option.value === storedPreferredHoster)) { preferredHosterSelect.value = storedPreferredHoster; } // Set up event listener for the submit button const submitButton = document.getElementById('submitButton'); submitButton.addEventListener('click', () => { const selectedHoster = hosterSelect.value; const preferredHoster = preferredHosterSelect.value; // Save the selected hoster and preferred hoster in localStorage localStorage.setItem('selectedHoster', selectedHoster); localStorage.setItem('preferredHoster', preferredHoster); // Find the corresponding hoster link and emulate a click for the preferred hoster const hosterLinks = document.querySelectorAll('a.watchEpisode'); for (const link of hosterLinks) { const hosterName = link.querySelector('h4').innerText; if (hosterName === preferredHoster) { link.querySelector('.hosterSiteVideoButton').click(); break; } } // Close the GUI pop-up after selecting and clicking the hoster document.body.removeChild(popupDiv); }); // Set up event listener for the close button const closeButton = document.getElementById('closeButton'); closeButton.addEventListener('click', () => { // Close the GUI pop-up without taking any action document.body.removeChild(popupDiv); }); } // Add a button to the page function addGUIButton() { const button = document.createElement('button'); button.innerText = 'Open GUI'; button.style.position = 'fixed'; button.style.bottom = '20px'; button.style.right = '20px'; button.addEventListener('click', createGUI); document.body.appendChild(button); } // Add the CSS styles GM_addStyle(` button { padding: 10px 20px; background-color: #4CAF50; color: white; border: none; cursor: pointer; border-radius: 4px; } `); // Add the GUI button to the page addGUIButton(); // Auto-select preferred hoster if available const storedPreferredHoster = localStorage.getItem('preferredHoster'); if (storedPreferredHoster) { const hosterLinks = document.querySelectorAll('a.watchEpisode'); for (const link of hosterLinks) { const hosterName = link.querySelector('h4').innerText; if (hosterName === storedPreferredHoster) { link.querySelector('.hosterSiteVideoButton').click(); break; } } } })();