+时长

add time to chosen one.

目前為 2023-02-19 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==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...
})();