您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Hides posts from a defined list of users [Update 03/03/2024]
- // ==UserScript==
- // @license MIT
- // @name fokse's d2jsp post blocker
- // @author Fokse
- // @description Hides posts from a defined list of users [Update 03/03/2024]
- // @namespace jsppostblocker
- // @include https://forums.d2jsp.org/topic.php?t=*&f=*
- // @include https://forums.d2jsp.org/topic.php?t=*
- // @include https://forums.d2jsp.org/post.php
- // @require http://code.jquery.com/jquery-latest.js
- // @grant GM_getValue
- // @grant GM_setValue
- // @grant GM_deleteValue
- // @version 1.15
- // ==/UserScript==
- if (!Array.isArray(GM_getValue("fokse_post_blocker_userlist"))) {
- GM_setValue("fokse_post_blocker_userlist", []);
- }
- function parsePage(){
- console.log('sup');
- var blockedUser = GM_getValue('fokse_post_blocker_userlist')
- $('body > form > dl').each(function() {
- if (typeof $('.pU > div > a', this).attr('href') !== 'undefined' && ~$('.pU > div > a', this).attr('href').indexOf('user.php?i=')) {
- var userId = $('.pU > div > a', this).attr('href').split("=")[1];
- if (~blockedUser.indexOf(userId)){
- $('dd > div > div.bc1.upc > div.desc.cl.rc > div.fR.links', this).prepend(`<b><a href="#" class="blockPost" action="unblock" userId="${userId}">Unblock Posts</a></b>`);
- $('dd > div > div.bc1.upc > .sig', this).hide();
- $('.pU', this).children().eq(1).hide()
- $('div.bts', this).html('<center><b><span style="color:#d65a5a;">Post from that user are hidden</style></b></center>');
- } else{
- $('dd > div > div.bc1.upc > div.desc.cl.rc > div.fR.links', this).prepend(`<b><a href="#" class="blockPost" action="block" userId="${userId}">Block Posts</a></b>`);
- }
- }
- });
- $('.blockPost').click(function(){
- var blockedUser = GM_getValue('fokse_post_blocker_userlist'),
- userId = $(this).attr('userId');
- if ($(this).attr('action') == "block" && !~blockedUser.indexOf(userId)){
- blockedUser.push(userId);
- }
- else if ($(this).attr('action') == "unblock" && ~blockedUser.indexOf(userId)){
- blockedUser.splice(blockedUser.indexOf(userId),1);
- }
- GM_setValue("fokse_post_blocker_userlist", blockedUser);
- location.reload();
- })
- }
- parsePage();