Fixed sort:score Button

Fixed version of the sort:score button

Stan na 05-10-2022. Zobacz najnowsza wersja.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name        Fixed sort:score Button
// @namespace   Violentmonkey Scripts
// @version     1
// @author      usnkw, hetisnietgay
// @description Fixed version of the sort:score button
// @license MIT
// @match       *://rule34.xxx/*
// ==/UserScript==
// Don't need so many comments, it's clear what we're doing

// Removed on ready/load call since grease/violent/tampermonkey
// scripts are executed on DOMContentLoaded

(() => {
    'use strict';

     // Create our button
    var newButton = document.createElement("Button");
    newButton.innerHTML = "sort:score";
    newButton.style.cursor = "pointer";

    // Better not to use inline events
    newButton.addEventListener('click', (e) => {

        var searchField = document.getElementsByName("tags")[0];

        if (searchField.value.toLowerCase().indexOf("sort:score") == -1) {
            searchField.value += " sort:score"
        }

        e.preventDefault();
    });

    // Search box has class awesomplete, add our button after it
    document.getElementsByClassName("awesomplete")[0].appendChild(newButton);

})();