add time to chosen one.
当前为
// ==UserScript==
// @name +时长
// @namespace http://tampermonkey.net/
// @version 0.1.1
// @description add time to chosen one.
// @author zhaiwei
// @match http://ah.chinavolunteer.mca.gov.cn/volunteer/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=mca.gov.cn
// @grant none
// @license GPL license
// ==/UserScript==
(function() {
'use strict';
// 生成“+时长”按钮
var btn = document.createElement('button');
// 按钮文字
btn.innerText = '+时长';
// 添加按钮的样式类名class值为addBtn
btn.setAttribute('class', 'addBtn');
// 生成style标签
var style = document.createElement('style');
// 把样式写进去
style.innerText = `.addBtn{position:fixed;top:80%;right:10%;width:75px;height:55px;padding:3px 5px;border:3px solid #0d6efd;cursor:pointer;color:#0d6efd;font-size:20px;background-color:transparent;border-radius:5px;transition:color .15s ease-in-out,background-color .15s ease-in-out;z-index:9999999999999;}.addBtn:hover{background-color:#0d6efd;color:#fff;}`;
// 在head中添加style标签
document.head.appendChild(style);
// 在body中添加button按钮
document.body.appendChild(btn);
// 点击按钮去执行函数addTime()
document.querySelector('.addBtn').addEventListener('click', function () {
addTime();
})
function addTime(){
setTimeout('document.getElementsByClassName("ant-checkbox-input")[0].click();',10)
setTimeout('document.getElementsByClassName("ant-btn ant-btn-primary")[8].click();',110)
setTimeout('document.getElementsByClassName("anticon anticon-calendar ant-calendar-picker-icon")[0].click();',310)
//15日->[16]
setTimeout('document.getElementsByClassName("ant-calendar-cell")[16].click();',450)
setTimeout('document.getElementsByClassName("ant-calendar-ok-btn")[0].click();',600)
setTimeout('document.getElementsByClassName("anticon anticon-calendar ant-calendar-picker-icon")[1].click();',750)
setTimeout('document.getElementsByClassName("ant-calendar-cell")[16].click();',900)
setTimeout('document.getElementsByClassName("ant-calendar-ok-btn")[0].click();',1050)
//setTimeout('document.getElementsByClassName("ant-btn ant-btn-primary")[20].click();',1200)
setTimeout('document.getElementsByTagName("div")[245].children[1].click();',1200)
};
// Your code here...
})();