[Userscript] Derpibooru Comment Enhancements 1.4.5

Marker
My Little Pony - 1992 Edition
Wallet After Summer Sale -
Magnificent Metadata Maniac - #1 Assistant
Not a Llama - Happy April Fools Day!

Misanthrope
Derpibooru Comment Preview has been renamed to
Derpibooru Comment Enhancements
due to expanded features (sorry for the confusion)

Features
Toolbar for easier comment formatting
— Highlights the comment if it's visible.
— Show comment pop-up if it's out of view.
— Shows replies that a comment has received (aka backlinks)
— On paginated comments, adds button to load next page.

Settings
Once installed, settings could be found on Derpibooru's Settings page.

Tested for several hours on Chrome and (briefly) on Firefox.

Care specially taken to ensure compatibility with VcSaJen's Namize Background Ponies, which I use everyday and can't recommend enough.

Latest update
1.4.5
— Tweaked when hover preview is displayed when comment is partially in view

1.4.0
— Add basic support for forum posts
— Autolink image embeds
— Better spoiler theme support
— User settings UI


Download
Requires Tampermonkey or Violentmonkey
Firefox users are required to install Laboratory by Mozilla and follow the instructions here.

download from GitHub
download from OpenUserJS
download from GreasyFork

Screenshots

Nittany Discord
My Little Pony - 1992 Edition
Friendship, Art, and Magic (2020) - Took part in the 2020 Community Collab
Dream Come True! - Participated in the MLP 9th Anniversary Event
Economist -
Friendship, Art, and Magic (2019) - Celebrated Derpibooru's seventh year anniversary with friends
Equality - In our state, we do not stand out.
Cool Crow - "Caw!" An awesome tagger
Friendship, Art, and Magic (2018) - Celebrated Derpibooru's six year anniversary with friends.
Birthday Cake - Celebrated MLP's 7th birthday
Artist -

Site Moderator
Dress Fanatic
Script isn't working for me anymore. I've re-installed it three times and I've tried both links. Not sure what's wrong.

Tapermonkey is up-to-date, but it doesn't want to run the script.

EDIT: Nevermind. It only works on image comments. I gathered that from the regex. Wonder if you can make it work for forum posts?
Marker
My Little Pony - 1992 Edition
Wallet After Summer Sale -
Magnificent Metadata Maniac - #1 Assistant
Not a Llama - Happy April Fools Day!

Misanthrope
New feature: On paginated comments, add additional button that will load the next batch of comments below the existing ones.
Marker
My Little Pony - 1992 Edition
Wallet After Summer Sale -
Magnificent Metadata Maniac - #1 Assistant
Not a Llama - Happy April Fools Day!

Misanthrope
About the new toolbar:
— It supports keyboard shortcut for bold, italics, underline, and spoiler tag. Additional shortcuts for other buttons can be easily implemented if people feel there’s a need for it.
— It will attempt to rewrite Derpibooru links to use relative URL e.g. "link":https://derpibooru.org/meta/"link":/meta/
— Same with images, it will try to insert them using >>9999p embeds where possible. Works with the following URLs:
@https://derpibooru.org/9999
https://derpicdn.net/img/2012/6/19/9999/large.png
https://derpicdn.net/img/view/2012/6/19/9999__safe_screencap_rainbow+dash_rarity_sonic+rainboom+%28episode%29_bad+end_ei_get_hot+air+balloon_hub+logo_index+get_repdigit+milestone_youtube+capt.png@
ZippySqrl
HARD WERK - Merited Perfect Pony Plot Provider badge with only their own art and really hates Applejack
Friendship, Art, and Magic (2020) - Took part in the 2020 Community Collab
The Magic of Friendship Grows - For helping others attend the 2020 Community Collab
Lady's Wink -
Toola Roola - For helping others attend the 2019 Community Collab
Wallet After Summer Sale -
Friendship, Art, and Magic (2019) - Celebrated Derpibooru's seventh year anniversary with friends
A Tale For The Ages - Celebrated MLP's 35th Anniversary and FiM's 8th Anniversary
Notoriously Divine Tagger - Consistently uploads images above and beyond the minimum tag requirements. And/or additionally, bringing over the original description from the source if the image has one. Does NOT apply to the uploader adding several to a dozen tags after originally uploading with minimum to bare tagging.
Magnificence - Artist with 100+ Safe/Suggestive images with over 100 upvotes, and 5+ Questionable/Explicit images with over 350 upvotes

Tired Artist
Oh, that was confusing, if you're combining the toolbar with the preview script, I'd suggest renaming it, like…
"Marker's super amazing derpibooru comment section overhaul".
Marker
My Little Pony - 1992 Edition
Wallet After Summer Sale -
Magnificent Metadata Maniac - #1 Assistant
Not a Llama - Happy April Fools Day!

Misanthrope
@zippysqrl
Yeah… you're probably right about that. Though I'm not sure if it's possible to rename the scripts on the hosting sites or to do it without breaking automatic updates.
Marker
My Little Pony - 1992 Edition
Wallet After Summer Sale -
Magnificent Metadata Maniac - #1 Assistant
Not a Llama - Happy April Fools Day!

Misanthrope
Script renamed from Derpibooru Comment Preview to Derpibooru Comment Enhancements.
OpenUserJS treated the name change as an entirely new script, existing users will need to reinstall it from the new links. Apologies for the inconvenience.
Marker
My Little Pony - 1992 Edition
Wallet After Summer Sale -
Magnificent Metadata Maniac - #1 Assistant
Not a Llama - Happy April Fools Day!

Misanthrope
Version 1.4.0
New features:
— Added basic support for forum posts: i.e. they only work on comments on the same page.
— Autolink image embeds: Don't you just hate it when someone embeds an image like
!https://derpicdn.net/img/2012/6/17/5458/thumb.jpeg!
and you have a hard time trying to get to its original page?
This feature will automatically add clickable links that essentially turns that into
!https://derpicdn.net/img/2012/6/17/5458/thumb.jpeg!:/5458
so you could easily follow the link to its source.
Also works for external images, the script will link to the original URL instead of camo.derpicdn.net version.
Images that already has a link will be unaffected.
— User settings: Some features of the script can now be turned on or off via the settings page.

Finally got off my lazy ass to fix:
— Spoiler reveal in previews doesn't take into account user's current theme.
— Spoilers can now optionally be revealed in highlighted comments (i.e. when the comment is within the viewport).
— Reply link underline works on highlighted comments.

Thank you for using Derpibooru Comment Enhancements, don't hesitate to yell at me if anything breaks.
Marker
My Little Pony - 1992 Edition
Wallet After Summer Sale -
Magnificent Metadata Maniac - #1 Assistant
Not a Llama - Happy April Fools Day!

Misanthrope
Version 1.4.5
— Hover preview is more likely to be used when comment is short and partially in view, hopefully this reduces the need for scrolling the page to read the full comment.

Previously undocumented changes since 1.4.0:
— Fix forum post navigation when 'disable_native_preview' is enabled
— Fix link highlight not working on forum posts
— Fix spoiler not revealing on external previews
Interested in advertising on Derpibooru? Click here for information!
A new adventure novel!

Derpibooru costs over $25 a day to operate - help support us financially!

Syntax quick reference: *bold* _italic_ [spoiler]hide text[/spoiler] @code@ +underline+ -strike- ^sup^ ~sub~