Niji-gazo Multi Buttons

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

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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.

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

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

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