Kemono Search Button for Patreon

Patreon author search button on Kemono

  1. // ==UserScript==
  2. // @name Kemono Search Button for Patreon
  3. // @name:ru Kemono Кнопка Поиска Для Patreon
  4. // @namespace https://github.com/Silfilia
  5. // @version 1.0.0
  6. // @description Patreon author search button on Kemono
  7. // @description:ru Кнопка поиска автора Patreon на Kemono
  8. // @author Silfilia
  9. // @homepageURL https://github.com/Silfilia/Kemono-Search-Button-for-Patreon-KSBfP-
  10. // @match https://www.patreon.com/*
  11. // @license MIT
  12. // ==/UserScript==
  13.  
  14. (function () {
  15. 'use strict';
  16.  
  17. function createKemonoButton(authorName) {
  18. if (document.querySelector('#kemono-search-button')) return;
  19.  
  20. // Remove all spaces from the author's name
  21. const safeName = authorName.replace(/\s+/g, '');
  22.  
  23. const button = document.createElement('a');
  24. button.id = 'kemono-search-button';
  25. button.textContent = 'Search on Kemono';
  26. button.href = `https://kemono.su/artists?q=${encodeURIComponent(safeName)}`;
  27. button.target = '_blank';
  28. button.style.position = 'fixed';
  29. button.style.top = '10px';
  30. button.style.left = '50%';
  31. button.style.transform = 'translateX(-50%)';
  32. button.style.padding = '8px 16px';
  33. button.style.background = 'rgba(24, 24, 24, 0.2)';
  34. button.style.backdropFilter = 'blur(8px)';
  35. button.style.borderRadius = '10px';
  36. button.style.zIndex = '9999';
  37. button.style.color = '#FFF';
  38. button.style.textcolor = 'rgb(255, 255, 255)';
  39. button.style.fontWeight = 'bold';
  40. button.style.textDecoration = 'none';
  41. button.style.transition = 'background 0.3s';
  42. button.onmouseenter = () => button.style.background = 'rgba(24, 24, 24, 0.4)';
  43. button.onmouseleave = () => button.style.background = 'rgba(24, 24, 24, 0.2)';
  44.  
  45. document.body.appendChild(button);
  46. }
  47.  
  48. function getAuthorName() {
  49. // Standard author's title
  50. const header = document.querySelector('h1#pageheader-title');
  51. if (header && header.textContent.trim()) return header.textContent.trim();
  52.  
  53. // Alternative selectors
  54. const altHeader = document.querySelector('div[data-tag="creator-name"]') ||
  55. document.querySelector('h1[class*="sc-"]');
  56. if (altHeader && altHeader.textContent.trim()) return altHeader.textContent.trim();
  57.  
  58. return null;
  59. }
  60.  
  61. function waitForAuthorAndInsertButton() {
  62. const observer = new MutationObserver(() => {
  63. const authorName = getAuthorName();
  64. if (authorName) {
  65. createKemonoButton(authorName);
  66. observer.disconnect();
  67. }
  68. });
  69.  
  70. observer.observe(document.body, { childList: true, subtree: true });
  71. }
  72.  
  73. waitForAuthorAndInsertButton();
  74. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址