FanPass Btn

Adds button to redirect OnlyFans,Fansly,Candfans to Coomer with enhancement

当前为 2024-10-26 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name FanPass Btn
  3. // @version 1.2
  4. // @description Adds button to redirect OnlyFans,Fansly,Candfans to Coomer with enhancement
  5. // @namespace https://greasyfork.org/en/users/1333430
  6. // @match https://onlyfans.com/*
  7. // @match https://coomer.su/*
  8. // @match https://fansly.com/*
  9. // @match https://candfans.jp/*
  10. // @grant GM_openInTab
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. // Function to handle redirection
  17. function redirect(username, service) {
  18. const coomerUrl = `https://coomer.su/${service}/user/${username}`;
  19. GM_openInTab(coomerUrl, { active: true });
  20. }
  21.  
  22. function createRedirectButton(username, service) {
  23. const button = document.createElement('button');
  24. button.innerHTML = `<img src="https://coomer.su/favicon.ico" style="width: 24px; height: 24px; display: block; margin: auto;">`;
  25. button.className = 'redirect-button';
  26. button.addEventListener('click', () => redirect(username, service));
  27. document.body.appendChild(button);
  28. }
  29.  
  30. // Add styles for the button and main content adjustment
  31. const style = document.createElement('style');
  32. style.textContent = `
  33. .redirect-button {
  34. position: fixed;
  35. top: 20px;
  36. right: 20px;
  37. z-index: 9999;
  38. border: none;
  39. border-radius: 50%;
  40. background-color: rgba(105, 105, 105, 0.7);
  41. width: 50px;
  42. height: 50px;
  43. padding: 10px;
  44. box-sizing: border-box;
  45. cursor: pointer;
  46. }
  47. .shifted.content-wrapper.full-width {
  48. width: 100% !important;
  49. margin-left: 0 !important;
  50. }
  51. .post-card {
  52. border-radius: 10px !important;
  53. overflow: hidden;
  54. }
  55. .post-card__image-container {
  56. overflow: visible;
  57. }
  58. .post-card__image {
  59. transition: transform 0.3s ease, box-shadow 0.3s ease;
  60. }
  61. .post-card__image-container:hover .post-card__image {
  62. transform: scale(1.1);
  63. box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  64. }
  65. .post-card.post-card--preview {
  66. transform: scale(1.2);
  67. margin: 20px;
  68. transition: transform 0.3s ease, box-shadow 0.3s ease;
  69. backface-visibility: hidden;
  70. perspective: 1000px;
  71. }
  72. .post-card.post-card--preview:hover {
  73. transform: scale(1.3);
  74. box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  75. }
  76. .ad-banner, .ad-container, .banner, .advertisement {
  77. display: none !important;
  78. }
  79. .post__nav-links {
  80. position: sticky;
  81. top: 50%;
  82. display: flex;
  83. justify-content: space-between;
  84. align-items: center;
  85. width: 100%;
  86. z-index: 1000;
  87. transform: translateY(-50%);
  88. }
  89. .post__nav-item {
  90. flex: 1;
  91. text-align: center;
  92. font-size: 130%;
  93. }
  94. .post__nav-item.subtitle {
  95. font-size: 130%;
  96. position: absolute;
  97. left: 20%;
  98. }
  99. .post__nav-item a {
  100. text-decoration: none;
  101. color: inherit;
  102. font-size: 130%;
  103. }
  104. .post__nav-item.previous {
  105. position: absolute;
  106. left: 20%;
  107. }
  108. .post__nav-item.next {
  109. position: absolute;
  110. right: 20%;
  111. }
  112. .glow {
  113. animation: glow 1.5s infinite alternate;
  114. }
  115. @keyframes glow {
  116. 0% {
  117. text-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 15px #fff, 0 0 20px #ff00ff, 0 0 25px #ff00ff, 0 0 30px #ff00ff, 0 0 35px #ff00ff;
  118. }
  119. 50% {
  120. text-shadow: 0 0 10px #fff, 0 0 15px #fff, 0 0 20px #fff, 0 0 25px #ff00ff, 0 0 30px #ff00ff, 0 0 35px #ff00ff, 0 0 40px #ff00ff;
  121. }
  122. 100% {
  123. text-shadow: 0 0 15px #fff, 0 0 25px #fff, 0 0 35px #fff, 0 0 45px #ff00ff, 0 0 55px #ff00ff, 0 0 65px #ff00ff, 0 0 75px #ff00ff;
  124. }
  125. }
  126. `;
  127. document.head.appendChild(style);
  128.  
  129. function hideSidebar() {
  130. const sidebar = document.querySelector('.global-sidebar');
  131. if (sidebar) {
  132. sidebar.remove();
  133. }
  134. }
  135.  
  136. function removeMatrixBanner() {
  137. const matrixBanner = document.querySelector('a[href="https://coomer.su/matrix"]');
  138. if (matrixBanner) {
  139. matrixBanner.remove();
  140. }
  141. }
  142.  
  143. function moveNavElement() {
  144. const navElements = document.querySelectorAll('.post__nav-links');
  145. const postBodyElement = document.querySelector('.post__body');
  146. navElements.forEach(navElement => {
  147. const previousItem = navElement.querySelector('.post__nav-link.prev') || navElement.querySelector('.post__nav-item.subtitle');
  148. if (previousItem) {
  149. previousItem.innerHTML = '←';
  150. previousItem.parentElement.classList.add('previous', 'glow');
  151. }
  152. const nextItem = navElement.querySelector('.post__nav-link.next');
  153. if (nextItem) {
  154. nextItem.innerHTML = '→';
  155. nextItem.parentElement.classList.add('next', 'glow');
  156. }
  157. postBodyElement.insertBefore(navElement, postBodyElement.firstChild);
  158. });
  159. }
  160.  
  161. if (window.location.href.includes('onlyfans.com')) {
  162. const profileMatch = window.location.href.match(/https:\/\/onlyfans.com\/([^/]+)/);
  163. if (profileMatch) {
  164. const username = profileMatch[1];
  165. createRedirectButton(username, 'onlyfans');
  166. }
  167. }
  168.  
  169. if (window.location.href.includes('fansly.com')) {
  170. (async () => {
  171. let userID = null;
  172. const profileMatch = window.location.href.match(/https:\/\/fansly.com\/([^/]+)/);
  173. if (profileMatch) {
  174. const userName = profileMatch[1];
  175. if (userName) {
  176. const res = await fetch(`https://apiv3.fansly.com/api/v1/account?usernames=${userName}&ngsw-bypass=true`);
  177. const data = await res.json();
  178. userID = data?.response?.[0]?.id ?? null;
  179. }
  180. if (userID) {
  181. createRedirectButton(userID, 'fansly');
  182. }
  183. }
  184. })();
  185. }
  186.  
  187. if (window.location.href.includes('candfans.jp')) {
  188. const processedUserIds = new Set();
  189. const observer = new MutationObserver(() => {
  190. document.querySelectorAll('img[data-src]').forEach((imgElement) => {
  191. const userID = imgElement.getAttribute('data-src')?.match(/user\/(\d+)\//)?.[1];
  192. if (userID && !processedUserIds.has(userID)) {
  193. createRedirectButton(userID, 'candfans');
  194. processedUserIds.add(userID);
  195. }
  196. });
  197. });
  198. observer.observe(document.body, { childList: true, subtree: true });
  199. }
  200.  
  201. if (window.location.href.includes('coomer.su')) {
  202. removeMatrixBanner();
  203. if (window.location.href.includes('coomer.su/onlyfans/user') ||
  204. window.location.href.includes('coomer.su/fansly/user') ||
  205. window.location.href.includes('coomer.su/candfans/user')) {
  206. hideSidebar();
  207. const mainContent = document.querySelector('.shifted.content-wrapper');
  208. if (mainContent) {
  209. mainContent.classList.add('full-width');
  210. }
  211. const imageContainers = document.querySelectorAll('.post-card.post-card--preview');
  212. imageContainers.forEach(container => {
  213. container.style.transform = 'scale(1.2)';
  214. container.style.margin = '20px';
  215. container.style.transition = 'transform 0.3s ease, box-shadow 0.3s ease';
  216. container.style.backfaceVisibility = 'hidden';
  217. container.style.perspective = '1000px';
  218. container.addEventListener('mouseover', () => {
  219. container.style.transform = 'scale(1.3)';
  220. container.style.boxShadow = '0 4px 8px rgba(0, 0, 0, 0.2)';
  221. });
  222. container.addEventListener('mouseout', () => {
  223. container.style.transform = 'scale(1.2)';
  224. container.style.boxShadow = 'none';
  225. });
  226. });
  227. }
  228. }
  229.  
  230. window.addEventListener('load', () => {
  231. const links = document.querySelectorAll('a.image-link');
  232. links.forEach(link => {
  233. link.addEventListener('click', (event) => {
  234. event.preventDefault();
  235. window.open(link.href, '_blank');
  236. });
  237. });
  238. moveNavElement();
  239. });
  240. })();