d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Possible To Get An Updated Post-blocker?
Add Reply New Topic New Poll
Member
Posts: 105,353
Joined: Nov 12 2007
Gold: 2,417,337.00
Mar 3 2024 08:00am
Since the lastest update to d2jsp. Fokse's hide posts does not function anymore.
https://forums.d2jsp.org/topic.php?t=81907560&f=276

Anyone has the skill to make an updated version of it?
Member
Posts: 15,801
Joined: Jul 9 2021
Gold: 291.00
Mar 3 2024 09:21am
np. replace parsePage with:

Code

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>`);
$('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();
})

}
Member
Posts: 26,862
Joined: Feb 27 2013
Gold: 4,445.68
Mar 3 2024 05:08pm
Oh shoot, didn’t even realize it was broken! I should’ve assumed though since they’re actively changing the site :P

Quote (ChocolateCoveredGummyBears @ Mar 3 2024 07:21am)
np. replace parsePage with:


Looks like this fixes it, but avatars/signatures aren’t blocked anymore. I’ll try to check it out when I get some free time and make a new post with the fixed script so I can update my signature
Member
Posts: 105,353
Joined: Nov 12 2007
Gold: 2,417,337.00
Mar 3 2024 05:18pm
Quote (MrSK @ 4 Mar 2024 00:08)
Oh shoot, didn’t even realize it was broken! I should’ve assumed though since they’re actively changing the site :P



Looks like this fixes it, but avatars/signatures aren’t blocked anymore. I’ll try to check it out when I get some free time and make a new post with the fixed script so I can update my signature


Thanks appreciate it alot. Such a core feature ^_^
Member
Posts: 15,801
Joined: Jul 9 2021
Gold: 291.00
Mar 3 2024 05:46pm
new code to block sig+avatar:

Code
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();
})

}


Member
Posts: 26,862
Joined: Feb 27 2013
Gold: 4,445.68
Mar 3 2024 06:29pm
Quote (ChocolateCoveredGummyBears @ Mar 3 2024 03:46pm)


Oh nice! Appreciate it :thumbsup:
Do you mind if I upload it to greasyfork?

This post was edited by MrSK on Mar 3 2024 06:31pm
Member
Posts: 15,801
Joined: Jul 9 2021
Gold: 291.00
Mar 3 2024 06:48pm
Quote (MrSK @ Mar 3 2024 04:29pm)
Oh nice! Appreciate it :thumbsup:
Do you mind if I upload it to greasyfork?


go for it. Jquery needs some lovin too :rofl:

This post was edited by ChocolateCoveredGummyBears on Mar 3 2024 06:48pm
Member
Posts: 105,353
Joined: Nov 12 2007
Gold: 2,417,337.00
Mar 4 2024 07:42am
Quote (ChocolateCoveredGummyBears @ 4 Mar 2024 00:46)
new code to block sig+avatar:

Code
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();
})

}


https://i.gyazo.com/8ecebe7709df9c983ba8128a140b9e33.gif


Quote (MrSK @ 4 Mar 2024 01:29)
Oh nice! Appreciate it :thumbsup:
Do you mind if I upload it to greasyfork?


Thanky so much guys :hug:
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll