[Userscript] Group/Hide similar images on a page

Rene_Z
My Little Pony - 1992 Edition
Wallet After Summer Sale -
Not a Llama - Happy April Fools Day!
Artist -

Introduction
This userscript groups image thumbnails of similar images together to one thumbnail with a button to toggle all the other images in a group. For example, this is useful when multiple variants of the same image or similar images by the same artist are uploaded shortly in succession.
Example: Without userscript

With userscript


Details
Only images with the same artist(s) are grouped. The similarity is obviously calculated from the images' tags, therefore it will be less accurate for images with few tags. Of course the amount of images per page doesn't change, therefore you won't any see more images than before. The benefit is that the page isn't cluttered by multiple thumbnails of the same image.

You can configure several aspects of the script:
Exclude images without artists: Don't group images without artist. (Default: false)
Tresholds: How similar the images should be to be grouped. If set to 0, all images by the same artist(s) are grouped. (Default: 0.7, 0.5, 0.5)
Adjust for tagcount: Apply fancy mathematics to (hopefully) compensate for under- and overtagged images. (Default: true)
Disable on artist tag pages: Don't group images on /tags/artist:… pages. This is useful when you set the treshold to 0 to avoid grouping all images on that page. (Default: false)
Weights: Different tags and tag namespaces can have different weights that they contribute to the similarity measure. These are set by default to group images with the same characters and filter out certain tags that would skew the calculation.
Sorting: Set the sorting of images within a group. Options are: upload time (original order); score; and highest score first, then by similarity to the previous image (default)

Download
You need Greasemonkey for Firefox or Tampermonkey for Chrome (or equivalent add-ons that can load userscripts).
Download v0.5.1

Changelog
0.5.1: "Temporary" fix for expand button taking up a new row
0.5.0: Updated for Derpibooru's new design, doesn't use jQuery anymore
0.4.1: Now works with JS strict mode
0.4.0: First public release (see Gist for previous changes)

~Also check out my other userscripts: Tag suggestions, Images per page dropdown
NostalgiaSchmaltz
Perfect Pony Plot Provider - Uploader of 10+ images with 350 upvotes or more (Questionable/Explicit)
The End wasn't The End - Found a new home after the great exodus of 2012

It doesn't seem to be working. I had this script before, and it did work, but after reinstalling it, it doesn't seem to want to work, no matter what I set the thresholds to.
Rene_Z
My Little Pony - 1992 Edition
Wallet After Summer Sale -
Not a Llama - Happy April Fools Day!
Artist -

@NostalgiaSchmaltz
I just tested it in Chrome and it still works for me. One thing you can try is enable the DEBUG option, open the console with Ctrl + Shift + J and then reload the page. Then paste the output here.
NostalgiaSchmaltz
Perfect Pony Plot Provider - Uploader of 10+ images with 350 upvotes or more (Questionable/Explicit)
The End wasn't The End - Found a new home after the great exodus of 2012

Also, FWIW, when I'm on a page that has no items to be grouped, it DOES show a number at the upper-left corner of each image frame, and Chrome's debug console does not report any errors.

But when I go to a page that has more than 1 image from the same artist, the numbers stop showing and the Chrome debug console does give an error.
Rene_Z
My Little Pony - 1992 Edition
Wallet After Summer Sale -
Not a Llama - Happy April Fools Day!
Artist -

The script has been updated for the new design, and I also got rid of jQuery in the process.
The expand button has been moved into the meta bar above the thumbnail, but I might still change the design if it turns out to be too "hidden". (I also have to update the screenshots in the OP later)
Background Pony #97C6
Is it possible to have this userscript only group images if there's over a certain amount of images to be grouped?

Like if there were 3 images from the same artist, it wouldn't group, but if there were 4 or more images, it would group. Something like that.
Background Pony #479D
Question, what happens if you click on it? Do you get the option to click a specific version of the image, or are you automatically redirected to only one version?
Interested in advertising on Derpibooru? Click here for information!
Ponyvania: RP, Art, and more

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~