Remove Favorite Hotkey

Allows you to press g (or another key) to remove favorites from the post page.

Stan na 04-08-2024. 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         Remove Favorite Hotkey
// @version      1
// @description  Allows you to press g (or another key) to remove favorites from the post page.
// @author       Yoboies
// @match        https://rule34.xxx/index.php?page=post&s=view&id=*
// @match        https://rule34.xxx/index.php?page=favorites&s=view&id=*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=rule34.xxx
// @grant        GM.getValue
// @grant        GM.setValue
// @license      MIT
// @namespace https://greasyfork.org/users/1345312
// ==/UserScript==

(async function() {
    'use strict';
    if(location.href.indexOf('https://rule34.xxx/index.php?page=post') == 0){
        var hotkey = "KeyG";  //REPLACE WITH WHATEVER KEY WORKS FOR YOU

        document.addEventListener('keydown', keyPress);

        function keyPress(e) {
            if(e.code==hotkey){
                var oldURL = location.href;
                var newURL = oldURL.replace('page=post&s=view','page=favorites&s=delete');
                GM.setValue('id',Date.now() + '\n' + oldURL);
                document.location.href = newURL;
            }
        }

    } else if (location.href.indexOf('https://rule34.xxx/index.php?page=favorites') == 0){
        var ID = await GM.getValue('id', '');
        if(ID && Date.now() - ID.split('\n')[0] < 1*1000){
            ID = ID.split('\n')[1];
            document.location.href = ID;
        }
    }
})();