Thanos script

random remove half elements when triple click page

Verze ze dne 29. 05. 2019. Zobrazit nejnovější verzi.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         Thanos script
// @name:zh-CN   灭霸脚本
// @version      0.1
// @description  random remove half elements when triple click page
// @description:zh-CN 鼠标三击页面的时候,随机移除页面上的一般元素
// @author       tabedit
// @include     *
// @grant        none
// @namespace https://greasyfork.org/users/225710
// ==/UserScript==

(function() {
    'use strict';

    function fingerSnap(){
        'use strict'
        var nodeIter = document.createNodeIterator(
            document.body,NodeFilter.SHOW_TEXT + NodeFilter.SHOW_ELEMENT +
            NodeFilter.SHOW_COMMENT ,null);
        var leafNode = [];
        var nn;
        while (true){
            nn = nodeIter.nextNode();
            if(nn === null){
                break;
            }
            if (nn.childNodes.length === 0){
                leafNode.push(nn);
            }
        }
        for(var ind = 0; ind < leafNode.length; ind++){
            if (Math.random() < 0.5){
                leafNode[ind].parentNode.removeChild(leafNode[ind]);
            }
        }
    }

    var threeClick = function (){
        'use strict'
        var timeSeq = [1, 100000, 200000];
        var MININTERVAL = 400;
        return function(){
            var now = new Date();
            console.log(now.getTime());
            timeSeq.push(now.getTime());
            timeSeq.shift();
            if(timeSeq[1] - timeSeq[0] < MININTERVAL &&
               timeSeq[2] - timeSeq[1] < MININTERVAL){
                fingerSnap()
            }
        }
    }();

    document.addEventListener('click',threeClick);
})();