// All of the Node.js APIs are available in the preload process. // It has the same sandbox as a Chrome extension. function get(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); var r = window.location.search.substr(1).match(reg); if (r != null) return (r[2]); return null; } window.addEventListener('DOMContentLoaded', () => { let m = get("m"); if (PageJs[m]) { PageJs[m]() } else { alert("未有指定动作:" + m); } }) PageJs = { login() { const adminuser = document.getElementById("adminuser") adminuser.value = "郑荣升" const adminpass = document.getElementById("adminpass") adminpass.value = "as19940108" loginsubmit(0) }, index() { const fs = require("fs") $.get("http://oa.ouxuan.net/api.php?m=index&a=getyydata&adminid=2&cfrom=mweb&page=1&event=wwc&num=work&key=&loadci=1&t=123", function (data) { fs.writeFileSync("task.json", data); }) } }