LINUX.ORG.RU

История изменений

Исправление insw, (текущая версия) :

С адблоком как то фигово получается, если на коммент кто то отвечает. Сделал юзерскрипт, блюрит комментарии, но если удерживать на них по 1250мс мышь, то разблюривает.

// ==UserScript==
// @name         RemovePlov
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        *://*/*
// @include      *://linux\.org\.ru/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    const badboys = ['shpinog'];

    function enableBlur(node, v) {
        if(v) {
            node.style['height'] =  '50px';
            node.style['overflow'] = 'hidden';
            node.style['filter'] = 'blur(10px)';
        } else {
            node.style.cssText = 'filter: none;';
            node.style['height'] =  'none';
            node.style['overflow'] = 'none';
        }
    };

    Array.from(document.querySelectorAll('a[itemprop="creator"]'))
        .filter(a => badboys.includes(a.textContent))
        .forEach((a) => {
            let commentary = a.parentNode.parentNode.parentNode.parentNode;
            enableBlur(commentary, true);
            commentary.onmouseover = () => {
                commentary.ismouseover = true;
                setTimeout(() => { if(commentary.ismouseover) { enableBlur(commentary, false) } }, 1250);
            };
            commentary.onmouseout = () => { commentary.ismouseover = false; enableBlur(commentary, true) };
        });
})();

Исходная версия insw, :

С адблоком как то фигово получается, если на коммент кто то отвечает. Сделал юзерскрипт, блюрит комментарии, но если удерживать на них по 1250мс мышь, то разблюривает.

// ==UserScript==
// @name         RemovePlov
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       Insw
// @match        *://*/*
// @include      *://linux\.org\.ru/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    const badboys = ['shpinog'];

    function enableBlur(node, v) {
        if(v) {
            node.style.cssText = 'filter: blur(10px);';
        } else {
            node.style.cssText = 'filter: none;';
        }
    };

    Array.from(document.querySelectorAll('a[itemprop="creator"]'))
        .filter(a => badboys.includes(a.textContent))
        .forEach((a) => {
            let commentary = a.parentNode.parentNode.parentNode.parentNode;
            enableBlur(commentary, true);
            commentary.onmouseover = () => {
                commentary.ismouseover = true;
                commentary.timeout = setTimeout(() => { if(commentary.ismouseover) enableBlur(commentary, false) }, 1250);
            };
            commentary.onmouseout = () => {
                commentary.ismouseover = false;
                clearTimeout(commentary.timeout);
                enableBlur(commentary, true);
            };
        });
})();