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);
+
+    }
+})();