[Userscript] Search Sorting Fixer [0.4.10]

Started by St@SyaN
Posted
5 replies
Login to subscribe to responses
St@SyaN's avatar
Posts: 680
St@SyaN
Artist
Perfect Pony Plot Provider - Uploader of 10+ images with 350 upvotes or more (Questionable/Explicit)
Birthday Cake - Celebrated MLP's 7th birthday
Magnificent Metadata Maniac
Equality - In our state, we do not stand out.
The Power of Love - Given to a publicly verified artist with an image under their artist’s tag that has reached 1000 upvotes
Cool Crow - "Caw!" An awesome tagger
Economist
Fine Arts - Two hundred uploads with a score of over a hundred (Safe/Suggestive)
Best Artist - Providing quality, Derpibooru-exclusive artwork

Site Moderator
Well, as most of all knows, if we search for something with sorting which isn’t default id sorting, we will have a something strange, when trying to navigate previous/next between pictures.

Demo video

So, I wrote a small userscript which fixes that. Here. You need Greasemonkey or Tampermonkey to use.

It’s STRONGLY recommended to disable Fix buttons on start option if it’s enabled! (because it makes more requests than recommended way. You still may use it, but right now it’s provided "As Is")

Settings may be adjusted directly at the script code (not recommended) or with YourBooru:Settings (direct link). Since 0.3.13 YDB:Settings is included, so you don’t need to install second userscript manualy.

Note, that script sorts images in a little different way than site does, it may lead to differences between site’s search responses and navigation in vague cases (e.g. equal scores).


How scripts interacts with sortings:
*. Default id sorting (Upload date) — even in it’s not THAT neat (use manual workaround for that), does not change anything at all;
*. Last modified — navigation is glitchy and not fixed, attempting to find leads to switching to "upload date". Too dynamic for relatively slow thing.
*. Initial post date (aka first_seen_at) — fixed both navigation and finding.
*. Score — right now site is able to navigate here by itself, but if you vote on image, you may accidentally go to the "second lap". Script works in a bit different way and it doesn’t cause "second laps" because of this. And finding, yeah.
*. Wilson score — nothing, no search terms right now.
*. Relevance — seems too much complicated.
*. Width/height/comments — both navigation and finding, but can be disabled, since site works fine there.
*. Tag count — should work with both things. Btw, site is fine here.
*. Galleries — while it can be ridiculously slow, supported, since site is still glitching with some galleries. Finding also should work.
*. Random — well, it takes an absolutely random image. Attempting to find leads to "upload date".


Since 0.2 script also fixes ’find’ button: you will find an image in your current query with current sorting (only if sorted by score, width/height, comments. Elsewhere it uses default id sorting). You may disable some in settings as well.

Since 0.1.3, script’s behaviour may be choosen between ’preloading’ (which one was default) and not ’preloading’ (for find button this is the only possible behaviour due to complexivity and rare using).
If preloading, script will try to fix links as soon, as possible. Pros: less waiting after clicking; elements has adequate link with which you may do everything. Cons: more requests, even if you don’t wanna navigate; fast navigation may broke usersript.
If not preloading, script will fix link only when you click on it. Pros: fast navigation will work correctly; you still have original link. Cons: there could be a big delay after clicking; no way to open fixed link in new tab.

And that’s all.

There is no screenshots, because userscript doesn’t change UI at all because. Look at video.
St@SyaN's avatar
Posts: 680
St@SyaN
Artist
Perfect Pony Plot Provider - Uploader of 10+ images with 350 upvotes or more (Questionable/Explicit)
Birthday Cake - Celebrated MLP's 7th birthday
Magnificent Metadata Maniac
Equality - In our state, we do not stand out.
The Power of Love - Given to a publicly verified artist with an image under their artist’s tag that has reached 1000 upvotes
Cool Crow - "Caw!" An awesome tagger
Economist
Fine Arts - Two hundred uploads with a score of over a hundred (Safe/Suggestive)
Best Artist - Providing quality, Derpibooru-exclusive artwork

