Remove Favorite Hotkey

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

Version vom 04.08.2024. Aktuellste Version

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

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

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

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

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

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

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.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==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;
        }
    }
})();