Anonymous ID: 38a3a4 March 15, 2023, 9:38 a.m. No.18512665   🗄️.is 🔗kun   >>2669 >>2744 >>2999

>>18512507

Here, have this code.

Put it in User JS, see picrel.

It'll add "(pb)" after anything that's not in this bread.

Someone posted it few weeks ago, with green formatting for the "(pb)" but removed that tag, too distracting. (Think it was "small" if you want to add it back.) Anyway, here's the code, enjoy!

/ Enter your own Javascript code here... // You can include JS files from remote servers, for example: // load_js("http://example.com/script.js"); // Auto PB /$(document).ready(function () {// Get a list of all the postID's in this breadvar posts = [];var updatePosts = function () {posts = [];// Get the OP ID of this breadvar OP = parseInt($('div.post.op a.post_no:eq(1)').text());posts.push(OP);$('div.post.reply').find('a.post_no:eq(1)').each(function () {var postID = parseInt($(this).text());posts.push(postID);});};// Interate all posts and look for links to updatevar showpbLinks = function () {$(this).find('div.body a:not([rel="nofollow"])').each(function () {var postID;if (postID = $(this).text().match(/^>>(d+)$/))postID = parseInt(postID[1]);elsereturn;// Search the posts array for this postvar isInBread = $.inArray(postID, posts);// MAGICif (isInBread === -1) {$(this).after(' (pb)');}});};// Make it goupdatePosts();$('div.post.reply').each(showpbLinks);// allow to work with auto-reload.js, etc.$(document).on('new_post', function (e, post) {if ($(post).is('div.post.reply')) {updatePosts();$(post).each(showpbLinks);}else {updatePosts();$(post).find('div.post.reply').each(showpbLinks);}});});

Anonymous ID: 38a3a4 March 15, 2023, 9:39 a.m. No.18512669   🗄️.is 🔗kun   >>2744

>>18512665

what's up with code breaking the comments?

trying again:

 

/ Enter your own Javascript code here… /

/ You can include JS files from remote servers, for example: /

/ load_js("http://example.com/script.js"); /

 

/ Auto PB /

$(document).ready(function () {

// Get a list of all the postID's in this bread

var posts = [];

var updatePosts = function () {

posts = [];

// Get the OP ID of this bread

var OP = parseInt($('div.post.op a.post_no:eq(1)').text());

posts.push(OP);

$('div.post.reply').find('a.post_no:eq(1)').each(function () {

var postID = parseInt($(this).text());

posts.push(postID);

});

};

// Interate all posts and look for links to update

var showpbLinks = function () {

$(this).find('div.body a:not([rel="nofollow"])').each(function () {

var postID;

if (postID = $(this).text().match(/^>>(d+)$/))

postID = parseInt(postID[1]);

else

return;

// Search the posts array for this post

var isInBread = $.inArray(postID, posts);

// MAGIC

if (isInBread === -1) {

$(this).after(' (pb)');

}

});

};

// Make it go

updatePosts();

$('div.post.reply').each(showpbLinks);

// allow to work with auto-reload.js, etc.

$(document).on('new_post', function (e, post) {

if ($(post).is('div.post.reply')) {

updatePosts();

$(post).each(showpbLinks);

}

else {

updatePosts();

$(post).find('div.post.reply').each(showpbLinks);

}

});

});