Twitter_Auto_Like

推特时间线自动点赞

  1. // ==UserScript==
  2. // @name Twitter_Auto_Like
  3. // @namespace https://blog.chrxw.com
  4. // @version 0.1
  5. // @description 推特时间线自动点赞
  6. // @author Chr_
  7. // @include https://twitter.com/*
  8. // @license AGPL-3.0
  9. // @icon https://blog.chrxw.com/favicon.ico
  10. // ==/UserScript==
  11.  
  12. (() => {
  13. 'use strict';
  14. let t = setInterval(() => {
  15. if (document.querySelector('a[href*=compose]') != null) {
  16. clearInterval(t);
  17. loadComplete();
  18. }
  19. }, 500);
  20. function loadComplete() {
  21. let btnArea = document.querySelector('a[href*=compose]').parentElement.parentElement;
  22. let btn = document.createElement('button');
  23. btn.textContent = '点赞';
  24. btn.addEventListener('click', autoLike);
  25. btnArea.appendChild(btn);
  26. }
  27. function autoLike() {
  28. let likes = document.querySelectorAll('div[role="button"][data-testid="like"]');
  29. let j = likes.length;
  30. let i = 0;
  31. let t = setInterval(() => {
  32. if (i < j) {
  33. likes[i++].click();
  34. } else {
  35. clearInterval(t);
  36. }
  37. }, 500);
  38. }
  39. })();

QingJ © 2025

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