d2jsp
Log InRegister
d2jsp Forums > Off-Topic > General Chat > User Blogs > Post Blocker
Add Reply New Topic
Member
Posts: 29,514
Joined: Feb 6 2017
Gold: 0.00
Feb 6 2021 05:04pm
1) You must have chrome browser
2) download tampermonkey app in google store ( https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo?hl=en )
3) Once you installed Tampermonkey, you'll need the script (copy the script below)


// ==UserScript==
// @name fokse's d2jsp post blocker
// @author Fokse
// @description Hides posts from a defined list of users
// @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.13
// ==/UserScript==

if (!Array.isArray(GM_getValue("fokse_post_blocker_userlist"))) {
GM_setValue("fokse_post_blocker_userlist", []);
}

function parsePage(){
var blockedUser = GM_getValue('fokse_post_blocker_userlist')
$('body > form > dl').each(function() {
if (typeof $('dt > a', this).attr('href') !== 'undefined' && ~$('dt > a', this).attr('href').indexOf('user.php?i=')) {
var userId = $('dt > a', this).attr('href').split("=")[1];
if (~blockedUser.indexOf(userId)){
$('dd > div.desc.p3 > div', this).prepend(`<b><a href="#" class="blockPost" action="unblock" userId="${userId}">Unblock Posts</a></b>`);
$('dd > div.bts.ppc', this).html('<center><b><span style="color:#d65a5a;">Post from that user are hidden</style></b></center>');
} else{
$('dd > div.desc.p3 > div', 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();






4) click the extension and click "Create new script..."


5) Once you're in there, highlight everything in the editor section and paste the code

6) Head to D2jsp and click refresh. Now you should be able to see "Block Posts" next to "report post & quote".
When you click "Block Posts", You will see that its blocked and the message will shows "Post from that user are hidden"


This post was edited by Whiteshadowmaster on Feb 6 2021 05:06pm
Go Back To User Blogs Topic List
Add Reply New Topic