// ==UserScript== // @name Block Douban User Status // @namespace Zcc // @version 0.1 // @description Block Douban User's Status (reposts excluded) // @author Zcc // @match *://www.douban.com/* // @match *://www.douban.com/people/* // @copyright 2017+, Zcc // @downloadURL none // ==/UserScript== // window.onload = function () { // block var block_list = JSON.parse(localStorage.getItem('douban_block_list')) || [], r_block = new RegExp(block_list.join('|')); // console.log("block_list", block_list); // console.log("r_block", r_block); $(".status-wrapper, .status-wrapper > .reshared_by").each(function(index, wrapper){ if (!block_list.length) { return false; } if (wrapper.dataset.uid.match(r_block)) { // block the original posts // $(wrapper).find('.status-item').hide(); // hide()非法调用 wrapper.parentNode.removeChild(wrapper); } // block the reposts }); if(window.location.pathname !== "/"){ // add user to block list var listEle = $('.more-opt .user-group-list'); if (!listEle.length) { return false; } // let matches = $('#profile img').attr('src').match(/ul(\d+)/), usrid; // if (!matches || matches.length < 2) return false; // usrid = matches[1]; var usrid = people_info.id; if (block_list.filter(function (num) { return num == usrid; }).length) { // already blocked listEle.prepend('