s.to - Minified for Laptop

Minimize page elements to fit smaller screens and added some QoL.

目前为 2022-08-01 提交的版本。查看 最新版本

// ==UserScript==
// @name         s.to - Minified for Laptop
// @namespace    https://greasyfork.org/users/928242
// @version      0.6
// @description  Minimize page elements to fit smaller screens and added some QoL.
// @author       Kamikaze (https://github.com/Kamiikaze)
// @iconURL      https://s.to/favicon.ico
// @match        https://s.to/serie/stream/*
// @match        https://serien.sx/serie/stream/*
// @match        https://anicloud.io/anime/stream/*
// @match        https://aniworld.to/anime/stream/*
// @grant        none
// @license      MIT
// ==/UserScript==

function addGlobalStyle(css) {
    var head, style;
    head = document.getElementsByTagName('head')[0];
    if (!head) { return; }
    style = document.createElement('style');
    style.type = 'text/css';
    style.innerHTML = css.replace(/;/g, ' !important;');
    head.appendChild(style);
}

// FIX: Force closing Dropdown Menu on MouseLeave
function closeMenuOnHoverLeave() {
    const menu = document.querySelector(".dd")
    const modal = document.querySelector(".modal")

    menu.addEventListener('mouseleave', () => {
        modal.style = "display:none"
    })
}

// Sticky-Top Episode List
// addGlobalStyle('div#stream > ul:nth-of-type(2) { position: fixed; top: 0; width: 100%; z-index: 99; }');

addGlobalStyle(`

/* Reduce Height of Video player */
.inSiteWebStream, .inSiteWebStream iframe {
    height: 150px;
}

.hosterSiteTitle {
    padding: 5px 0 10px;
}

/* Hiding unnecessary page elements (Editing Descripting, Language Box..) and already seen episodes  */
.descriptionSpoilerLink, .descriptionSpoilerPlaceholder,
.submitNewDescription, .hosterSectionTitle, .changeLanguageBox,
.hosterSiteDirectNav ul li .seen {
    display: none;
}

/* Hiding content box of more episodes from the same series */
#wrapper > div.seriesContentBox > div.container.marginBottom > div:nth-child(4) > div:nth-child(13) {
    display: none;

`);

closeMenuOnHoverLeave()