Block sites

Block sites (such as Baidu, etc.) You can edit the block list in the script.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name         Block sites
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  Block sites (such as Baidu, etc.) You can edit the block list in the script.
// @author       Laphy
// @match        http*://www.baidu.com/
// @match        http*://weibo.com/*
// @match        http*://feedly.com/*
// @match        http*://twitter.com/*
// @match        http://www.newsmth.net/*
// @grant        GM_addStyle
// @run-at       document-start
// @require      http://code.jquery.com/jquery-2.2.4.js
// ==/UserScript==

(function() {
    'use strict';
    
    var fullBlock = true;
    
    if(fullBlock)
    {
        window.stop();
    //not works, since the reloading will also be blocked.
    /*
    document.body = document.createElement("body");
    $('body').html(`<div id="NewContent">Connected. <a href='${document.URL}'>Restore</a></div>`);
    */
        return;
        
    }

    $("body").css("visibility","hidden");
    
    $(document).ready(function() {
        var oldBody = $('body').html();
        $('body').html('<div id="NewContent">Connected. <a href="javascript:void(0)">Restore</a></div>');
        $("body").css("visibility","visible");
        
        GM_addStyle(`#NewContent {
height: 300px;
margin: 50px;
padding: 50px;
font-size:20pt;
text-align:center;
}`);

        
        $("body a").click(function() {
        $('body').html(oldBody);
    });
        
});

    
})();