Niji-gazo Multi Buttons

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

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

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