您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Выключает рекламу на ресурсе HDrezka
当前为
// ==UserScript== // @name Advertisement Hide - Kino HDrezka // @namespace scriptomatika // @author mouse-karaganda // @description Выключает рекламу на ресурсе HDrezka // @license MIT // @include https://rezka.ag/* // @include https://hdrezka.ag/* // @require https://greasyfork.org/scripts/379902-include-tools/code/Include%20Tools.js?version=1071128 // @version 2.8 // @grant none // ==/UserScript== (function() { let $ = window.jQuery; let $$ = window.__krokodil; let deleteElement = function(selector, method) { $$.missingElement(selector, function(exists) { if (!exists) return; if ($$.isIterable(this)) { $$.each(this, function(elem) { $$.del(elem); }); } else { $$.del(this); } }); }; // Стили на всех страничках $$.renderStyle( 'body.active-brand { background-color: #313131; background-color: #777; background-color: #5d5d5d; }', 'body.active-brand.pp { padding-top: 0 !important; }' ); // Уберем рекламный блок бренда на всю страницу deleteElement('body.has-brand.active-brand > noindex > div > iframe'); // Баннер в списке сериалов let banner; let seriesBannerContains = !!(banner = $$.get('.b-seriesupdate__block .b-seriesupdate__block_list_item_inner > a > img[src*="banner"]')); if (seriesBannerContains) { $$.del(banner.parentNode.parentNode.parentNode); } // Закроем всплывающую рекламу на мобильных устройствах $$.missingElement('footer ~ #hdrezka-ajax-block ~ div', function(exists) { if (!exists) return; let button; let isBanner = ($$.css(this, 'position') == 'fixed') && !!(button = $$.get('img + span', this)); if (isBanner) { $$.fireEvent(button, 'click'); } }); // Проверим, что мы на странице, где есть боковой блок с баннером let sideBannerContains = !!$$.get('.b-content__inline .b-content__inline_inner .b-content__inline_items + div[id] > div[id][style]'); if (sideBannerContains) { $$.renderStyle( '.b-content__inline_inner_mainprobar { padding-right: 0 !important; }' ); deleteElement('.b-content__inline_items + div[id]'); } // Проверим, что мы на странице, где есть боковой блок с виджетом VK let sideWidgetContains = !!$$.get('.b-content__columns .b-content__main + div[id] #vk_groups + div[id][style]'); if (sideWidgetContains) { $$.renderStyle( '.b-content__main + div[id] { display: none; }', '.b-content__columns { padding-right: 0 !important; }' ); deleteElement('.b-content__main #vk_groups + div[id]'); } // Метод для автоматического пропуска видео-рекламы let bannerNumber = 0, bannerCount = 0; let skipTimer, missingTimer; let skipButtonClick = function(button) { return function() { if (button.innerText == 'Пропустить') { clearInterval(skipTimer); console.log(`Жмем ПРОПУСТИТЬ [bn=${bannerNumber}] == `, button); $$.fireEvent(button, 'click'); // Запустим процесс со следующим рекламным роликом if (bannerNumber < bannerCount) { console.log(`missingVideoBanner == переход на следущий ролик`); missingVideoBanner(); } else { bannerNumber = 0; missingTimer = setInterval(missingVideoBanner, 300100); console.log('Реклама пропущена. Запустим missingTimer'); missingVideoBanner(); } } }; }; // Метод для автоматического выключения звука let missingVideoBanner = function() { console.log('missingVideoBanner == ', new Date()); // Ждем, когда включится реклама let containerClass = ('scriptomatika_banner_container'); let missingDiv = (`#cdnplayer > pjsdiv > pjsdiv > video ~ pjsdiv:nth-child(4):not(.${containerClass})`); $$.missingElement(missingDiv, function(exists) { if (!exists) return; console.log(`Ищем рекламу [bn=${bannerNumber}] == `, this); this.classList.add(containerClass); let parentContainer = this.parentNode; // Ищем кнопки для звука и для пропуска let innerLayers = $$.getAll('pjsdiv', parentContainer); $$.each(innerLayers, function(layer) { let part = layer.innerHTML.match(/Реклама (\d+)\/(\d+)/); if (!!part) { console.log('Реклама найдена. Остановим missingTimer'); clearInterval(missingTimer); bannerNumber = part[1] * 1; bannerCount = part[2] * 1; layer.classList.add('scriptomatika_reklama_title'); layer.classList.add('bnumber_' + bannerNumber); layer.classList.add('bcount_' + bannerCount); let soundButton = layer.nextSibling; console.log('soundButton == ', soundButton); if (bannerNumber == 1) { let soundClass = ('scriptomatika_sound_off'); if (!soundButton.classList.contains(soundClass)) { soundButton.classList.add(soundClass); $$.fireEvent(soundButton, 'click'); } } let skipButton = soundButton.nextSibling; skipTimer = setInterval(skipButtonClick(skipButton), 1000); // Кладем фон, чтобы закрыть изображение $$.renderElement({ cls: 'scriptomatika_banner_shadow', renderTo: parentContainer }); return true; } }); }); }; // Проверим, что мы на странице, где есть видео-плеер let player; let playerContains = !!(player = $$.get('#cdnplayer-container #cdnplayer')); if (playerContains) { $$.renderStyle( '#cdnplayer, #cdnplayer-container { width: 960px !important; height: calc(960px * 360 / 640) !important; }', '.scriptomatika_banner_shadow { position: absolute; left: 0; top: 0; width: 100%; height: 100%; z-index: 0; background: url(http://static.scriptomatika.ru/img/fon16.png); }' ); deleteElement('.b-post__rating_table + div[id][style]'); deleteElement('.b-post__mixedtext + div[id][style]'); deleteElement('.b-player__network_issues_holder + a[id][style]'); missingTimer = setInterval(missingVideoBanner, 300100); console.log('missingVideoBanner == ВРУЧНУЮ'); missingVideoBanner(); } console.log('Advertisement Hide - Kino HDrezka 💬 2.8'); })();