forked from Neon4o4/Patch-for-Elective-System-of-NKU
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f6fc616
commit 74999a3
Showing
5 changed files
with
260 additions
and
19 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,110 @@ | ||
// alert("It works"); | ||
if(document.getElementsByName("userpwd_text")[0] !== undefined){ | ||
var isStop = true; | ||
var ClickTwice = false; | ||
var kh_Array_pub = ["", "", "", ""]; | ||
|
||
function QK_loop(kh_Array) { | ||
if (kh_Array.length != 4) { | ||
return false; | ||
} else { | ||
isStop = false; | ||
function t(Arr) { | ||
if (!QiangKe(Arr[0], Arr[1], Arr[2], Arr[3])) | ||
{ | ||
isStop = true; | ||
return false; | ||
} | ||
//===Waiting Loop==== | ||
function _(times, len) { | ||
if (times > 0) { | ||
if (ClickTwice) { | ||
ClickTwice = false; | ||
isStop = true; | ||
} | ||
if (isStop) return; | ||
setTimeout(_, len, times - 1, len) | ||
} else { | ||
t(Arr); | ||
} | ||
} | ||
_(20, 250); | ||
//======= | ||
kh_Array_pub = kh_Array; | ||
return true; | ||
} | ||
return t(kh_Array); | ||
} | ||
} | ||
|
||
function QiangKe(kh1, kh2, kh3, kh4) { | ||
try { | ||
F = document.getElementsByName('mainFrame')[0].contentDocument; | ||
F.getElementsByName('xkxh1')[0].value = kh1 || ""; | ||
F.getElementsByName('xkxh2')[0].value = kh2 || ""; | ||
F.getElementsByName('xkxh3')[0].value = kh3 || ""; | ||
F.getElementsByName('xkxh4')[0].value = kh4 || ""; | ||
} catch(e) { | ||
return false; | ||
} | ||
if (! (!kh1 && !kh2 && !kh3 && !kh4)) { | ||
setTimeout(function() { | ||
F.getElementsByName('xuanke')[0].click(); | ||
}, | ||
500); | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
} | ||
|
||
chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) { | ||
console.log("RUN"); | ||
if (request['isStop'] !== undefined) { | ||
|
||
if (request['isStop']) { | ||
isStop = request['isStop']; | ||
sendResponse("Stopped"); | ||
} else { | ||
if(!isStop){ | ||
isStop = true; | ||
ClickTwice = true; | ||
sendResponse("Stopped"); | ||
} | ||
else{ | ||
var G = QK_loop(request['kh_Array']); | ||
if (G) { | ||
sendResponse("Started"); | ||
} else { | ||
sendResponse("Stopped"); | ||
} | ||
} | ||
} | ||
} else { | ||
sendResponse(isStop ? ["Stopped", ""]: ["Started", kh_Array_pub]) | ||
} | ||
}); | ||
|
||
//==========下面的别动======== | ||
if (document.getElementsByName("userpwd_text")[0] !== undefined) { | ||
document.getElementsByName("userpwd_text")[0].id = "userpwd_text"; | ||
} | ||
|
||
// slidebar on the left | ||
var contnt = window.top.document.getElementsByName("leftFrame")[0].contentDocument; | ||
if (contnt !== undefined){ | ||
var topLine = contnt.getElementById("MFX0").style["top"]; | ||
var attrHeight = 12 | ||
topLine = parseInt(topLine); | ||
for (var i = 0; i < 21; i++) { | ||
var MFX = contnt.getElementById("MFX" + i); | ||
if (MFX){ | ||
var attrTop = topLine + i * attrHeight; | ||
MFX.style["visibility"]= "visible"; | ||
MFX.style["top"] = attrTop.toString() + "px"; | ||
function Patch_web() { | ||
var aa = window.top.document.getElementsByName("leftFrame")[0]; | ||
if (aa !== undefined) { | ||
aa = aa.contentDocument; | ||
var t = 110; | ||
for (var i = 0; i < 21; i++) { | ||
var tmp = aa.getElementById('MFX' + i); | ||
if (tmp) { | ||
tmp.style["visibility"] = 'visible'; | ||
tmp.style["top"] = t + 'px'; | ||
t = t + 12; | ||
} | ||
} | ||
} | ||
} | ||
|
||
window.onload = function() { | ||
console.log("ZAIRU"); | ||
Patch_web(); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
var BaseImg = document.createElement('img') | ||
BaseImg.setAttribute( "src", | ||
"data:image/bmp;base64,Qk0uBgAAAAAAAIoAAAB8AAAAEwAAABMAAAABACAAAwAAAKQFAABiAQAAYgEAAAAAAAAAAAAAAAD/AAD/AAD/AAAAAAAA/0JHUnOAwvUoYLgeFSCF6wFAMzMTgGZmJkBmZgagmZkJPArXAyRcjzIAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAP///wD///9///////////////9z////AP///wD///8e////x////x7///8A////f/////////////////7+/qD+/v4K/v7+AAAAAAD///8A////gP/////////o////Kf///wD///8A////Hv///8f///8e////AP///4D//////////////97+/v4k////AP///wsAAAAA////AP///3//////////s/7+/gv+/v4A////AP///x7////H////Hv///wD///9///////////X+/v5d////AP///wv///+XAAAAAP///wD///9//////////37///8A////AP///wD///8e////x////x7///8A////gP////////+o/v7+Cv///wD///9Y////9AAAAAD///8A////gP////r///9R////AP7+/gD///8A////Hv///8f///8e////AP///4L////h/v7+Jf///wD///8j////2/////8AAAAA////AP///4L////b////F////wD///8A////AP///x7////H////Hv///wD///91/v7+ZP///wD///8K////oP//////////AAAAAP///wD///+E////lP///wD///8P////L////wD///8e////x////x7///8A/v7+NP7+/g////8A////Wf////T//////////wAAAAD///8A////df///1P///8A////L////2n///8A////Hv///8f///8e////AP///wD///8A////JP///9n///////////////8AAAAA////AP///2T///8g////AP///3X///9/////AP///x7////H////Hv///wD+/v4A/v7+Cv///6L/////////////////////AAAAAP///wD///8y////D////wv///+3////g////wD///8e////x////x7///8A/Pz8Av///2D////1/////////////////////wAAAAD///8A////AP///wD///8b////6P///4H///8A////Hv///8f///8e////AP7+/gj///+Y//////////////////////////8AAAAA////AP7+/gD///8A////Tv////n///+A////AP///x7////H////Hv///wD///8A/v7+Gv///6b/////////////////////AAAAAAAAAAD+/v4AKCgoAP///4//////////f////wD///8e////x////x7///8A////AP///wD+/v4Y////pf///////////////wAAAAAAAAAA////AP///xf////W/////////3////8A////Hv///8f///8e////AP7+/jn+/v4e/v7+AP///xf///+l//////////8AAAAAAAAAAP///wD///8q////6P////////9/////AP///x7////H////Hv///wD///9/////sv7+/hn+/v4A////Fv///6X/////AAAAAP///wD///8A////cv//////////////f////wD///8e////x////x7///8A////gP////////+t/v7+GP7+/gD///8Y////mgAAAAD+/v4A/v7+C////7T//////////////4D///8A////Hv///8f///8e////AP///3///////////////63+/v4X/v7+AP///wsAAAAA////AP///yn////o//////////////9/////AP///x7////H////Hv///wD///9/////////////////////rf7+/hj+/v4AAAAAAP///wD///9z////////////////////f////wD///8e////x////x7///8A////f//////////////////////+/v6f/v7+Cw==" | ||
); | ||
|
||
function makeIcon(isRun) | ||
{ | ||
var C = document.createElement("canvas"); | ||
var J = C.getContext('2d'); | ||
J.fillStyle = isRun?"#FF0000":"#000000"; | ||
J.fillRect(0, 0, 19, 19); | ||
J.drawImage(BaseImg,0, 0); | ||
return { imageData: J.getImageData(0, 0, 19, 19) }; | ||
} | ||
|
||
function ChangeStatus(sta) { | ||
document.getElementById("status").innerHTML = sta; | ||
//======Change Icon======== | ||
chrome.browserAction.setIcon( makeIcon((sta=="Started")) ); | ||
//====================== | ||
} | ||
|
||
function fill(Arr){ | ||
document.getElementById('xk1').value = Arr[0]; | ||
document.getElementById('xk2').value = Arr[1]; | ||
document.getElementById('xk3').value = Arr[2]; | ||
document.getElementById('xk4').value = Arr[3]; | ||
} | ||
|
||
|
||
function sta() { | ||
var Arr = []; | ||
Arr.push(document.getElementById('xk1').value); | ||
Arr.push(document.getElementById('xk2').value); | ||
Arr.push(document.getElementById('xk3').value); | ||
Arr.push(document.getElementById('xk4').value); | ||
chrome.tabs.getSelected(null, | ||
function(tab) { | ||
chrome.tabs.sendMessage(tab.id, { | ||
"isStop": false, | ||
"kh_Array": Arr, | ||
}, | ||
function(response) { | ||
ChangeStatus(response); | ||
}); | ||
}); | ||
} | ||
function end() { | ||
chrome.tabs.getSelected(null, | ||
function(tab) { | ||
chrome.tabs.sendMessage(tab.id, { | ||
"isStop": true | ||
}, | ||
function(response) { | ||
ChangeStatus(response); | ||
}); | ||
}); | ||
} | ||
|
||
function Par(url) { | ||
var pattern = /^(?:(\w+):\/\/)?(?:(\w+):?(\w+)?@)?([^:\/\?#]+)(?::(\d+))?(\/[^\?#]+)?(?:\?([^#]+))?(?:#(\w+))?/; | ||
var result = pattern.exec(url); | ||
return result; | ||
} | ||
|
||
function clone(destination, source) { | ||
for (var property in source) { | ||
if (typeof source[property] === "object" && source[property] !== null && destination[property]) { | ||
clone(destination[property], source[property]); | ||
} else { | ||
destination[property] = source[property]; | ||
} | ||
} | ||
}; | ||
|
||
function Xk_Yes() { | ||
var F = document.getElementById('sta'); | ||
var G = document.getElementById('end'); | ||
F.onclick = sta; | ||
G.onclick = end; | ||
} | ||
|
||
function XK_No() { | ||
document.getElementById("Outer").innerHTML = "<div>这个东西只能在选课系统里面用哦~<br>by 也爱你们的喵</div>"; | ||
document.getElementById("Outer").style.removeProperty['width']; | ||
} | ||
|
||
window.onload = function() { | ||
chrome.tabs.getSelected(null, | ||
function(tab) { | ||
chrome.tabs.sendMessage(tab.id, { | ||
"nil": "nil" | ||
}, | ||
function(response) { | ||
try { | ||
if (response[0] == "Started") fill(response[1]); | ||
ChangeStatus(response[0]); | ||
} catch(e) { | ||
//maybe Nothing to do | ||
} | ||
console.log(response); | ||
}); | ||
}); | ||
chrome.tabs.query({ | ||
'active': true, | ||
'lastFocusedWindow': true | ||
}, | ||
function(tabs) { | ||
Par(tabs[0].url)[4] === "222.30.32.10" ? Xk_Yes() : XK_No(); | ||
}); | ||
|
||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<html> | ||
<head><meta http-equiv="content-type" content="text/html; charset=UTF-8" /> | ||
<style type="text/css"> | ||
input | ||
{ | ||
margin:5px; | ||
} | ||
Butt | ||
{ | ||
font-size: 10px; | ||
color:#FFFFFF; | ||
} | ||
</style> | ||
</head> | ||
<body style="width:300px"> | ||
<script src="pop.js"></script> | ||
|
||
<div id = "Outer"> | ||
<div>选课序号1:<input id='xk1'/><br /> | ||
选课序号2:<input id='xk2'/><br /> | ||
选课序号3:<input id='xk3'/><br /> | ||
选课序号4:<input id='xk4'/></div> | ||
<div> | ||
<input type="submit" value="开始刷课" id="sta" class="Butt"> | ||
<input type="submit" value="停止刷课" id="end" class="Butt"> | ||
</div> | ||
<div> | ||
<p id="log">选课机状态:<span id="status">Stopped<span></p> | ||
</div> | ||
</div> | ||
</body> | ||
</html> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,23 @@ | ||
{ | ||
"name": "南开选课系统补丁", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"manifest_version": 2, | ||
"description": "修复南开选课系统提示密码错误无法登录,以及登录后左侧边栏无法正常显示的问题", | ||
"description": "修复南开选课系统提示密码错误无法登录,以及登录后左侧边栏无法正常显示的问题,抢课功能请慎重使用,以免水表不保", | ||
"permissions": [ | ||
"http://222.30.32.10/*" | ||
"http://222.30.32.10/*", | ||
"<all_urls>", | ||
"tabs" | ||
], | ||
|
||
"content_scripts": [ | ||
{ | ||
"matches": ["http://222.30.32.10/*"], | ||
"matches": ["http://222.30.32.10/*", "<all_urls>"], | ||
"run_at": "document_idle", | ||
"js": ["js/patch.js"] | ||
} | ||
] | ||
], | ||
"browser_action": { | ||
"default_icon": "img/normal.png", | ||
"default_popup": "js/popup.html" | ||
} | ||
} |