chenyihui 1 年間 前
コミット
ed1a34bde4
1 ファイル変更46 行追加0 行削除
  1. 46 0
      main.js

+ 46 - 0
main.js

@@ -0,0 +1,46 @@
+
+(function () {
+    const seclist = [21600, 25200, 28800, 43200, 64800, 72000, 79200]
+
+    function intime(t) {
+        var ret = false;
+        seclist.forEach(element => {
+            console.log(element)
+            a = t - element
+            if (a <= 3 && a >= 1) {
+                ret = true;
+            }
+        })
+        return ret;
+    }
+
+    function gett(d) {
+        var hour = d.getHours();
+        var min = d.getMinutes();
+        var sec = d.getSeconds();
+        return hour * 3600 + min * 60 + sec;
+    }
+
+    window.onload = () => {
+
+        console.log("插件加载成功!");
+        var S = document.querySelectorAll('button[type=submit]')[0];
+        var div = document.createElement('div');
+        var x = document.createElement("input");
+        var l = document.createElement("label");
+        div.appendChild(x);
+        div.appendChild(l);
+        x.setAttribute("type", "checkbox");
+        l.innerHTML = "延时提交";
+        S.parentNode.prepend(div)
+        setInterval(function () {
+            t = gett(new Date())
+            console.log(t, intime(t), x.checked);
+            if (x.checked && intime(t)) {
+                console.log('right time');
+                S.click();
+            }
+        }, 500);
+
+    }
+})();