您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
始皇别封我号,用来给帖子自动点赞的
当前为
// ==UserScript== // @name autoGiveLike // @namespace http://tampermonkey.net/ // @version 2024-03-12 // @description 始皇别封我号,用来给帖子自动点赞的 // @author Kubbo // @match https://linux.do/* // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== // @grant none // @license MIT // ==/UserScript== (function() { 'use strict'; console.log("始皇你好~") //@Katorly @Hua 借用你们的防邀设置,做清清白白的人~ const redirectIfNeeded = () => { if(window.location.href.includes("https://linux.do/invites/")) { window.location.replace("https://linux.do"); } document.querySelectorAll("div .regular .contents").forEach((el) => { el.querySelectorAll("a").forEach((a) => { if(a.href.includes("https://linux.do/invites/")) { a.href = "https://linux.do"; } }); }); }; document.addEventListener('DOMContentLoaded', redirectIfNeeded); const observer = new MutationObserver(redirectIfNeeded); observer.observe(document.body, {childList: true, subtree: true}); const getTopics = id=>fetch(`/t/${id}.json?track_visit=true&forceLoad=true`).then(res=>res.json()).then(res=>{ const topics = res?.post_stream?.stream||[] console.log("本次查询一共有%s个帖子",topics.length) return topics }) const initBtn = ()=>{ setInterval(()=>{ const autoBtn = document.querySelector("#autoGiveLike") if(/\/t\/topic/.test(location.pathname)){ if(!autoBtn){ const btn = document.createElement("button") let status = 0 // 脚本执行状态: 0:未开始 1:正在执行中 btn.id = "autoGiveLike" btn.innerText = "开始自动点赞" btn.style.position = "fixed" btn.style.top = "10px" btn.style.right = "20px" btn.style.padding = "8px 16px" btn.style.background = "#409EFF" btn.style.color = "#fff" btn.style.border = "none" btn.style.borderRadius = "16px" btn.style.zIndex = "202403101044" btn.addEventListener("click",()=>{ if(status===0){ status=1 btn.innerText = "停止自动点赞" btn.style.background = "#F56C6C" const topicId = location.pathname.match(/\/topic\/([^/]+)/)?.[1] topicId&&getTopics(topicId).then(ids=>{ let i = 0 const token = document.querySelector('meta[name="csrf-token"]').content const loop =()=>{ if(status===1){ const id = ids[i] fetch(`/discourse-reactions/posts/${id}/custom-reactions/heart/toggle.json`,{ method:"PUT", headers:{"X-Csrf-Token":token} }).finally(()=>{ i++ if(i<=50&&i<=ids.length){ //设置50的阈值,防止始皇封我号 setTimeout(loop, 3000); } }) } } loop() }) }else if(status===1){ status=0 btn.innerText = "开始自动点赞" btn.style.background = "#409EFF" } }) document.body.appendChild(btn) } }else if(autoBtn){ autoBtn.remove()} },500) } initBtn() })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址