the last of s1

2024/4/13 01:18:53

安装此脚本
作者推荐脚本

您可能也喜欢方便S1爬楼

安装为用户样式
  1. // ==UserScript==
  2. // @name the last of s1
  3. // @namespace Violentmonkey Scripts
  4. // @match https://bbs.saraba1st.com/2b/forum*.html
  5. // @grant none
  6. // @license GPL
  7. // @version 1.0
  8. // @author Ts8zs & CodeGen
  9. // @description 2024/4/13 01:18:53
  10. // ==/UserScript==
  11. (function() {
  12. 'use strict';
  13. //把每个大于6页的帖子加上倒数2~5页的跳转 其中每个帖子.tps类的最后一个a是最后一页 在最后一页前添加 其中herf链接类似thread-1842868-?-1.html格式中的?是页码
  14. var all_page = document.getElementsByClassName("tps");
  15. for (var i = 0; i < all_page.length; i++) {
  16. var last_page = all_page[i].getElementsByTagName("a")[all_page[i].getElementsByTagName("a").length - 1];
  17. var last_page_num = parseInt(last_page.innerHTML);
  18. if (last_page_num > 6) {
  19. //移除tps内所有内容
  20. all_page[i].innerHTML = "...";
  21. //添加最后5页的跳转
  22. for (var j = last_page_num - 5; j < last_page_num; j++) {
  23. var new_a = document.createElement("a");
  24. var tid = all_page[i].parentNode.parentNode.getElementsByTagName("a")[0].href.split("-")[1];
  25. new_a.href = "thread-" + tid + "-" + (j + 1) + "-2.html";
  26.  
  27. new_a.innerHTML = j + 1;
  28.  
  29. all_page[i].appendChild(new_a);
  30. }
  31. }
  32. }
  33.  
  34. })();

QingJ © 2025

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