Chinaz Auto Pager 站长之家自动翻页器

站长之家自动翻页脚本

  1. // ==UserScript==
  2. // @name Chinaz Auto Pager 站长之家自动翻页器
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description 站长之家自动翻页脚本
  6. // @author Your Name
  7. // @match *://*.chinaz.com/*
  8. // @grant GM_addStyle
  9. // @grant GM_setValue
  10. // @grant GM_getValue
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15. // 添加开关样式
  16. GM_addStyle(`
  17. .auto-pager-switch {
  18. position: fixed;
  19. left: 20px;
  20. top: 20px;
  21. z-index: 9999;
  22. padding: 8px 15px;
  23. background: #f0f0f0;
  24. border: 1px solid #ccc;
  25. border-radius: 4px;
  26. cursor: pointer;
  27. user-select: none;
  28. }
  29. .active {
  30. background: #4CAF50 !important;
  31. color: white;
  32. }
  33. `);
  34.  
  35. // 创建开关元素
  36. const switchElement = document.createElement('div');
  37. switchElement.className = 'auto-pager-switch';
  38. switchElement.textContent = '自动翻页:关闭';
  39. document.body.appendChild(switchElement);
  40.  
  41. let intervalId = null;
  42. const clickNextPage = () => {
  43. // 查找包含 > 符号的下一页按钮
  44. const nextButton = [...document.querySelectorAll('a, button')].find(el =>
  45. el.textContent.trim() === '>' ||
  46. el.textContent.trim() === '下一页'
  47. );
  48.  
  49. if (nextButton) {
  50. nextButton.click();
  51. console.log('已点击下一页');
  52. }
  53. };
  54.  
  55. // 从存储获取初始状态
  56. let isEnabled = GM_getValue('autoPagerEnabled', false);
  57. // 创建开关元素
  58. switchElement.textContent = isEnabled ? '自动翻页:开启' : '自动翻页:关闭';
  59. if (isEnabled) {
  60. switchElement.classList.add('active');
  61. intervalId = setInterval(clickNextPage, 1000);
  62. }
  63.  
  64. // 切换点击事件
  65. switchElement.addEventListener('click', () => {
  66. isEnabled = !isEnabled;
  67. GM_setValue('autoPagerEnabled', isEnabled);
  68. if (isEnabled) {
  69. intervalId = setInterval(clickNextPage, 1000);
  70. switchElement.textContent = '自动翻页:开启';
  71. switchElement.classList.add('active');
  72. } else {
  73. clearInterval(intervalId);
  74. intervalId = null;
  75. switchElement.textContent = '自动翻页:关闭';
  76. switchElement.classList.remove('active');
  77. }
  78. });
  79. })();

QingJ © 2025

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