AO3: No Re-Kudos

Hide kudos button if you've already left kudos

目前為 2025-10-05 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         AO3: No Re-Kudos
// @version      1
// @author       BlackCatBat
// @license      MIT
// @description  Hide kudos button if you've already left kudos
// @match        *://archiveofourown.org/works/*
// @match        *://archiveofourown.org/chapters/*
// @grant        none
// @namespace https://greasyfork.org/users/1498004
// ==/UserScript==

(function() {
    'use strict';

    // Get work ID from URL
    const workIdMatch = window.location.pathname.match(/\/(works|chapters)\/(\d+)/);
    if (!workIdMatch) return;
    const workId = workIdMatch[2];

    // Check if we've already given kudos to this work
    const kudosHistory = JSON.parse(localStorage.getItem('ao3_no_rekudos_config') || '{}');

    if (kudosHistory[workId]) {
        // Hide the kudos button immediately
        const kudoButton = document.getElementById('kudo_submit');
        if (kudoButton) {
            kudoButton.style.display = 'none';
        }
    } else {
        // Set up click listener to record when kudos is given
        const kudoButton = document.getElementById('kudo_submit');
        if (kudoButton) {
            kudoButton.addEventListener('click', function() {
                // Record that we've given kudos to this work
                const kudosHistory = JSON.parse(localStorage.getItem('ao3_no_rekudos_config') || '{}');
                kudosHistory[workId] = true;
                localStorage.setItem('ao3_no_rekudos_config', JSON.stringify(kudosHistory));
                
                // Hide the button
                this.style.display = 'none';
            });
        }
    }
})();