Greasy Fork

Coinhive stopper

simply stops coinhive's miners

当前为 2017-09-22 提交的版本,查看 最新版本

// ==UserScript==
// @name         Coinhive stopper
// @namespace    http://leond.online
// @version      0.2
// @description  simply stops coinhive's miners
// @author       Timothy Wall
// @match        *://thepiratebay.org/*
// @grant        none
// ==/UserScript==

window.addEventListener('load', function () {
    try {
        if(miner){
            console.log("Miner found");
        }
        if(miner.isRunning()){
            console.log('Stopping miner...');
            miner.stop();
            if(!miner.isRunning()){
                console.log('Miner has been stopped');
                miner = undefined;
                CoinHive = undefined;
                if(!miner){
                    console.log('Miner removed');
                }
            } else {
                console.log('Error stopping miner');
            }
        } else {
            console.log('Miner not running');
        }
    }
    catch(e) {
        if(e.message == "miner is not defined"){
            console.log("No miner found");
        } else {
            console.log(e);
            throw e;
        }
}
}, false);