Last active
July 9, 2018 03:06
-
-
Save cuter44/9460159 to your computer and use it in GitHub Desktop.
正方抢课脚本
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var zfbot = { | |
interval:5000, | |
data:null, | |
count:null, | |
started:false, | |
load_jq:function() | |
{ | |
var jq = document.createElement("script"); | |
jq.type = "text/javascript"; | |
jq.src = "http://libs.baidu.com/jquery/1.10.2/jquery.min.js"; | |
document.getElementsByTagName("head")[0].appendChild(jq); | |
}, | |
init:function() | |
{ | |
var container = $("<div id='zfbot-container' style='position:fixed; right:0px; width:240px; height:320px; background-color:#000; opacity: 0.7; font:12px; color:white; padding:4px; text-align:left;'></div>"); | |
$("<input id='zfbot-interval' onblur='javascript:zfbot.setInterval()' placeholder='自定义轮询间隔, 秒'></input>").appendTo(container); | |
$("<div id='zfbot-start' style='display:inline; margin: 0px 4px;' onclick='javascript:zfbot.start();'>喵! (°д°)ッ</div>").appendTo(container); | |
$("<div id='zfbot-stdout' style='overflow-y:auto; margin: 4px 0px; height: 295px;'>USAGE<br /><ol style='list-style:decimal;'><li>←清空查找条件直接用名字查找<li>在\"选课\"栏勾你要的课, 不要按提交<li>果断伸爪!! (°д°)ッ---------------------↑<li><strong>小心弹出, 被弹出请重复以上步骤↑</strong><li>祝你好运</ol></div>").appendTo(container); | |
$("body").prepend(container); | |
}, | |
store:function() | |
{ | |
try | |
{ | |
zfbot.data = $("body > form").serialize(); | |
zfbot.data = zfbot.data+"&Button1=++%CC%E1%BD%BB++"; | |
zfbot.count = zfbot.data.match(new RegExp("kcmcGrid%3A_ctl\\d+%3Axk","g")).length; | |
$("#zfbot-stdout").append("已选择 " + zfbot.count + " 门<br />"); | |
return(0); | |
} | |
catch (e) | |
{ | |
$("#zfbot-stdout").append("好像还没选课吧喂 (°Д° ) <br />"); | |
return(-1); | |
} | |
}, | |
fire:function() | |
{ | |
$.post( | |
document.URL, | |
zfbot.data | |
).done(function(data) | |
{ | |
var res = data.match(new RegExp("<script language='javascript'>alert[^<]+</script>","g")); | |
for (var i=0; i<res.length; i++) | |
{ | |
var res_i = res[i].slice(37, -12); | |
$("#zfbot-stdout").append(res_i+"<br />"); | |
} | |
if (res.length < zfbot.count) | |
{ | |
alert("已选上或已被弹出, 刷新页面以查看结果 ( °д°)σ"); | |
} else { | |
setTimeout("zfbot.fire()", zfbot.interval); | |
} | |
} | |
); | |
}, | |
start:function() | |
{ | |
if (!zfbot.started) | |
{ | |
$("#zfbot-stdout").empty(); | |
} | |
if (zfbot.store() == 0) | |
if (!zfbot.started) | |
{ | |
zfbot.started = true; | |
zfbot.fire(); | |
} | |
}, | |
setInterval:function() | |
{ | |
// TODO | |
} | |
} | |
if (/xf_xsqxxxk\.aspx/.test(document.location)) | |
{ | |
setTimeout("zfbot.load_jq()", 2000); | |
setTimeout("zfbot.init()", 4000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment