Patreon to Kemono Redirect

Redirect Patreon to Kemono

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Patreon to Kemono Redirect
// @namespace    https://kemono.cr/
// @version      1.0.3
// @description  Redirect Patreon to Kemono
// @match        https://www.patreon.com/*
// @match        https://patreon.com/*
// @run-at       document-end
// ==/UserScript==

(() => {
  const excluded = ['/settings', '/home', '/explore', '/messages'];
  const path = window.location.pathname;
  if (excluded.some(p => path.startsWith(p))) return;

  const cwpage = path === '/cw' || path.startsWith('/cw/');
  const regex = cwpage
    ? /https:\/\/www\.patreon\.com\/api\/user\/(\d+)/
    : /"related":"https:\/\/www\.patreon\.com\/api\/user\/(\d+)"/;

  const match = document.documentElement.innerHTML.match(regex);
  if (!match) return;

  const button = document.createElement('a');
  button.href = `https://kemono.cr/patreon/user/${match[1]}`;
  button.target = '_blank';
  button.textContent = 'Kemono';
  Object.assign(button.style, {
    position: 'fixed',
    top: '1rem',
    left: '50%',
    transform: 'translateX(-50%)',
    background: '#d19b83',
    color: '#fff',
    fontWeight: '700',
    fontSize: '14px',
    padding: '10px 18px',
    borderRadius: '999px',
    zIndex: 99999,
    textDecoration: 'none',
    boxShadow: '0 4px 12px rgba(0,0,0,.35)'
  });
  document.body.appendChild(button);
})();