83

History

  • June 6, 2012: Fixed an issue that can cause major problems with chat.
  • December 17, 2013: Fix an incompatibility with the Winter Bash code.

Screenshot

Before:

comments without threading

After:

comments with threading

About

Instead of showing comments in chronological order, this user script displays them in a threaded view, making it easier to follow conversations in long comment threads.

It uses heuristics similar to the @-reply recognition (but it is a little bit more flexible).

It should be noted that this may obviously change the order in which comments are displayed, so you cannot rely on a chronological order anymore. In most cases this doesn't matter, but sometimes it just might.

Update 2011/07/10: As suggested by George Edison, now offers a button to undo the threading on a particular post, in case you want to see the comments in their regular order. I'm not 100% happy with the UI, but I guess it's good enough. The script also got a little smarter about finding the replied-to comment.

Download

install / update scriptview source

Platform

I have tested this script in Chrome (Windows 7), Chromium (Fedora 14), and Firefox + Greasemonkey (both OSes).

Contact

This script is created by Benjamin Dumke-von der Ehe. Note that this is a free-time project of mine, and has nothing to do with my employment at Stack Overflow. See my profile for contact details; you can also often find me in the Tavern on Meta Stack Exchange chat.

balpha
  • 10,986
  • 3
  • 28
  • 27
  • hm, can one award a bounty to a "question"? as in "reward the author for this awesome script"? – Tobias Kienzler Feb 21 '11 at 08:46
  • Working well with opera too. – LifeH2O Aug 08 '11 at 14:43
  • It seems like that, recently, it stopped displaying the @mention in threads. While I can live with this in threaded mode, it removes a bit of context in unthreaded mode. – Teo Klestrup Röijezon Mar 20 '12 at 22:50
  • @Nullable I don't understand. The script doesn't change the content of the comments. What exactly do you mean? – balpha Mar 29 '12 at 20:28
  • @balpha, sorry about that, my bad. I thought it did it, that it still happens after I disable it. I think I just misunderstood the algorithm it uses for detecting threads. – Teo Klestrup Röijezon Mar 30 '12 at 00:14
  • WOuld it be possible for this to 'minimise' some threads on a button click or something...? – AncientSwordRage Sep 11 '12 at 10:12
  • @Pureferret Can you give an example of what you mean by that? – balpha Sep 11 '12 at 11:08
  • In your example I might not care about what happened after Slaks replied to Pekka, so I'd like someway to hide replies after that, i.e. minimise them. – AncientSwordRage Sep 11 '12 at 11:57
  • @Pureferret Hmm, I see your point, but it's somewhat problematic in that this script really only does guesswork (even if fairly educated guesswork) as to what is a reply to what. I fear that with such a functionality as you request, it creates a too confident impression of its abilities. – balpha Sep 12 '12 at 10:16
  • But if it's minimising the wrong stuff (because it's not a reply) it's going to be threading wrongly too? The error should be consistant and tracable to the root cause, if the minimisation runs on what is being threaded already. I've not looked at the source yet but I'd imagine that's how it's written. – AncientSwordRage Sep 12 '12 at 10:33
  • @Pureferret You're absolutely right, it would be identical. I'm not thinking about technical issues, more conceptual issues. It should also be noted that most comment threads are fairly short, and any additional user interface functionality creates an additional burden, so you'd have to weigh the two. I don't actually have strong feelings about your proposal; I'm just not quite convinced. – balpha Sep 12 '12 at 12:15
  • @balpha Not convinced it would add value to the comments overal? I can see where you're coming from, still just putting the idea out there :) – AncientSwordRage Sep 12 '12 at 12:41
  • 1
    userscripts.org is down :( Is there a GitHub mirror or something? I'd also really like it if a browser extension (especially Chrome) was available, so it would automatically sync to all my desktops. I'd be happy to handle the conversion for you, if you can tell me where to get the source ;D – Oliver Salzburg Jun 03 '14 at 16:05
  • This is a useful add-on but I couldn't figure out where to report bugs. There are cases where I need to undo the threading on a post (e.g., too complex and it gets it wrong, or edit to a highly-indented comment puts the save button under sidebar content so it isn't accessible). There's an "unthread" button, but that doesn't affect anything, at least on my system. So I assume the issue is in getting the Unthread to work on my configuration. Where can the issue and any diagnostic details be posted? – fixer1234 Dec 23 '16 at 18:59
  • Where is the button to undo it? I can't find it! – VidathD Jul 01 '20 at 15:52
  • 1
    404 error on https://bitbucket.org/balpha/user-scripts/raw/tip/threading-comments/threading-comments.user.js. – user598527 Jan 28 '21 at 22:31
  • 1
    @VidathD: hover over the comments, it'll appear to the top left of the first comment. See the screenshot in my answer post below, where it is visible. When you click it, threading is turned off, and the button becomes a 'thread' button; the button disappears when you mouse out again. – Martijn Pieters May 04 '22 at 16:40
  • 1
    @fixer1234: You'd post an 'answer' here on Stack Apps, I guess. Note that the unthread/thread toggle works fine for me in current versions of Chrome, Firefox and Safari, at least for the release I recovered (see my answer below). – Martijn Pieters May 04 '22 at 16:41

3 Answers3

5

Balpha's Userscripts repository is gone, and no replacement has been made available yet.

So I recovered the script from my browser and put it in a gist:

It continues to work without issue:

Screenshot of this post with 2 comments, threaded by the script

Martijn Pieters
  • 901
  • 7
  • 17
2


Very nice comments thread. Could it be made to display threads 1 deep (like Stack Apps basically does), and maintain the chronological order of the original comments?

For example (imagine dates where appropriate):

I love it! One small request: can you please add a button to undo the
rearrangement? Sometimes it's easier to see the comments in their original
order. –  Nathan Osman♦ Feb 20 '11 at 6:03

   -- hm, can one award a bounty to a "question"? as in "reward the author for
   this awesome script"
      Tobias Kienzler Feb 21 '11 at 8:46

   -- Working well with opera too. –  LifeH2O Aug 8 '11 at 14:43

It seems like that, recently, it stopped displaying the @mention in threads.
While I can live with this in threaded mode, it removes a bit of context in
unthreaded mode. –  Teo Klestrup Röijezon Mar 20 '12 at 22:50

@Nullable I don't understand. The script doesn't change the content of the
comments. What exactly do you mean? –  balpha♦ Mar 29 '12 at 20:28
Brock Adams
  • 12,901
  • 5
  • 38
  • 64
1

I'm using the following matches to run on all metas and also on SO in Portuguese.
Area51 is matched by *.se.com/*.

// @match       *://*.askubuntu.com/*
// @match       *://*.mathoverflow.net/*
// @match       *://*.serverfault.com/*
// @match       *://*.stackapps.com/*
// @match       *://*.stackexchange.com/*
// @match       *://*.stackoverflow.com/*
// @match       *://*.superuser.com/*
brasofilo
  • 992
  • 7
  • 22