Site Moderator
Probably, there is a final version of the script.
*. Fixed random sorting and random button queries;
*. Added blinking when link is generated.
Posted Report
St@SyaN's avatar
Posts: 680
St@SyaN
Artist
Perfect Pony Plot Provider - Uploader of 10+ images with 350 upvotes or more (Questionable/Explicit)
Birthday Cake - Celebrated MLP's 7th birthday
Magnificent Metadata Maniac
Equality - In our state, we do not stand out.
The Power of Love - Given to a publicly verified artist with an image under their artist’s tag that has reached 1000 upvotes
Cool Crow - "Caw!" An awesome tagger
Economist
Fine Arts - Two hundred uploads with a score of over a hundred (Safe/Suggestive)
Best Artist - Providing quality, Derpibooru-exclusive artwork

Site Moderator
0.2
– navigation may be patched when clicking on the links, not when page loaded (see the first post for details);
– find button may be ’fixed’ too.

About find. Let’s imagine, that we viewing that image, while looking for safe not animated image sorted by score


If we click ’Find’ with no userscript, query will be lost


But if find patching enabled (and we waited for a few seconds), query will be saved

That place in center is cursed
St@SyaN's avatar
Posts: 680
St@SyaN
Artist
Perfect Pony Plot Provider - Uploader of 10+ images with 350 upvotes or more (Questionable/Explicit)
Birthday Cake - Celebrated MLP's 7th birthday
Magnificent Metadata Maniac
Equality - In our state, we do not stand out.
The Power of Love - Given to a publicly verified artist with an image under their artist’s tag that has reached 1000 upvotes
Cool Crow - "Caw!" An awesome tagger
Economist
Fine Arts - Two hundred uploads with a score of over a hundred (Safe/Suggestive)
Best Artist - Providing quality, Derpibooru-exclusive artwork

Site Moderator
I added one small ^ button around top search field. I still didn’t explain, what exactly it does:

That one

First of all, if you hover search bar you will notice that dropdown menus. It’s affects at vanilla search too, you may search by score without opening separate search page.


Before we use that ^ button, there is also one thing at tags.


Set query option replaces value in search bar with tag value. [+] appends tag value to the end.

Clicking Set query under Rainbow dash tag and [+] under safe leads to this.


We browsed that image. After we clicked ^, image is still the same, but with different search value, and now we will navigate through different stream of pictures. Or we may try to find a position of image in different case.
St@SyaN's avatar
Posts: 680
St@SyaN
Artist
Perfect Pony Plot Provider - Uploader of 10+ images with 350 upvotes or more (Questionable/Explicit)
Birthday Cake - Celebrated MLP's 7th birthday
Magnificent Metadata Maniac
Equality - In our state, we do not stand out.
The Power of Love - Given to a publicly verified artist with an image under their artist’s tag that has reached 1000 upvotes
Cool Crow - "Caw!" An awesome tagger
Economist
Fine Arts - Two hundred uploads with a score of over a hundred (Safe/Suggestive)
Best Artist - Providing quality, Derpibooru-exclusive artwork

Site Moderator
Since today (probably) Derpibooru shouldn’t lag with navigation anymore. You may turn this part off in userscript settings, since vanilla work faster.
Posted Report
St@SyaN's avatar
Posts: 680
St@SyaN
Artist
Perfect Pony Plot Provider - Uploader of 10+ images with 350 upvotes or more (Questionable/Explicit)
Birthday Cake - Celebrated MLP's 7th birthday
Magnificent Metadata Maniac
Equality - In our state, we do not stand out.
The Power of Love - Given to a publicly verified artist with an image under their artist’s tag that has reached 1000 upvotes
Cool Crow - "Caw!" An awesome tagger
Economist
Fine Arts - Two hundred uploads with a score of over a hundred (Safe/Suggestive)
Best Artist - Providing quality, Derpibooru-exclusive artwork

Site Moderator
Implemented navigation for "first_seen_at" sorting. It should be enabled by default, if not, visit settings.
Posted Report
Interested in advertising on Derpibooru? Click here for information!
Pony Arts & Prints!

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~