// ==UserScript== // @name HDrezka Cleanup // @name:en HDrezka Cleanup // @namespace http://tampermonkey.net/ // @version 0.15 // @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://rezka.ag/* // @match https://hdrezka.me/* // @match https://rezkify.com/* // @match https://kinopub.me/* // @grant GM_addStyle // @run-at document-start // @license MIT // @downloadURL none // ==/UserScript== (function() { 'use strict'; 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; } /* Add player margin */ .b-player { margin-bottom: 20px; } /* 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 { display: none !important; } /* Remove mixedtext */ .b-post__mixedtext { display: none !important; } /* 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-seriesupdate__block_list > .b-seriesupdate__block_list_item[data-url=''] { display: none !important; } /* Full width button */ .hdrc-full-width { width: auto; margin: 0 30px; } .hdrc-full-width-button { margin: 0 10px; color: #777; display: inline-block; font-size: 10px; font-weight: bold; line-height: 40px; white-space: nowrap; cursor: pointer; } `); 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 isFullWidthEnabled() { return localStorage.getItem("hdrc_full_width_enabled") == "true"; } function switchFullWidth() { localStorage.setItem("hdrc_full_width_enabled", !isFullWidthEnabled()); location.reload(); } function initFullWidth() { if (isFullWidthEnabled()) { window.addEventListener("resize", resizePlayer); GM_addStyle(` .b-wrapper { width: auto; margin: 0 30px; } .b-newest_slider { width: auto; padding: 20px 35px 0; } .b-newest_slider .cntrl { display: none; } .b-newest_slider .b-newest_slider__wrapper { padding-left: 0; } .glory { width: auto; } `); } } function addFullWidthButton() { var topHeadLeftElem, switcherWrapperElem, switcherButtonElem; topHeadLeftElem = document.querySelector(".b-tophead-left"); if (topHeadLeftElem !== null) { switcherButtonElem = document.createElement("div"); switcherButtonElem.className = "hdrc-full-width-button"; switcherButtonElem.innerHTML = "Сменить ширину"; switcherButtonElem.addEventListener("click", switchFullWidth); switcherWrapperElem = document.createElement("div"); switcherWrapperElem.className = "pull-left"; switcherWrapperElem.appendChild(switcherButtonElem); topHeadLeftElem.appendChild(switcherWrapperElem); } } function onDocumentStart() { addStyle(); initFullWidth(); resizePlayer(); } function onDocumentEnd() { addFullWidthButton(); resizePlayer(); } document.addEventListener("DOMContentLoaded", onDocumentEnd); onDocumentStart(); })();