9 votes

Suggestion: Add a show all posts by x button

As a lurker on the somethingawful forums one of my favorite features is a button which will show all the posts a single person has made in a thread. It'd be really handy if someone (like the OP) is answering questions about a topic. It's really nice to have on a more traditional forum website, but I'm not sure how useful it'd be here. Regardless, I thought I would suggest it.

Here is an example: Before and After

5 comments

  1. vektor
    Link
    I think a hacky version of this could be a script that auto-collapses all comments that aren't by said person or contain a comment by said person. That shouldn't be too hard to make, but I don't...

    I think a hacky version of this could be a script that auto-collapses all comments that aren't by said person or contain a comment by said person. That shouldn't be too hard to make, but I don't have the skills for it.

    1 vote
  2. [4]
    Emerald_Knight
    Link
    This should be fairly trivial to write up a quick script for. I'll look into drafting one up once I've eaten.

    This should be fairly trivial to write up a quick script for. I'll look into drafting one up once I've eaten.

    1. [3]
      Emerald_Knight
      (edited )
      Link Parent
      Alright, so it took a bit more effort than expected, but here you go: // ==UserScript== // @name Tildes Focus User's Comments // @namespace tildes-show-all-user-comments-in-thread // @version 0.1...

      Alright, so it took a bit more effort than expected, but here you go:

      // ==UserScript==
      // @name         Tildes Focus User's Comments
      // @namespace    tildes-show-all-user-comments-in-thread
      // @version      0.1
      // @description  #
      // @author       Emerald_Knight
      // @match        https://tildes.net/*
      // @grant        none
      // ==/UserScript==
      
      $(document).ready(function() {
      	$('.comment-nav-link').after('<a class="toggle-all-from-user comment-nav-link" href="">Focus</a>');
      
      	$('.toggle-all-from-user').click(function(event) {
      		event.preventDefault();
      
      		var text = $(this).html();
      		var should_hide = text === 'Focus';
      		var target_user_href = $(this).closest('header').find('.link-user').attr('href');
      
      		// Modify target user's comments.
      		$('.comment').filter(function() {
      			return $(this).find('.link-user').attr('href') === target_user_href;
      		}).each(function() {
      			$(this).find('.toggle-all-from-user').html(should_hide ? 'Unfocus' : 'Focus');
      		});
      
      		// Modify other users' comments.
      		$('.comment').filter(function() {
      			return $(this).find('.link-user').attr('href') !== target_user_href;
      		}).each(function() {
      			$(this).find('.toggle-all-from-user').html('Focus');
      			if(should_hide && !$(this).hasClass('is-comment-collapsed')) {
      				$(this).toggleClass('is-comment-collapsed');
      			}
      
      			if(!should_hide && $(this).hasClass('is-comment-collapsed')) {
      				$(this).toggleClass('is-comment-collapsed');
      			}
      		});
      	});
      });
      

      It's far from perfect--there are known bugs and it's not a particularly efficient or elegant solution--but I just got up and It gets the job done well enough to provide some functionality. I may or may not come back and make it not suck. Consider it an alpha version with no guarantee of moving onto a beta or official release. Anyone who wants to modify it and provide long-term support may do so.

      Edit: Yeah, thinking about it, this doesn't account for child comments, so it will only work for displaying top-level comments in a thread. It really needs a better implementation.

      2 votes
      1. [2]
        name
        Link Parent
        Huh, I came and checked my inbox, and I got notification about this post. Turns out username mentions in code blocks trigger notifications (blame me for picking @name....)! (:

        Huh, I came and checked my inbox, and I got notification about this post.

        Turns out username mentions in code blocks trigger notifications (blame me for picking @name....)! (:

        5 votes
        1. cfabbro
          (edited )
          Link Parent
          LOL! Although I suspect instances of this happening will be rare, that is probably still something that should be fixed at some point. I will add a Gitlab issue for it in the morning. edit:...

          LOL! Although I suspect instances of this happening will be rare, that is probably still something that should be fixed at some point. I will add a Gitlab issue for it in the morning.

          edit: https://gitlab.com/tildes/tildes/issues/271

          3 votes