Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Disable Lenta.ru autoplay
- // @namespace lenta.ru
- // @version 0.5
- // @description Ставит на паузу видео и попутно удаляет рекламу на ленте.
- // @author Anonymouse
- // @run-at document-start
- // @include https://lenta.ru/*
- // @include https://lentaru.media.eagleplatform.com/index/player*
- // @match https://lenta.ru/*
- // @match https://lentaru.media.eagleplatform.com/index/player*
- // @grant none
- // ==/UserScript==
- if(document.location.href.indexOf('lentaru.media.eagleplatform.com') !== -1){
- if(document.location.href.indexOf('autoplay=0') === -1) document.location = document.location+"&autoplay=0"
- }else{
- var StopTimer=0;
- //Функция вызывается при создании на странице какого-либо элемента с помощью JavaScript-а.
- var DetectAddNode = function (ev) {
- if( (typeof(ev.target.innerHTML) == "string") && ((ev.target.innerHTML.indexOf('palacesquare.rambler.ru') !== -1)) ){
- ev.target.parentNode.removeChild(ev.target);
- StopTimer=0;
- }
- };
- //Начинаем проверять, какие элементы добавляются на страницу динамически.
- document.addEventListener("DOMNodeInserted", DetectAddNode, false);
- //Запускаем таймер для отключения функции DOMNodeInserted
- var timerStop = setInterval(function() {
- if(StopTimer>=2){
- clearInterval(timerStop);
- document.removeEventListener("DOMNodeInserted", DetectAddNode, false);
- }
- StopTimer++;
- }, 5000);
- }
Advertisement
Add Comment
Please, Sign In to add comment