Displaying number of comments in torrents with UserScripts
#1
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
Reply
#2
There is a tooltip.
Reply
#3
(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
Reply
#4
If you look on the way back when machine you'll find an old post in Programing & Development showing you how.
Reply
#5
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
Reply
#6
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
Reply
#7
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>");
   }
});  
});
Reply
#8
Greasemonkey is happy with it and so am I (tweaked to add https).
Appreciated, thanks.
Reply
#9
:-)
- 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.
Reply
#10
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>" );
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Next Palindrome number Avantika_Sharmaa24 1 7,034 Mar 15, 2023, 21:19 pm
Last Post: SectorVector
  TPB user comments add-on. SectorVector 0 14,273 Feb 09, 2014, 07:23 am
Last Post: SectorVector



Users browsing this thread: 4 Guest(s)