[Extension] Velvet, a Chrome Extension to ease Derpibooru's browsing

Nolax
Solar Supporter - Fought against the New Lunar Republic rebellion on the side of the Solar Deity (April Fools 2023).
Wallet After Summer Sale -
Ruby -
Not a Llama - Happy April Fools Day!
Happy Derpy! -
Bronze Supporter -

Pony stalker
Hi there !
 
Before permabanning me into Tartarus, please know that I don’t know if I’m doing this correctly, since I never come to this part of the website. I don’t know if I’m crossing a line I don’t see by posting this or proposing my extension, so please tell me if I do so. :)
 
I recently spent some time doing a little something with Javascript in order to create a Chrome extension to ease Derpibooru’s browsing. For example, it took me a while to find how to order posts by score, and I just saw topics asking this question. An example of what my extension is able to do is that you’ll only have to use the tag SCORE as any other tag, and it will do its magic.
 
My creation is called Velvet. It’s primary goal was to be able to quickly add tags to the query : you almost always add “cute AND fluffy” to your request ? Either you type it or copy/paste it everytime you search for something, or you just click on a neat button located near the search bar and voilà ! Automatically added, and the query’s sent ! (note that if you don’t want this functionnality, just leave the field empty and Velvet’s button will disappear)
 
I then added aliases, so that you could create your own tags that mean something to you (for example, to be able to type “feathercute” instead of “(pegasus OR gryphon) AND cute AND fluffy”). Finally, the last thing it can do is order the posts with a single tag : I’ve added uppercase tags such as SCORE or COMMENTS that are automatically processed by Velvet and removed from the query to keep it functional. I find it pretty neat.
 
So here I am, presenting you my work. It’s not much, but I think that if it could help at least a few people, I’d be happy. I am open to suggestion, so if you’d like to say anything to me, just PM me please :) You can make suggestions and reports if it doesn’t work properly.
 
Please note that since I’m the only user for now, I probably didn’t find every bug there is. If you find some, please let me know.
 
Here’s the link. Once you install it, it should show you where its settings are. They are in fact with Derpibooru’s, in a nice new tab.
 
Hope you like it ! <3
Nolax
Solar Supporter - Fought against the New Lunar Republic rebellion on the side of the Solar Deity (April Fools 2023).
Wallet After Summer Sale -
Ruby -
Not a Llama - Happy April Fools Day!
Happy Derpy! -
Bronze Supporter -

Pony stalker
Here’s the GitHub. I’m sorry about all the french commits, I started doing them this way without thinking. I can translate them if you’d like me to.
 
Please tell me if you have any comment about my work. It’s a bit messy, sorry about that
Nolax
Solar Supporter - Fought against the New Lunar Republic rebellion on the side of the Solar Deity (April Fools 2023).
Wallet After Summer Sale -
Ruby -
Not a Llama - Happy April Fools Day!
Happy Derpy! -
Bronze Supporter -

Pony stalker
@byte[]  
No problem, I didn’t mean to put you under stress, I just felt a bit sad that no one seemed interested in it. Thank you for your time
Nolax
Solar Supporter - Fought against the New Lunar Republic rebellion on the side of the Solar Deity (April Fools 2023).
Wallet After Summer Sale -
Ruby -
Not a Llama - Happy April Fools Day!
Happy Derpy! -
Bronze Supporter -

Pony stalker
@byte[]  
Thank you very much for your time and tips. I already read them, and would have one or two questions. You see, I made an apprenticeship in computer science, but Javascript wasn’t really part of the cursus, so I’m pretty much a newbie in JS. I’d like to better myself though
SkiesOfJadedLight

I didn’t know this existed, so finding it was awesome. However, I was working on my own version in Tampermonkey, and after looking through your code, you’re missing one useful feature that I included, and had two edge case points of failure. I opened issues on the tracker about them.
 
The only other thing I would request is a better editor. My version used a custom-written jQuery widget I called “multifield” to create an extendable and sortable list of two text inputs per row. Each row was another replacement; the first inputbox was the alias name, the second was the expansion. It was quick and easy to see what expanded to what. Maybe instead of splitting on ; you could split on line breaks? One alias per line sounds easier to skim through to see what I have defined.
SkiesOfJadedLight

@fandechimie  
I have no experience with (or knowledge of) chrome extensions, so I don’t even know how you’d get jQuery/jQueryUI on the page. If you can figure that out, I can probably help you use it to do stuff like that. For instance, I’m writing a combobox widget for jQueryUI right now. It’s basically an autocomplete widget (jQueryUI official demo page), except it adds a button that lets you view all autocomplete suggestions, and can handle multiple values in the input. After this, I’ll probably go back to overhauling my old script for the challenge of it, but at some point I intend to rewrite my multifield plugin, which basically makes a variable-size list of re-orderable text input fields. That might be useful. In the meantime, you can still split the textarea on line breaks to separate aliases.
 
Also, TBH, the way you did it looks much more like a feature of the actual site than my multifield widget.
Nolax
Solar Supporter - Fought against the New Lunar Republic rebellion on the side of the Solar Deity (April Fools 2023).
Wallet After Summer Sale -
Ruby -
Not a Llama - Happy April Fools Day!
Happy Derpy! -
Bronze Supporter -

Pony stalker
@SkiesOfJadedLight  
Actually, I initially thought about reusing the magicbox of the website which allows you to type the beginning of a tag and get existing tags corresponding, but I couldn’t manage to do it without breaking my code or the magicbox’s.  
With Chrome extensions, I can inject files in specific pages, so I can for example inject a jQuery.js in the page before my script.
 
EDIT : aaaaand it’s done ! Velvet 1.1 should be available in a couple of hours ! With even more coolness <3
Interested in advertising on Derpibooru? Click here for information!
Ministry of Image - Fanfiction Printing

Help fund the $15 daily operational cost of Derpibooru - support us financially!

Syntax quick reference: **bold** *italic* ||hide text|| `code` __underline__ ~~strike~~ ^sup^ %sub%

Detailed syntax guide