SuprBay: The PirateBay Forum

Full Version: Displaying number of comments in torrents with UserScripts
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
OK, so here's something that I've been thinking about, wondering if it is possible to somehow display the number of comments each torrent has, instead of just having a baloon
[Image: screenshot_59.png]

I was wondering if something was possible through UserScripts, some time ago I played a bit with it, but got to nowhere... not sure if it's even possible lol, but if someone knows a way, I would appreciate the enlightenment on this matter Smile
There is a tooltip.
(Jul 18, 2014, 15:15 pm)Kingfish Wrote: [ -> ]There is a tooltip.

Already knew that, but if there is a way of displaying that info without having to place my mouse over it, would be usefull hehehe
If you look on the way back when machine you'll find an old post in Programing & Development showing you how.
Well I've found this https://pirates-forum.org/Thread-TPB-use...nts-add-on unfortunately the page mentioned on that post wont open, not available on WebArchive. I'll go through Prog & Dev see if I can find something usefull, thx for the tip
Found this short userscript. Can anyone modify it to display the 'number of comments' next to the yellow bubble ?
http://oreilly.com/pub/h/4157

To install:
1) Save the file as alt-tooltips.user.js
2) File -> Open using Firefox to install
Barebones version. Script carved from 2 days of learning jQuery :-D

INSTALL:
1) Save this file somewhere permanent, as TPB-NumCmts.user.js (Note: There should be no .txt extension, if you use notepad)
2) Open the file in Filefox (File -> Open) to Install the script. Done.

Screenshot:
http://i.imgur.com/B3KaodM.jpg

Code:
// ==UserScript==
// @name    TPB NumCmts
// @namespace http://thepiratebay.se
// @include http*//thepiratebay.se/*
// @author  TPBuser
// @version 1.0
// ==/UserScript==

$(document).ready(function() {
   var elementName = "img";
   var imgSrc;

$(elementName).each(function(i) {
     imgSrc = $(this).attr('src');

   if (imgSrc.match("icon_comment.gif")) {
      var imgAlt;
      var numCmts;

      imgAlt = $(this).attr('alt');
      numCmts = imgAlt.match(/This torrent has (\d*) comments/)[1];
      $(this).parent().append("&nbsp;<font color=chartruse><b>" + numCmts + "</b></font>");
   }
});  
});
Greasemonkey is happy with it and so am I (tweaked to add https).
Appreciated, thanks.
:-)
- Updated script to display it in colour (the last line alone is changed).
- Changed @includes to include https.

For others using proxy, include the appropriate site name as follows. (Not tested. But I think this should work).
1) click on the GreaseMonky pulldown (top-right of Firefox)
2) Select Manage User Scripts
3) Locate TPB Num Cmts 1.0, Click Options
4) Go to Use Settings. Click Add and enter the HTTP address suitable for your use. Click OK.
haha nice SectorVector, great work man, thank you for this Big Grin

If any1 wants to replace the Comment balloon with the actual number of comments, just replace

this line:
$(this).parent().append("&nbsp;<font color=chartruse><b>" + numCmts + "</b></font>");

with this one:
$(this).replaceWith( "<font color=chartuse><b>" + numCmts + "</b></font>" );



Here's an alternative line with a larger font:
$(this).replaceWith( "<font color=chartuse><font size=2><b>" + numCmts + "</b></font>" );
Pages: 1 2 3