Niji-gazo Multi Buttons

love, love-list, closeボタンを右下に固定表示

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

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

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         Niji-gazo Multi Buttons
// @namespace    http://tampermonkey.net/
// @version      1.2
// @description  love, love-list, closeボタンを右下に固定表示
// @match        https://niji-gazo.com/*
// @grant        none
// @author       Kdroidwin  
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    function createFixedButtons() {
        // 元のボタンを取得
        const closeBtn = document.querySelector('button.pswp__button.pswp__button--close');
        const loveListBtn = document.querySelector('li.icon.love-list.right');
        const loveBtn = document.querySelector('li.icon.love.add-album-item.right');

        if (!closeBtn && !loveListBtn && !loveBtn) return;

        // コンテナ作成
        const container = document.createElement('div');
        container.style.position = 'fixed';
        container.style.bottom = '20px';
        container.style.right = '20px';
        container.style.zIndex = '9999';
        container.style.display = 'flex';
        container.style.gap = '10px'; // ボタン間の間隔

        // closeボタンコピー
        if (closeBtn) {
            const closeClone = closeBtn.cloneNode(true);
            closeClone.style.cursor = 'pointer';
            closeClone.addEventListener('click', e => {
                e.preventDefault();
                closeBtn.click();
            });
            container.appendChild(closeClone); // 左端
        }

        // love-listボタンコピー
        if (loveListBtn) {
            const loveListClone = loveListBtn.cloneNode(true);
            loveListClone.style.cursor = 'pointer';
            loveListClone.addEventListener('click', e => {
                e.preventDefault();
                loveListBtn.click();
            });
            container.appendChild(loveListClone);
        }

        // loveボタンコピー
        if (loveBtn) {
            const loveClone = loveBtn.cloneNode(true);
            loveClone.style.cursor = 'pointer';
            loveClone.addEventListener('click', e => {
                e.preventDefault();
                loveBtn.click();
            });
            container.appendChild(loveClone); // 右端
        }

        document.body.appendChild(container);
    }

    window.addEventListener('load', createFixedButtons);
})();