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.1
  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. /* Adjust main content area after removing sidebar */
  48. .shifted.content-wrapper.full-width {
  49. width: 100% !important;
  50. margin-left: 0 !important;
  51. }
  52. /* Add rounded corners to post cards */
  53. .post-card {
  54. border-radius: 10px !important;
  55. overflow: hidden; /* Ensure content doesn't overflow the rounded corners */
  56. }
  57. /* Pop-out effect on hover for images */
  58. .post-card__image-container {
  59. overflow: visible; /* Allow the image to pop out beyond the container */
  60. }
  61. .post-card__image {
  62. transition: transform 0.3s ease, box-shadow 0.3s ease;
  63. }
  64. .post-card__image-container:hover .post-card__image {
  65. transform: scale(1.1); /* Scale image to 110% */
  66. box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  67. }
  68. /* Make post-card--preview 20% larger and add gap */
  69. .post-card.post-card--preview {
  70. transform: scale(1.2); /* Scale element to 120% */
  71. margin: 20px; /* Add larger gap between elements */
  72. transition: transform 0.3s ease, box-shadow 0.3s ease;
  73. backface-visibility: hidden;
  74. perspective: 1000px;
  75. }
  76. .post-card.post-card--preview:hover {
  77. transform: scale(1.3); /* Scale element to 130% on hover */
  78. box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  79. }
  80. /* Hide ads and banners */
  81. .ad-banner, .ad-container, .banner, .advertisement {
  82. display: none !important;
  83. }
  84. /* Style for the sticky navigation bar */
  85. .post__nav-links {
  86. position: sticky;
  87. top: 50%;
  88. display: flex;
  89. justify-content: space-between;
  90. align-items: center;
  91. width: 100%;
  92. z-index: 1000;
  93. transform: translateY(-50%);
  94. }
  95. .post__nav-item {
  96. flex: 1;
  97. text-align: center;
  98. font-size: 130%; /* Make the text 30% larger */
  99. }
  100. .post__nav-item.subtitle {
  101. font-size: 130%; /* Make the text 30% larger */
  102. }
  103. .post__nav-item a {
  104. text-decoration: none;
  105. color: inherit;
  106. font-size: 130%; /* Make the text 30% larger */
  107. }
  108. .post__nav-item.previous {
  109. position: absolute;
  110. left: 20%;
  111. }
  112. .post__nav-item.next {
  113. position: absolute;
  114. right: 20%;
  115. }
  116. .glow {
  117. animation: glow 1.5s infinite alternate;
  118. }
  119. @keyframes glow {
  120. 0% {
  121. 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;
  122. }
  123. 55% {
  124. 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;
  125. }
  126. 100% {
  127. 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;
  128. }
  129. }
  130. `;
  131. document.head.appendChild(style);
  132.  
  133. function hideSidebar() {
  134. const sidebar = document.querySelector('.global-sidebar');
  135. if (sidebar) {
  136. sidebar.remove();
  137. }
  138. }
  139.  
  140. function removeMatrixBanner() {
  141. const matrixBanner = document.querySelector('a[href="https://coomer.su/matrix"]');
  142. if (matrixBanner) {
  143. matrixBanner.remove();
  144. }
  145. }
  146.  
  147. function moveNavElement() {
  148. const navElement = document.querySelector('.post__nav-links');
  149. const postBodyElement = document.querySelector('.post__body');
  150.  
  151. if (navElement && postBodyElement) {
  152. const previousItem = navElement.querySelector('.post__nav-link.prev');
  153. if (previousItem) {
  154. previousItem.innerHTML = '←';
  155. previousItem.parentElement.classList.add('previous', 'glow');
  156. }
  157.  
  158. const nextItem = navElement.querySelector('.post__nav-link.next');
  159. if (nextItem) {
  160. nextItem.innerHTML = '→';
  161. nextItem.parentElement.classList.add('next', 'glow');
  162. }
  163.  
  164. postBodyElement.insertBefore(navElement, postBodyElement.firstChild);
  165. }
  166. }
  167.  
  168. if (window.location.href.includes('onlyfans.com')) {
  169. const profileMatch = window.location.href.match(/https:\/\/onlyfans.com\/([^/]+)/);
  170. if (profileMatch) {
  171. const username = profileMatch[1];
  172. createRedirectButton(username, 'onlyfans');
  173. }
  174. }
  175.  
  176. if (window.location.href.includes('fansly.com')) {
  177. (async () => {
  178. let userID = null;
  179. const profileMatch = window.location.href.match(/https:\/\/fansly.com\/([^/]+)/);
  180. if (profileMatch) {
  181. const userName = profileMatch[1];
  182. if (userName) {
  183. const res = await fetch(`https://apiv3.fansly.com/api/v1/account?usernames=${userName}&ngsw-bypass=true`);
  184. const data = await res.json();
  185. userID = data?.response?.[0]?.id ?? null;
  186. }
  187. if (userID) {
  188. createRedirectButton(userID, 'fansly');
  189. }
  190. }
  191. })();
  192. }
  193.  
  194. if (window.location.href.includes('candfans.jp')) {
  195. const processedUserIds = new Set();
  196. const observer = new MutationObserver(() => {
  197. document.querySelectorAll('img[data-src]').forEach((imgElement) => {
  198. const userID = imgElement.getAttribute('data-src')?.match(/user\/(\d+)\//)?.[1];
  199. if (userID && !processedUserIds.has(userID)) {
  200. createRedirectButton(userID, 'candfans');
  201. processedUserIds.add(userID);
  202. }
  203. });
  204. });
  205. observer.observe(document.body, { childList: true, subtree: true });
  206. }
  207.  
  208. if (window.location.href.includes('coomer.su')) {
  209. removeMatrixBanner();
  210. if (window.location.href.includes('coomer.su/onlyfans/user') ||
  211. window.location.href.includes('coomer.su/fansly/user') ||
  212. window.location.href.includes('coomer.su/candfans/user')) {
  213. hideSidebar();
  214. const mainContent = document.querySelector('.shifted.content-wrapper');
  215. if (mainContent) {
  216. mainContent.classList.add('full-width');
  217. }
  218. const imageContainers = document.querySelectorAll('.post-card.post-card--preview');
  219. imageContainers.forEach(container => {
  220. container.style.transform = 'scale(1.2)';
  221. container.style.margin = '20px';
  222. container.style.transition = 'transform 0.3s ease, box-shadow 0.3s ease';
  223. container.style.backfaceVisibility = 'hidden';
  224. container.style.perspective = '1000px';
  225. container.addEventListener('mouseover', () => {
  226. container.style.transform = 'scale(1.3)';
  227. container.style.boxShadow = '0 4px 8px rgba(0, 0, 0, 0.2)';
  228. });
  229. container.addEventListener('mouseout', () => {
  230. container.style.transform = 'scale(1.2)';
  231. container.style.boxShadow = 'none';
  232. });
  233. });
  234. }
  235. }
  236.  
  237. window.addEventListener('load', () => {
  238. const links = document.querySelectorAll('a.image-link');
  239. links.forEach(link => {
  240. link.addEventListener('click', (event) => {
  241. event.preventDefault();
  242. window.open(link.href, '_blank');
  243. });
  244. });
  245. moveNavElement();
  246. });
  247. })();