Download it from greasyfork

This userscript for kbin enhances the comment section adjusting the layout and adding a line to the left of each comment and its replies that lets you collapse them. The design is inspired by some custom subreddit stylesheets, and new reddit surprisingly enough (you know what they say about broken clocks)

Personally, I think this is the best way to handle collapsing comments here’s a screenshot.

A video of it in action

If you don’t have a userscript manager extension installed, you can install Tampermonkey, and then open the greasyfork link.

  • Velskadi@kbin.social
    link
    fedilink
    arrow-up
    3
    ·
    edit-2
    2 years ago

    Sorry for triple posting, but just wanted to test this out real quick. The script seems to basically work, but I’ve found a couple issues; After my second post it showed the line only on the first post. The second post didn’t get a collapse line until I collapsed/uncollapsed the first post.
    Second, when I edited a comment it removed the collapse line from that post until I edited a second time. This doesn’t seem to be consistent.
    Third, and this might just be on my end, at some point while editing the posts, the second post is now on the far right of the comments window, instead of just slightly to the right of its parent comment.

    I don’t think these issues will be a huge deal, and I’m still looking forward to using this. Thanks for making it!

    EDIT: Should also mention I’m on Firefox as well, incase that matters.

    • artillect@kbin.socialOP
      link
      fedilink
      arrow-up
      2
      ·
      edit-2
      2 years ago

      Thanks for the feedback! I’ll see what I can do about fixing those issues. I think I might have partially fixed the first one, but the new comment isn’t nesting properly.

      Edit: this is a test to see if editing is working
      Edit 2: my change didn’t fix that, I’m on it

  • Wintar@kbin.social
    link
    fedilink
    arrow-up
    2
    ·
    2 years ago

    I’m having an issue where clicking anywhere on the comment will collapse it; Not just the line on the left. I couldn’t figure out why myself, looking in the code, and it seems no-one else is having the issue?

    • artillect@kbin.socialOP
      link
      fedilink
      arrow-up
      2
      ·
      2 years ago

      That’s a feature I added a bit later on, you should be able to disable it in the settings menu in the top right. However, this userscript is no longer supported, and has been added to KES (which you can install here), with some more config options added as well.

  • Noki@kbin.social
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    2 years ago

    Edit: Already fixed, Thank you very much.
    This is how it looks to me.
    im on firefox kbin.social with kbin enhancement script an the optins for Show collapse comment Show collapse replies off

    • artillect@kbin.socialOP
      link
      fedilink
      arrow-up
      1
      ·
      2 years ago

      I like the way that kbin enhancement does its config, but I plan on releasing the configuration for this script as a library that everyone can use in their userscripts, to make configs easy (and work cross-platform). I just need to finish it up and separate it into its own script

  • Spoonraker@kbin.social
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    2 years ago

    Edit: The issue was resolved, so please ignore this message. Thanks u/artillect!

    There was an issue where the parent comment was in a column on the left side and its children were all on the right, but I adjusted the CSS:

       .entry-comment .children {
            /* grid-area: children; */ /* disable or delete this */
            display: flex;
            flex-direction: column;
        }
    
       .entry-comment .comment-level--2:first-child {
            margin-top: 3rem; /* Edit: If the child comment is long then the text will get cut off, so setting the margin and/or parent height conditionally could work*/
       }
    
    
  • fl4shback@kbin.social
    link
    fedilink
    arrow-up
    1
    ·
    2 years ago

    Thank you so much for this script ! Improves readability and clarity so much !
    Hope it inspires ernest to build something similar natively.

  • exscape@kbin.social
    link
    fedilink
    arrow-up
    1
    ·
    2 years ago

    @artillect I found a weird bug/interaction! When you have the script (v1.2.1) as-is and enable media previews in the sidebar settings, a bunch of comments begin collapsed. It happens in this thread so it can be used for testing. Most of your comments are auto-collapsed.

    The click handler on comments is triggered, as shown by this modification:

        // Add event listener to comment
        comments[i].addEventListener('click', function(){console.log("CLICK on comment " + i); toggleReplies(event, comments[i], expando)});
    
    

    It spams a bunch of log lines in the console. I’m guessing the auto media preview is implemented by simulating clicks on comments, but I haven’t checked the code.

    • exscape@kbin.social
      link
      fedilink
      arrow-up
      1
      ·
      2 years ago

      I also found a fix: listen for ‘mouseup’ instead of ‘click’. However, this still collapses comments when you try to select text so that’s still not good.

      • exscape@kbin.social
        link
        fedilink
        arrow-up
        1
        ·
        2 years ago

        Sorry, just noticed 1.3 is out, doh.
        With fulltoggle off, the bug is solved, but it remains when it is enabled.

        I also couldn’t find the config menu anywhere and added openConfigMenu() to to async function to actually change the setting. Hm.

        • artillect@kbin.socialOP
          link
          fedilink
          arrow-up
          1
          ·
          edit-2
          2 years ago

          Hmm, I’ll see what I can do about fixing the bug with enable media previews. I just fixed the issue with comments collapsing when you try to highlight text, try updating to 1.3.1. The config should be accessible in your user menu in the top right, I think I might move it into its own icon in the menu so it’s more visible

          Edit: It wasn’t actually fixed in 1.3.1, but I have fixed it properly now