MAL Title Copy Button

MyAnimeList anime sayfasına, başlığı tek tıkla kopyalamak için buton ekler.

当前为 2025-08-02 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        MAL Title Copy Button
// @namespace   https://greasyfork.org/en/users/1500762-kerimdemirkaynak
// @match       https://myanimelist.net/anime/*
// @run-at      document-end
// @version     1.0.
// @license     MIT
// @description MyAnimeList anime sayfasına, başlığı tek tıkla kopyalamak için buton ekler.
// ==/UserScript==

(function () {
  "use strict";

  function addCopyButton() {
    if (document.querySelector("#mal-copy-title-btn")) return;

    const titleElement =
      document.querySelector("h1.title-name") ||
      document.querySelector("h1.title");

    if (!titleElement) return;

    const pageTitleContainer =
      titleElement.closest(".page-title") || titleElement.parentElement;
    if (!pageTitleContainer) return;

    const btn = document.createElement("button");
    btn.id = "mal-copy-title-btn";
    btn.innerText = "📋 Başlığı Kopyala";
    btn.style.fontSize = "13px";
    btn.style.padding = "4px 10px";
    btn.style.marginTop = "8px";
    btn.style.marginLeft = "10px";
    btn.style.border = "1px solid #3498db";
    btn.style.background = "white";
    btn.style.borderRadius = "4px";
    btn.style.cursor = "pointer";
    btn.style.transition = "all 0.2s ease";

    btn.addEventListener("mouseover", () => {
      btn.style.backgroundColor = "#3498db";
      btn.style.color = "white";
    });
    btn.addEventListener("mouseout", () => {
      btn.style.backgroundColor = "white";
      btn.style.color = "black";
    });

    btn.addEventListener("click", () => {
      const titleText = titleElement.innerText.trim();
      navigator.clipboard.writeText(titleText).then(() => {
        btn.innerText = "✅ Kopyalandı!";
        setTimeout(() => (btn.innerText = "📋 Başlığı Kopyala"), 1500);
      });
    });

    pageTitleContainer.appendChild(btn);
  }

  const observer = new MutationObserver(addCopyButton);
  observer.observe(document.body, { childList: true, subtree: true });
  addCopyButton();
})();