日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

js脚本实现自动签到功能

發布時間:2023/12/20 编程问答 40 豆豆
生活随笔 收集整理的這篇文章主要介紹了 js脚本实现自动签到功能 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

js腳本實現自動簽到功能

1.首先在谷歌瀏覽器安裝Tampermonkey插件
2.寫入腳本

// ==UserScript== // @name New Userscript // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author You // @match http://*/* // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== // @grant none // ==/UserScript==(function() {'use strict';// user settingconst SIGN_IN_TIME = "09:00:00";const SIGN_OUT_TIME = "18:00:00";// code implementationlogTime("code start running");const now = new Date();const today = now.getFullYear()+"-"+(now.getMonth()+1)+"-"+now.getDate();var signInTime = +new Date(`${today} ${SIGN_IN_TIME}`);logTime("signInTime", new Date(signInTime));var signOutTime = +new Date(`${today} ${SIGN_OUT_TIME}`);logTime("signOutTime", new Date(signOutTime));// diff in or outif(now > signInTime && now < signOutTime) {// ready to sign out for todayconsole.log("Seconds to sign out for today: " + (signOutTime - now)/1000);setTimeout(signInorSignOut, signOutTime - now);} else {// ready to sign in for tomorrowsignInTime = +signInTime + 60 * 60 * 24 * 1000;console.log("Seconds to sign in for tomorrow: " + (signInTime - now)/1000);setTimeout(signInorSignOut, signInTime - now);}// signInorSignOutfunction signInorSignOut(){logTime(`signInButton clicked!`);// 重點就在這兒了,找到網站的簽到按鈕#signInButton,并觸發他的點擊事件document.querySelector("#checkout_btn").click();setTimeout(() => {document.querySelector(".btn-primary").click();},1000)}function logTime(str, time=new Date()){console.log(`${str} -> ${time.getHours()}:${time.getMinutes()}:${time.getSeconds()}`);} })();

總結

以上是生活随笔為你收集整理的js脚本实现自动签到功能的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。