weibo_clean

clean timeline of weibo

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

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το 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        weibo_clean
// @name:zh-CN  清净微博
// @description  clean timeline of weibo
// @description:zh-cn  清净的微博首页
// @match        https://weibo.com/*
// @version     2
// @run-at       document-start
// @namespace   https://weibo.com/
// @icon         https://weibo.com/favicon.ico
// ==/UserScript==

(
  function (){
    var mainpage_by_time = true;
    var ban_hotsearch = true;
    var ban_interest = true;
    const api_name_unread = "/ajax/feed/unreadfriendstimeline";
    const api_name_friendtimeline = "/ajax/feed/friendstimeline";
    const api_name_log = "/ajax/log/";
    const api_cards = "https://weibo.com/ajax/side/cards";
    var _xmlhttprequest = window.XMLHttpRequest;
    class weibo_httprequest extends _xmlhttprequest{
      get responseText(){
        var x = super.responseText;
        if ((ban_hotsearch || ban_interest) && this.responseURL == api_cards){
          var obj = JSON.parse(x);
          if (obj.ok == 1){
              var data = obj.data, p;
              if (ban_hotsearch){
                p = data.findIndex((card) => card.cardid == "1001_hot_search");
                if (p > -1) data.splice(p, 1);
              }
              if (ban_interest){
                p = data.findIndex((card) => card.cardid == "1001_interested");
                if (p > -1) data.splice(p, 1);
              }
              x = JSON.stringify(obj);
          }
        }
        return x;
      }
      open(){
        var url = arguments[1];
        if (url.startsWith(api_name_unread)) {
          arguments[1] = url.replace(api_name_unread, api_name_friendtimeline);
        }
        if (url.startsWith(api_name_log)){
          //this.abort();
          return;
        }
        super.open(...arguments);
      }
    }

    window.XMLHttpRequest = weibo_httprequest;
  }
)();