+时长

add time to chosen one.

当前为 2023-02-19 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         +时长
// @namespace    http://tampermonkey.net/
// @version      0.1.3
// @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
// @require      https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js
// @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)
    //19日->[20]
    setTimeout('document.getElementsByClassName("ant-calendar-cell")[20].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)
    //19日->[20]
    setTimeout('document.getElementsByClassName("ant-calendar-cell")[20].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);
    setTimeout('$("span:contains(添加时长)")[0].click();',1200);
    setTimeout('document.getElementsByClassName("anticon anticon-right")[4].click();',1400);
    };
    // Your code here...
})();