PTHome自动签到

PTHome自动签到脚本

  1. // ==UserScript==
  2. // @name PTHome自动签到
  3. // @namespace Violentmonkey Scripts
  4. // @match *://www.pthome.net/*
  5. // @run-at document-idle
  6. // @grant GM_xmlhttpRequest
  7. // @version 0.0.1.20190517134736
  8. // @description PTHome自动签到脚本
  9. // ==/UserScript==
  10. (function () {
  11. 'use strict';
  12. var keyName = "pthome-attend-date";
  13. function attend() {
  14. var todayStr = new Date().toLocaleDateString();
  15. var storeStr = localStorage.getItem(keyName);
  16. if (storeStr === undefined || storeStr === null || todayStr != storeStr) {
  17. GM_xmlhttpRequest({
  18. method: "GET",
  19. url: window.location.origin + '/attendance.php',
  20. onload: function (response) {
  21. if (response.status === 200 && (response.responseText.indexOf("您今天已经签到过了") !== -1 || response.responseText.indexOf("签到成功") !== -1)) {
  22. localStorage.setItem(keyName, todayStr);
  23. console.log('attend at ' + new Date().toLocaleString());
  24. } else {
  25. console.log('attend failed. status=' + response.status);
  26. }
  27. }
  28. });
  29. }
  30.  
  31. }
  32. attend();
  33. setInterval(attend, 6 * 60 * 60 * 1000);
  34. })();

QingJ © 2025

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