Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
华中科技大学学生宿舍电费查询
// ==UserScript==
// @name Hust.Dorm.QueryElectricity
// @namespace http://szx.studio/
// @version 0.1
// @description 华中科技大学学生宿舍电费查询
// @author szx
// @match http://202.114.18.218/Main.aspx
// @grant none
// ==/UserScript==
(function() {
'use strict';
// user code begin.
var formData = new FormData();
// 不同宿舍区 __VIEWSTATE 和 __EVENTVALIDATION 代码可能不同.
formData.append("__VIEWSTATE", "/wEPDwULLTEyNjgyMDA1OTgPZBYCAgMPZBYOAgEPEA8WBh4NRGF0YVRleHRGaWVsZAUM5qW85qCL5Yy65Z+fHg5EYXRhVmFsdWVGaWVsZAUM5qW85qCL5Yy65Z+fHgtfIURhdGFCb3VuZGdkEBUHBuS4nOWMugznlZnlrabnlJ/mpbwG6KW/5Yy6DOmfteiLkeS6jOacnwzpn7Xoi5HkuIDmnJ8G57Sr6I+YCy3or7fpgInmi6ktFQcG5Lic5Yy6DOeVmeWtpueUn+alvAbopb/ljLoM6Z+16IuR5LqM5pyfDOmfteiLkeS4gOacnwbntKvoj5gCLTEUKwMHZ2dnZ2dnZxYBAgJkAgUPEA8WBh8ABQbmpbzlj7cfAQUG5qW85Y+3HwJnZBAVEQnopb/lhavoiI0J6KW/5LqM6IiNCeilv+S5neiIjQnopb/lha3oiI0J6KW/5LiD6IiNCeilv+S4ieiIjQzopb/ljYHkuozoiI0M6KW/5Y2B5YWt6IiNDOilv+WNgeS4g+iIjQzopb/ljYHkuInoiI0M6KW/5Y2B5Zub6IiNDOilv+WNgeS6lOiIjQzopb/ljYHkuIDoiI0J6KW/5Zub6IiNCeilv+S6lOiIjQnopb/kuIDoiI0LLeivt+mAieaLqS0VEQnopb/lhavoiI0J6KW/5LqM6IiNCeilv+S5neiIjQnopb/lha3oiI0J6KW/5LiD6IiNCeilv+S4ieiIjQzopb/ljYHkuozoiI0M6KW/5Y2B5YWt6IiNDOilv+WNgeS4g+iIjQzopb/ljYHkuInoiI0M6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6GaBQLdnbOlBgLtuMzrDQLrwqHzBQKX+9a3BAL9+uzMBwL9+uCZAQL9+qSDAQL9+uTMBwL9+syFAQL9+pSFAQLYoNj7DgKdpqbADgKb2qD1CALp/5rZAgLT2o+cCgLg6vaVDQKsnsq0CgL9+qzHBwL9+oCZAQL9+vCFAQKUlLDaCAKDlPjjDgKClPjjDgKBlPjjDgKAlPjjDgKPlLyeAgL61dqrBgLSwpnTCALSwtXkAgLs0fbZDALs0Yq1BTMFuF6SgfJG6F4pI1GomF0MGOyt");
formData.append("programId", "西区");
formData.append("txtyq", "西七舍");
formData.append("txtld", "3层");
formData.append("Txtroom", "332");
formData.append("ImageButton1.x", "37");
formData.append("ImageButton1.y", "5");
var request = new XMLHttpRequest();
request.onreadystatechange = function () {
if (request.readyState == XMLHttpRequest.DONE) {
document.write(request.responseText);
}
};
request.open("POST", "http://202.114.18.218/Main.aspx");
request.send(formData);
// user code end.
})();
@Zhouxing-Su

This comment has been minimized.

Copy link
Owner Author

commented Aug 6, 2017

此脚本可以在浏览器控制台使用, 或者使用书签/快捷键插件等方式打开页面后手动执行, 配合油候 (非chrome) 或者暴力猴 (chrome) 插件使用更佳 (将本脚本添加到 Tampermonkey 中之后, 将在打开电费查询页面时自动显示本宿舍的电量).

根据自己的情况修改代码, 其中 __VIEWSTATE 和 __EVENTVALIDATION 的查询方式如下:
setup1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.