Greasy Fork

Greasy Fork is available in English.

hdrezka-cleanup

Cleanup hdrezka: change content width, change player size, remove blocks like telegram, social, rating, support, status, vk

当前为 2021-04-24 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         hdrezka-cleanup
// @namespace    http://tampermonkey.net/
// @version      0.4
// @description  Cleanup hdrezka: change content width, change player size, remove blocks like telegram, social, rating, support, status, vk
// @author       rub4ek
// @match        https://rezka.ag/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Remove ads
    $(".b-content__main > .b-post__mixedtext")
        .next()
        .filter("div[style]")
        .remove();
    $(".b-player > a[target='_blank'")
        .remove();
    $(".b-post__rating_table")
        .next()
        .filter("div[style]")
        .remove();

    // Remove extra right padding for content page
    $(".b-content__columns")
        .css("padding-right", "0");

    // Style for content item cover
    $(".b-content__inline_item-cover")
        .css("border-color", "transparent");

    // Remove extra right padding on main content listing
    $(".b-content__inline_inner_mainprobar")
        .css("padding-right", "0");

    // Remove last episode info
    $(".b-post__lastepisodeout")
        .remove();

    // Resize playeer
    var $contentMain = $(".b-content__main");
    var $playerHolder = $(".b-player__holder_cdn");
    var $playerContainer = $(".b-player__container_cdn");
    var iw = $playerHolder.width();
    var ih = $playerHolder.height();
    var nw = $contentMain.width();
    if (iw >= 360 && ih > 0 && nw > iw) {
        var ratio = iw / ih;
        var nh = nw / ratio;
        $playerHolder
            .width(nw)
            .height(nh);
        $playerContainer
            .width(nw)
            .height(nh);
        console.log("hdrezka cleanup: player resized from" + iw + "x" + ih + " to " + nw + "x" + nh + ".");
    } else {
        console.error("hdrezka cleanup: invalid initial player size.");
    }

    // Add player margin
    $(".b-player")
        .css("margin-bottom", "20px");

    // Remove telegram info block
    $(".tg__info_block_wrapper")
        .remove();

    // Style status
    $(".b-post__status_wrapper")
        .css("width", "auto")
        .css("margin", "10px 10px 12px 13px");

    // Remove support block
    $(".b-post__support_holder")
        .remove();

    // Remove social block
    $(".b-post__social_holder_wrapper")
        .remove();

    // Remove rating block
    $(".b-post__rating_table")
        .remove();

    // Remove VK block
    $("#vk_groups")
        .remove();
})();