HDrezka Cleanup

Cleanup HDrezka: change content width, change player size, remove blocks (telegram, social, support, vk, etc), restyle blocks (cover, status, rating, etc)

当前为 2022-06-11 提交的版本,查看 最新版本

// ==UserScript==
// @name            HDrezka Cleanup
// @name:en         HDrezka Cleanup
// @namespace       http://tampermonkey.net/
// @version         0.20
// @description     Cleanup HDrezka: change content width, change player size, remove blocks (telegram, social, support, vk, etc), restyle blocks (cover, status, rating, etc)
// @description:en  Cleanup HDrezka: change content width, change player size, remove blocks (telegram, social, support, vk, etc), restyle blocks (cover, status, rating, etc)
// @author          rub4ek
// @match           https://hdrezka.me/*
// @match           https://hdrezka.ag/*
// @match           https://rezka.ag/*
// @match           https://rezkify.com/*
// @match           https://kinopub.me/*
// @match           http://hdrezka.co/*
// @icon            https://www.google.com/s2/favicons?domain=rezka.ag
// @grant           GM_addStyle
// @run-at          document-start
// @license         MIT
// ==/UserScript==


(function() {
    'use strict';

    const arrowImageURL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFoAAABaCAYAAAA4qEECAAAABmJLR0QA/wD/AP+gvaeTAAABa0lEQVR4nO3awUrDQBSF4dMuGhc+uF0puK/v4KL4RPoARbLUxTRQi5nMJDPJvcn/gRsp5NyfWgSVAAAAAAAAAAAAAAAAAACYXSPpKOlL0qekp+v3UNBB0rukn7uvD0kPC+5alb7IxC5oKDKxC0iNTOwJciMTe4SxkYmdoZF0VjzkOfE1/OrXI+Wd3L1bc16LG2PCETvTlGDETlQiFLEHlAxE7B41whD7Ts0gxL6aI8TmY88ZYLOxlzh8c7GXPHgzsS0camFDVZYOtLSlKIuHWdw0ieWDLG/L4uEQDxujPB3gaesfHoe72+xu8A03290MjTB/g/mBGczeYnbYBOZuSv2XAI9/7jd126uVIZWkxH6pPWIv6TsywHvkzlDsi6RdzQF7SW3Pw9cSuROL3Sq0qOrtnwevLXKnL/Zpjoc/KsRuFX6EnrXOyJ1G4TP5onDzSaHBbKp+Rhm00/ZuBgAAAAAAAAAAAAAAAODKL8SQFSF3JeZKAAAAAElFTkSuQmCC"

    function addStyle () {
        GM_addStyle(`
        /* Remove extra right padding for content page */
        .b-content__columns {
            padding-right: 0;
        }

        /* Remove extra right padding on main content listing */
        .b-content__inline_inner_mainprobar {
            padding-right: 0;
        }
        .b-content__inline_inner_mainprobar .b-content__inline_item {
            margin-left: 16px !important;
        }

        /* Style for content item */
        .b-content__inline_item  .b-content__inline_item-cover {
            border-color: transparent !important;
        }
        .b-content__inline_item .b-content__inline_item-cover .info {
            font-weight: normal;
        }
        .b-content__inline_item .b-content__inline_item-link{
            font-weight: normal;
        }

        /* Style status */
        .b-post__status_wrapper {
            width: auto;
            margin: 10px 10px 12px 13px;
        }

        /* Style and resize rating block */
        .b-post__rating_table > tbody > tr > td.label{
            display: none !important;
        }
        .b-post__rating_table > tbody > tr > td div.b-post__rating {
            float:right;
            margin-right: 10px;
        }

        /* Remove telegram info block */
        .tg__info_block_wrapper {
            display: none !important;
        }

        /* Remove last episode info */
        .b-post__lastepisodeout {
            display: none !important;
        }

        /* Remove support block */
        .b-post__support_holder {
            display: none !important;
        }

        /* Remove social block */
        .b-post__social_holder_wrapper .append {
            display: none !important;
        }
        .b-post__social_holder_wrapper .share-label {
            display: none !important;
        }

        /* Remove mixedtext */
        .b-post__mixedtext {
            text-indent: -9999px;
            padding: 0;
        }

        /* Remove VK */
        #vk_groups {
            display: none !important;
        }

        /* Remove some ads containers */
        .b-content__main > .b-post__mixedtext + div[style],
        .b-content__main > .b-post__rating_table + div[style],
        .b-content__main > div > .b-player > .b-player__network_issues_holder + div[style],
        .b-content__main > div > .b-player > a[target='_blank'],
        .b-content__main + div,
        .b-wrapper .nopadd,
        .b-seriesupdate__block_list > .b-seriesupdate__block_list_item[data-url=''] {
            display: none !important;
        }
        `);
        console.log(`HDrezka Cleanup: styles changed`);
    }

    function resizePlayer() {
        var playerHolderElem,
            contentMainElem,
            playerContainerElem,
            initialWidth, initialHeight,
            resizedWidth, resizedHeight,
            ratio, windowHeight;

        playerHolderElem = document.querySelector(".b-player__holder_cdn");

        if (playerHolderElem !== null) {
            contentMainElem = document.querySelector(".b-content__main");
            playerContainerElem = document.querySelector(".b-player__container_cdn");
            initialWidth = playerHolderElem.offsetWidth;
            initialHeight = playerHolderElem.offsetHeight;
            resizedWidth = contentMainElem.offsetWidth;
            windowHeight = window.innerHeight;

            if (initialHeight > 0 && initialWidth !== resizedWidth) {
                ratio = initialWidth / initialHeight;
                resizedHeight = resizedWidth / ratio;
                if (resizedHeight > windowHeight) {
                    resizedHeight = windowHeight;
                    resizedWidth = windowHeight * ratio;
                }
                playerHolderElem.style.width = resizedWidth + "px";
                playerHolderElem.style.height = resizedHeight + "px";
                playerContainerElem.style.width = resizedWidth + "px";
                playerContainerElem.style.height = resizedHeight + "px";
                console.log(
                    `HDrezka Cleanup: player resized ` +
                    `from ${initialWidth}x${initialHeight} ` +
                    `to ${resizedWidth}x${resizedHeight}.`
                )
            }
        }
    }

    function initContentSizeTumbler() {
        GM_addStyle(`

        /* Content Size Tumbler */

        .hdrezka-cleanup-content-size-tumbler-wrapper {
            margin-top: 5px;
            margin-left: 10px;
            width: 38px;
            height: 30px;
            background-color: #000;
            border: #1d92b2;
            border-radius: 30px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0 6px;
            cursor: pointer;
            display: flex;
            position: relative;
        }
        .hdrezka-cleanup-content-size-tumbler-wrapper:before {
            background-size: 15px 15px;
            background-repeat: no-repeat;
            left: 6px;
        }
        .hdrezka-cleanup-content-size-tumbler-wrapper:after {
            background-size: 15px 15px;
            background-repeat: no-repeat;
            right: 6px;
        }
        .hdrezka-cleanup-content-size-tumbler-wrapper:before,
        .hdrezka-cleanup-content-size-tumbler-wrapper:after {
            content: "";
            display: block;
            top: 50%;
            margin-top: -7px;
            height: 15px;
            width: 15px;
            position: absolute;
        }
        .hdrezka-cleanup-content-size-tumbler-wrapper:before {
            background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFsAAABbCAYAAAAcN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gltZhNozmq1e1OZidCCFkmnJ+bBWvtAuKniepVQbrYKm/1Ipz/8D8BVx8nd0mG5UrNV2+yHLsuVmK3TZj90WB662VGx2Q+VlodmdhRt9kOV5aGYHXWb/Qjbcqlmx8lmP8K0XJrZcbXZjzAsl2H2PwQaTWU+viWhVqSQbXldZhNozm61+xoxaBFZltdqdsPa7IcMywOb3Sw2+1GP5UHMbjqb/ajV8qrMbnab/QhquQ0wDhxbXnjI3+D8aqpz/La8FhuLZ5YXcj+A6AaArspnMs44K6341JlhdktvunPCBF0F6c6J28xu6QUwU+k4Z6UVVl5XfV3Yvw5Ow+nM+JUore6NA8nktWI6M34FnIYBrAuHvu7oyN5/ttq0WMz2wLV6tp4kfo7qiwKivpxaZG1tuv1M2/YbsEsPU6nsQyBmr9eMU9iViMjsenNgwlaICVshJmyFmLAVYsJWiAlbISZshZiwFWLCVogJWyEmbIXELeyjA1G+sx5RJG5h//H/TfpdTxu1EauwifgYgO3y5jZAYzr7CUpsxoIPWVhY6LTttguu++TBwMBAQXc/BoPBYDAYDPHhKftNM5gIJizIAAAAAElFTkSuQmCC");
        }
        .hdrezka-cleanup-content-size-tumbler-wrapper:after {
            background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFsAAABbCAYAAAAcNvmZAAAABmJLR0QA/wD/AP+gvaeTAAAGHElEQVR4nO3db2wTdRgH8O9zLetk8c80JAhO/mxFGGPAIqhTgaDGiOBGYbw0ITHMN5AwBNbypmC6dhAjIfHF4AUqr9StHYYgDOMwCgOjUcqAZW0nGvUFmI1htrXb9R5fuGJXOtZ294eW3+fdXdu7J999d1mvdx0gCIIgCIIgCIKQxcjoAdLR1dX18PDwyAGAVgJ0zWym7aWlpb8ZPVeqzEYPkI5IJLqfiGr/W+L5ssxPAVhu6FBpkIweIB1E/FrCqmV+v7/QkGEykFVhA3gocYUs59217n6VbWFnNRG2jkTYOhJh60iErSMRto5E2DoSYetIhK0jEbaORNg60vWs36GTAcvgEHYwSa8DfF1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mJD02jyetj8ViLWdJeREPbstjbV5lrypJ671JRp+uO6rnXYz0myrAvBfASCbbyEYMPkMyLUinzfEyvm7EuXlOGIDT5etuNbHpKIOXZLqtLHAbhJ326pIjRMSZbmTSV0TtWT/vl8KbfcsBqkdOtpzaSKZF9vUlhycTNKDStX61tc+OAGj0eHtOMSlHwViqxnYNdhuEnfXVcyfV5niqXsVab5t76fEbt54bbfmwmtvWExNORyWUqdHmeKpfnx1ruau55yuTpBxloELtfWioH4Rd9upi1docT7M7D/ZsnOsvvHnr+Sxq+amoBFWOzePR9OahWMvdzYE2SPQxgPLE5yjgG1rOkOAmgGkJ6/oY2O6wlXyi9c51uVvMvtH6c0SOLGPwPoz9i+Wsvcr6gx4zjDowdpFPSCa5TI+gAQO+aq7xeM8ziqyshUTXCyzKiW1rrJFUX+v3d/4JYEb8Olk2z6yomP9XqtvwtAYrOYoXIPFl+3prWxqjT1pWfa+fGmEbSdxOrSMRto5E2DoSYetIhK0jEbaORNg6EmHrSIStIxG2jkTYOsq2sP9OWJbD4d60bmk2UraFfXjsIn1aWVk5ZMwo6cuqfzBRXl72kd9/9Vfm6GoiqbOr68oxo2cSBEEQBEEQBEEQBCGr/Qu6xkCFND8EBQAAAABJRU5ErkJggg==");
        }
        .hdrezka-cleanup-content-size-tumbler-wrapper .hdrezka-cleanup-content-size-tumbler {
            position: absolute;
            height: 20px;
            width: 20px;
            border-radius: 50%;
            background-color: #fff;
            transition: transform .5s,background-color .5s;
            will-change: transform;
            z-index: 2;
        }
        .hdrezka-cleanup-content-size-full .hdrezka-cleanup-content-size-tumbler-wrapper .hdrezka-cleanup-content-size-tumbler {
            transform: translateX(calc(100% - 2px));
        }

        /* Content Size Tumbler (size changes) */

        .hdrezka-cleanup-content-size-wide .b-wrapper {
            width: 1150px;
        }
        .hdrezka-cleanup-content-size-ultrawide .b-wrapper {
            width: 1340px;
        }
        .hdrezka-cleanup-content-size-full .b-wrapper {
            width: auto;
            margin: 0 30px;
        }
        .hdrezka-cleanup-content-size-full .glory {
            width: auto;
        }
        .hdrezka-cleanup-content-size-full .b-newest_slider {
            width: auto;
            padding: 20px 35px 0;
        }
        .hdrezka-cleanup-content-size-full .b-newest_slider .b-newest_slider__list {
            margin-left: 0 !important;
        }
        .hdrezka-cleanup-content-size-full .b-newest_slider .cntrl {
            display: none;
        }

        /* Content Size Tumbler (night theme) */

        .b-theme__template__night .hdrezka-cleanup-content-size-tumbler-wrapper {
            background: #222d33;
        }
        `);

        const topHeadLeftElem = document.querySelector(".b-tophead-left");

        if (topHeadLeftElem !== null) {
            const tumblerElem = document.createElement("div");
            tumblerElem.classList.add("hdrezka-cleanup-content-size-tumbler");
            const tumblerWrapperElem = document.createElement("div");
            tumblerWrapperElem.classList.add("hdrezka-cleanup-content-size-tumbler-wrapper");
            tumblerWrapperElem.appendChild(tumblerElem);
            tumblerWrapperElem.addEventListener("click", switchContentSize);
            const tumblerContainerElem = document.createElement("div");
            tumblerContainerElem.classList.add("pull-left");
            tumblerContainerElem.appendChild(tumblerWrapperElem);
            topHeadLeftElem.appendChild(tumblerContainerElem);
            initContentSize();
        }

        function getContentSize() {
            return localStorage.getItem("hdrezka-cleanup-content-size");
        }

        function setContentSize(value) {
            return localStorage.setItem("hdrezka-cleanup-content-size", value);
        }

        function switchContentSize() {
            const contentSize = getContentSize();
            if (contentSize == "full") {
                setContentSize("normal");
            } else if (contentSize == "normal") {
                setContentSize("wide");
            } else if (contentSize == "wide") {
                setContentSize("ultrawide");
            } else {
                setContentSize("full");
            }
            initContentSize();
        }

        function initContentSize() {
            const bodyElem = document.querySelector("body");
            bodyElem.classList.remove("hdrezka-cleanup-content-size-wide")
            bodyElem.classList.remove("hdrezka-cleanup-content-size-ultrawide")
            bodyElem.classList.remove("hdrezka-cleanup-content-size-full")
            window.removeEventListener("resize", resizePlayer);

            if (getContentSize() == "wide") {
                bodyElem.classList.add("hdrezka-cleanup-content-size-wide")
            } else if (getContentSize() == "ultrawide") {
                bodyElem.classList.add("hdrezka-cleanup-content-size-ultrawide")
            } else if (getContentSize() == "full") {
                bodyElem.classList.add("hdrezka-cleanup-content-size-full")
                window.addEventListener("resize", resizePlayer);
            }
            resizePlayer();
        }
    }

    function initHideInfoButton() {
        GM_addStyle(`

        /* Content hide info (button) */

        .hdrezka-cleanup-hide-info-button {
            content: "";
            width: 25px;
            height: 25px;
            margin-right: 5px;
            background-size: 25px 25px;
            background-repeat: no-repeat;
            background-image: url(${arrowImageURL});
            cursor: pointer;
        }
        .hdrezka-cleanup-hide-info .hdrezka-cleanup-hide-info-button {
            transform: rotate(180deg);
        }

        /* Content hide info (hidden styles) */

        .hdrezka-cleanup-hide-info .b-post__infotable,
        .hdrezka-cleanup-hide-info .b-post__description {
            display: none !important;
        }

        /* Content hide info (night theme) */

        .b-theme__template__night .hdrezka-cleanup-hide-info-button {
            filter: invert(100%) sepia(95%) saturate(21%) hue-rotate(280deg) brightness(106%) contrast(106%);
        }
        `);

        const postTitleElem = document.querySelector(".b-post__title");

        if (postTitleElem !== null) {
            const buttonElem = document.createElement("div");
            buttonElem.classList.add("pull-right");
            buttonElem.classList.add("hdrezka-cleanup-hide-info-button");
            buttonElem.addEventListener("click", switchHideInfo);
            postTitleElem.insertBefore(buttonElem, postTitleElem.firstChild);
            initHideInfo();
        }

        function initHideInfo() {
            if (isHideInfoEnabled()) {
                document.querySelector("body").classList.add("hdrezka-cleanup-hide-info");
            } else {
                document.querySelector("body").classList.remove("hdrezka-cleanup-hide-info");
            }
        }

        function isHideInfoEnabled() {
            return localStorage.getItem("hdrezka-cleanup-hide-info") == "true";
        }

        function switchHideInfo() {
            localStorage.setItem("hdrezka-cleanup-hide-info", !isHideInfoEnabled());
            initHideInfo();
        }
    }

    function initHideTranslatorsButton() {
        GM_addStyle(`

        /* Content hide translators */

        .b-translator__item.active {
            cursor: pointer;
        }
        .hdrezka-cleanup-hide-translators-button {
            content: "";
            float: left;
            width: 20px;
            height: 20px;
            margin-right: 3px;
            margin-top: 8px;
            margin-left: 5px;
            background-size: 20px 20px;
            background-repeat: no-repeat;
            background-image: url(${arrowImageURL});
            filter: invert(100%) sepia(95%) saturate(21%) hue-rotate(280deg) brightness(106%) contrast(106%);
            transform: rotate(-90deg);
            cursor: pointer;
        }
        .hdrezka-cleanup-hide-translators .hdrezka-cleanup-hide-translators-button {
            transform: rotate(90deg);
        }
        .hdrezka-cleanup-hide-translators .b-translator__item:not(.active):not(.hdrezka-cleanup-hide-translators-button) {
            display: none;
        }
        .hdrezka-cleanup-hide-translators .b-translators__title {
            display: none;
        }
        `);

        const translatorsElem = document.querySelector(".b-translators__block");

        if (translatorsElem) {
            const translatorsListElem = translatorsElem.querySelector(".b-translators__list");
            if (translatorsListElem) {
                const buttonElem = document.createElement("li");
                buttonElem.classList.add("hdrezka-cleanup-hide-translators-button");
                buttonElem.addEventListener("click", switchHideTranslators);
                translatorsListElem.appendChild(buttonElem);
                const activeButtonElem = translatorsListElem.querySelector(".b-translator__item.active");
                if (activeButtonElem) {
                    activeButtonElem.addEventListener("click", switchHideTranslators);
                }
                switchHideTranslators();
            }
        }

        function switchHideTranslators() {
            translatorsElem.classList.toggle("hdrezka-cleanup-hide-translators");
        }
    }

    function onDocumentStart() {
        addStyle();
    }

    function onDocumentEnd() {
        initContentSizeTumbler();
        initHideInfoButton();
        initHideTranslatorsButton();
    }

    document.addEventListener("DOMContentLoaded", onDocumentEnd);

    onDocumentStart();

})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址