需求
每天填写日志要点好几下,比较麻烦,写个脚本自动点下
代码
-
我现在用的浏览器 双核浏览器
-
浏览器 安装 油猴脚本 tampermonkey
-
点击 tampermonkey
-
控制面板
-
创建两个脚本(因为有一个页面跳转)
-
脚本1 重点是 @match
// ==UserScript==
// @name EveryLog
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match http://192.168.71.7:8080/TFKJ/
// @icon https://www.google.com/s2/favicons?sz=64&domain=tampermonkey.net
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Your code here...
$("#userName").val('name')
$("#password").val('123456')
doSubmit()
// window.location.assign("./implementTemporary.do?act=init")
})();
- 脚本2
// ==UserScript==
// @name EveryLog2
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match http://192.168.71.7:8080/TFKJ/implementTemporary.do?act=init
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Your code here...
$("#add").click()
$("#add_child").click()
$("#taskProjectIds").val(435)
$("#useTimeList>input").click()
const a = window.frames["__calendarIframe"].document
a.getElementById('selectTodayButton').click()
$('#workTypeIds').val('71')
$('#selectTodayButton').click()
$('#normalTimes').val('8')
$('#overTimes').val('0')
})();
- 脚本3
// ==UserScript==
// @name EveryLogOpenWindow
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match http://192.168.71.7:8080/TFKJ/main.do?act=init*
// @icon https://www.google.com/s2/favicons?sz=64&domain=gitee.io
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Your code here...
window.frames["content"].location = 'implementTemporary.do?act=init'
})();