And now want to share with people because why not? It's for a Firefox plugin greasemonkey, but I guess it should work on any analogs that also inject jawascript in other browsers without a fuss.
First script is for ease of navigating pools with the keyboard arrows - I made it to read comics here easier.
// ==UserScript==
// @name e621
// @version 1
// @grant none
// @include http://e621.net*
// @include https://e621.net*
// ==/UserScript==
var poolpage = document.getElementsByClassName("pool-nav")[0];
var prevpage, nextpage
prevpage = poolpage.getElementsByClassName("prev")[0];
nextpage = poolpage.getElementsByClassName("next")[0];
if (prevpage !=null || nextpage != null)
{
document.addEventListener
('keydown', function(e)
{
if (document.activeElement.classList.contains("ui-autocomplete-input"))
{
}
else
{
switch (e.keyCode)
{
case 39:
if (nextpage !=null)
{
if (nextpage.getAttribute('href') !=null)
{
window.location.href = nextpage.getAttribute('href')+'#image';
}
}
break;
case 37:
if (prevpage !=null)
{
if (prevpage.getAttribute('href') !=null)
{
window.location.href = prevpage.getAttribute('href')+'#image';
}
}
break;
}
}
}
);
}Second adds some shortcut links below the search window - sort results by score, and filter by minimal score.
// ==UserScript==
// @name e621
// @version 1
// @grant none
// @include http://e621.net*
// @include https://e621.net*
// ==/UserScript==
//Which ratings shortcuts to add
const ratingLevels = [1,25,100,250,500]
var navbar, newElement;
navbar = document.getElementById("search-box");
addbuts = document.getElementById("custom_tagging");
if (navbar) {
if (addbuts) {} else {
addbuts = document.createElement("div");
addbuts.setAttribute('id', "custom_tagging");
thisURL = window.location.href.split("tags=");
if (thisURL.length > 1)
{
thisURL[0] = thisURL[0].split("page=")[0] + "tags=";
thisURL[1] = "+" + thisURL[1];
}
else{
thisURL[0] = thisURL[0] + "+";
thisURL[1] = " ";
}
if (!thisURL[1].includes("order%3Ascore"))
{
addRatingSort = document.createElement("a");
newContent = document.createTextNode("Sort by rating");
addRatingSort.setAttribute('href', thisURL[0] + "order%3Ascore" + thisURL[1]);
addRatingSort.appendChild(newContent);
addbuts.appendChild(addRatingSort);
addbuts.appendChild(document.createElement("br"));
}
ratingLevels.forEach(CreateFilterLink)
navbar.parentNode.insertBefore(addbuts, navbar.nextSibling);
}
}
function CreateFilterLink(item) {
var restOfTags = thisURL[1].replace(/score%3(a|A)(>|%3(E|e))([1-9][0-9][0-9]|[1-9][0-9]|[0-9])(\+)?/g,'');
addRatingfilt = document.createElement("a");
newContent = document.createTextNode("Filter score +"+item);
addRatingfilt.setAttribute('href', thisURL[0] + "score%3a>"+item + restOfTags);
addRatingfilt.appendChild(newContent);
addbuts.appendChild(addRatingfilt);
addbuts.appendChild(document.createElement("br"));
}
Hope this will be of use to anybody. :3
Updated