Micolithe
Agender
36 years old
Philadelphia, PA
Online Now
Last Login: 08/30/2007

Agender Enby, Trans, Gay, AND the bearer of the gamer's curse. Not a man, not a woman, but instead I am puppy.
I got a fat ass and big ears.

--

Yes I did the cooking mama Let's Play way back when. I post alot about Tech (mostly how it sucks) and Cooking and Music and Television Shows and the occasional Let's Play video
💖@FadeToZac

--

We all do what we can ♫

So we can do just one more thing ♫

We can all be free ♫

Maybe not in words ♫

Maybe not with a look ♫

But with your mind ♫


last.fm listening



cefqrn
@cefqrn

edit: if you're using versions 0.38 or 0.39 of this script or last updated/installed it between July 31st, 2023 and August 28th, 2023, there was a security vulnerability that was fixed in version 0.40 (warning post)

I tend to open a lot of tabs and a lot of the time it's to check out the comments of a post

scrolling tabs (motion)

horizontally scrolling tab bar with nothing but cohost tabs

so here's a userscript that lets you see a post's comments without opening it in a new tab

screenshot showing the userscript displaying comments under a post

click on the arrow to the left of the comment count to see the comments then click on it again to hide them

reopening the comments refreshes them

tested on both firefox and chrome with tampermonkey and also greasemonkey on firefox

source code

install

markdown isn't supported (yet?)

any and all suggestions are welcome

edits under the break (last update: 2023-11-23T01:26:45Z, version 0.48)


  1. added support for greasemonkey
  2. deleted comments no longer break everything (hopefully)
  3. fixed the timestamps on deleted comments (because someone didn't test a last-minute change (I'm someone))
  4. added keyboard support (replaced mouseup with onclick whoops), removed 0 comment check (it now sends a request whenever you check comments since comments can be added after the page loads), and made it only check for new posts when the page updates instead of every second
  5. made comments link to the post instead of to the current page, removed the extra space added when there are no comments, and prevented the script from running on single post pages
  6. added a toggle in the code for absolute/relative links (whether the links only move the page or go to the original post then move the page); the default is relative links
  7. security fix (reverted to innerText bc the input wasn't getting sanitized oops)
  8. added support for light on dark mode
  9. fixed the css again (changes in the site's css broke everything but now styling on individual posts work :D)

You must log in to comment.

in reply to @cefqrn's post:

oh yeah I think @blep did something like that with the cohost plus userscript

but I gave up on trying to understand that then tried updating every time the document updated with a MutationObserver but couldn't get that to work because of the preloaded posts

so I just ended up checking all the posts every second

and

well

I mean it works

edit: it now uses a mutationobserver

is the entire thing not running (the black arrow in the image isn't appearing anywhere on the home page) or is it just not displaying the comments?

looking at the code I think the most recent thing it uses is Intl.RelativeTimeFormat which requires chrome 71+ or firefox 65+

but other than that, an error message from the console would be helpful in finding where it's breaking

the arrow is shown but it doesn't open up when I click on it. I get TypeError: /api/v1/trpc/posts.singlePost?batch=1&input={"0":{"handle":"shel","postId":1440645}} is not a valid URL. in the console instead

i'm using firefox

yeah currently it's just shoving the comment into an innerText
i'd planned on trying to parse a bit of it before i realized i'd also have to sanitize the input which aaaaa