Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name 34P showreplies Booster
- // @namespace 34P showreplies Booster
- // @author Unkown Anonymous
- // @contributor Kinu
- // @description Boost showreplies() function on 34pchan.org
- // @include http://*34pchan.org/*
- // ==/UserScript==
- var script = document.createElement('script');
- script.setAttribute("type", "application/javascript");
- script.textContent = "showreplies = function(root) {"+
- " if (!Settings.showReplies()) return;"+
- " root = root ? root : 'body';"+
- " $(root).find('.replieslist').remove();"+
- " var replies = [];"+
- " var messages = [];"+
- " $(root).find('.postmessage').each(function(index, element) {"+
- " var node = $(this).parents('.postnode').first();"+
- " var postlink = node.find('span.reflink').find('a').first().attr('href');"+
- " replies[postlink] = [];"+
- " messages.push($(this));"+
- " });"+
- " for(j = messages.length - 1; j != 0; j--) {"+
- " var message = messages[j];"+
- " var node = message.parents('.postnode').first();"+
- " var postlink = node.find('span.reflink').find('a').first().attr('href');"+
- " message.find('a').each(function(index, element) {"+
- " var href = $(this).attr('href');"+
- " if(replies[href]!=null)"+
- " {"+
- " replies[href].push(postlink);"+
- " }"+
- " });"+
- " var myreplies = $.unique(replies[postlink]);"+
- " if (myreplies.length > 0) {"+
- " var repliesString = '<div \class=\"replieslist\"><br />'+_.replies+': ';"+
- " for (i = 0; i < myreplies.length; i++) {"+
- " var replypostlink = myreplies[i];"+
- " var replypostid = replypostlink.split('#')[1];"+
- " repliesString += '<a href=\"'+replypostlink+'\" onclick=\"javascript:highlight(\\''+replypostid+'\\', true);\">>>'+replypostid+\"</a>\";"+
- " if (i != myreplies.length - 1) repliesString += ', ';"+
- " }"+
- " node.find('.postmessage').append(repliesString);"+
- " PostPreviews.setupPreviews(node.find('.replieslist').get());"+
- " }"+
- " }"+
- "};";
- document.body.appendChild(script);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement