您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Automatically like a post when downloading an attachment on Patreon
// ==UserScript== // @name Patreon Auto-Like on Download // @namespace https://github.com/dear-clouds/mio-userscripts // @version 1.1 // @description Automatically like a post when downloading an attachment on Patreon // @author Mio. // @supportURL https://github.com/dear-clouds/mio-userscripts/issues // @icon https://www.google.com/s2/favicons?sz=64&domain=patreon.com // @license GPL-3.0 // @match *://*.patreon.com/posts/* // @match *://*.patreon.com/* // @grant none // ==/UserScript== (function() { 'use strict'; window.addEventListener('load', function() { // Observe for new posts loaded dynamically const observer = new MutationObserver((mutations) => { mutations.forEach((mutation) => { if (mutation.addedNodes.length) { processPosts(); } }); }); observer.observe(document.body, { childList: true, subtree: true }); processPosts(); }); function processPosts() { // Select all posts that may contain attachments const posts = document.querySelectorAll('[data-tag="post-card"]'); posts.forEach(post => { const attachmentContainer = post.querySelector('[data-tag="post-attachments"]'); if (attachmentContainer) { const attachmentElements = attachmentContainer.querySelectorAll('a[data-tag="post-attachment-link"]'); attachmentElements.forEach(element => { element.addEventListener('click', () => { likePostIfNotLiked(post); }); }); } }); } function likePostIfNotLiked(postElement) { if (!postElement) return; const likeButton = postElement.querySelector('[data-tag="like-button"]'); if (likeButton && likeButton.getAttribute('aria-checked') === 'false') { // Simulate a user click on the like button using a mouse event const event = new MouseEvent('click', { bubbles: true, cancelable: true, view: window }); likeButton.dispatchEvent(event); console.log('Attempted to like the post by dispatching a click event.'); } } })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址