Pojie52_TimeDown

吾爱破解回帖倒计时

  1. // ==UserScript==
  2. // @name Pojie52_TimeDown
  3. // @namespace Pojie52_TimeDown
  4. // @version 1.3
  5. // @description 吾爱破解回帖倒计时
  6. // @author Pwnint32
  7. // @match https://www.52pojie.cn/thread*
  8. // @include https://www.52pojie.cn/forum.php?mod=viewthread*
  9. // @icon https://www.google.com/s2/favicons?sz=64&domain=tampermonkey.net
  10. // @grant GM_addElement
  11. // ==/UserScript==
  12.  
  13. var PostLimitTime = 40;
  14. var PostLimitEndTime = 0;
  15.  
  16. // 对回帖下方的头像处插入提示节点
  17. function addTimeLabel() {
  18. var replyAvatar = document.querySelector('.avatar.avtm');
  19.  
  20. if (replyAvatar) {
  21. GM_addElement(
  22. replyAvatar,
  23. "div", {
  24. class: "avatar avtm",
  25. id: "timeDown",
  26. style: "text-align:center;font-size:16px;color:red",
  27. textContent: "允许回帖"
  28. }
  29. );
  30. }
  31. }
  32.  
  33. function injectReplySubmit() {
  34. var fastSubmit = document.querySelector("#fastpostsubmit");
  35. var postSubmit = document.querySelector("#postsubmit");
  36. var timeDown = document.querySelector("#timeDown");
  37.  
  38. if (fastSubmit) {
  39. fastSubmit.onclick = function () {
  40.  
  41. if (timeDown && timeDown.textContent == "允许回帖") {
  42. PostLimitTime = 40;
  43. // 设置倒计时
  44. var interval_fast_click = setInterval(function () {
  45. if (PostLimitTime > 0) {
  46. timeDown.textContent = "剩余:" + PostLimitTime + "秒";
  47. PostLimitTime--;
  48. } else {
  49. clearInterval(interval_fast_click); // 停止倒计时
  50. timeDown.textContent = "允许回帖";
  51. }
  52. }, 1000); // 每秒更新一次
  53. }
  54.  
  55. };
  56.  
  57. if (event.ctrlKey && event.keyCode == 13) {
  58.  
  59. if (timeDown && timeDown.textContent == "允许回帖") {
  60. PostLimitTime = 40;
  61. // 设置倒计时
  62. var interval_fast_event = setInterval(function () {
  63. if (PostLimitTime > 0) {
  64. timeDown.textContent = "剩余:" + PostLimitTime + "秒";
  65. PostLimitTime--;
  66. } else {
  67. clearInterval(interval_fast_event); // 停止倒计时
  68. timeDown.textContent = "允许回帖";
  69. }
  70. }, 1000); // 每秒更新一次
  71. }
  72. }
  73. }
  74.  
  75. if (postSubmit) {
  76. postSubmit.onclick = function () {
  77. if (timeDown && timeDown.textContent == "允许回帖") {
  78. PostLimitTime = 40;
  79. // 设置倒计时
  80. var interval_post_click = setInterval(function () {
  81. if (PostLimitTime > 0) {
  82. timeDown.textContent = "剩余:" + PostLimitTime + "秒";
  83. PostLimitTime--;
  84. } else {
  85. clearInterval(interval_post_click); // 停止倒计时
  86. timeDown.textContent = "允许回帖";
  87. }
  88. }, 1000); // 每秒更新一次
  89. }
  90. };
  91. if (event.ctrlKey && event.keyCode == 13) {
  92.  
  93. if (timeDown && timeDown.textContent == "允许回帖") {
  94. PostLimitTime = 40;
  95. // 设置倒计时
  96. var interval_post_event = setInterval(function () {
  97. if (PostLimitTime > 0) {
  98. timeDown.textContent = "剩余:" + PostLimitTime + "秒";
  99. PostLimitTime--;
  100. } else {
  101. clearInterval(interval_post_event); // 停止倒计时
  102. timeDown.textContent = "允许回帖";
  103. }
  104. }, 1000); // 每秒更新一次
  105. }
  106. }
  107. }
  108. }
  109.  
  110. addTimeLabel();
  111.  
  112. setInterval(injectReplySubmit, 1000)

QingJ © 2025

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