掘金一键点赞

为掘金沸点一键点赞

  1. // ==UserScript==
  2. // @name 掘金一键点赞
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.5
  5. // @description 为掘金沸点一键点赞
  6. // @author You
  7. // @match https://juejin.cn/user/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=juejin.cn
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15. let latestOffsetHeight = document.body.offsetHeight;
  16. let counter = 0;
  17. const sleep = (t) => new Promise(resolve => setTimeout(resolve, t));
  18. const clickLike = async () => {
  19. const btns = document.querySelectorAll('.like:not(.active)');
  20. if(btns?.length) {
  21. for await(const node of btns) {
  22. console.log(node);
  23. await sleep(300);
  24. node.click();
  25. }
  26. }
  27. scrollTo(0, document.body.offsetHeight);
  28. await sleep(1000);
  29. if(document.body.offsetHeight === latestOffsetHeight) {
  30. counter++;
  31. } else {
  32. counter = 0;
  33. }
  34. latestOffsetHeight = document.body.offsetHeight;
  35. if(counter < 3) await clickLike();
  36. }
  37. const handleClick = async () => {
  38. btn.disabled = true;
  39. btn.innerText = '点赞中...';
  40. await clickLike();
  41. btn.disabled = false;
  42. btn.innerText = '已完成';
  43. }
  44. const btn = document.createElement('button');
  45. btn.innerText = '一键点赞';
  46. btn.className = 'btn';
  47. btn.style = 'position: fixed;left: 0;bottom: 10%;';
  48. btn.addEventListener('click', handleClick);
  49. document.body.appendChild(btn);
  50. })();

QingJ © 2025

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