Greasy Fork

New Userscript

try to take over the world!

当前为 2020-09-07 提交的版本,查看 最新版本

// ==UserScript==
// @name         New Userscript
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        http://ehallapp.nju.edu.cn/qljfwapp/sys/lwAppointmentBathroom/*default/index.do
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    var refresh = () => {

        var labels = document.querySelectorAll('label')
        var length = labels.length
        for (var i = 0; i < length; i++) {
            var label = labels[i]
            var text = label.innerText
            if (text.startsWith('开始时间')) label.innerText = text.split(' ')[0] + ' 22:00:00'
            if (text.startsWith('结束时间')) label.innerText = text.split(' ')[0] + ' 22:20:00'
        }

        var items = document.querySelectorAll('.lib-listdet-items')[0]
        if (items) {
            var start = items.children[4].children[2]
            var end = items.children[5].children[2]
            start.innerText = start.innerText.split(' ')[0] + ' 22:00:00'
            end.innerText = end.innerText.split(' ')[0] + ' 22:20:00'
        }

    }

    setInterval(refresh, 1000)
})();