Created
February 19, 2018 14:16
-
-
Save kamontat/2ff0b5042922d6ae65d3db5d8346f104 to your computer and use it in GitHub Desktop.
auto vote for KU (https://eassess.ku.ac.th)
This file contains hidden or 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
function v5(h) { | |
var percent = Math.ceil(Math.random() * 100) | |
switch (h) { | |
case "g": | |
if (percent > 65) | |
return 5 // 35% | |
else if (percent > 40) | |
return 4 // 25% | |
else if (percent > 20) | |
return 3 // 20% | |
else if (percent > 5) | |
return 2 // 15% | |
else | |
return 1 // 5% | |
case "b": | |
if (percent > 65) | |
return 1 // 35% | |
else if (percent > 40) | |
return 2 // 25% | |
else if (percent > 20) | |
return 3 // 20% | |
else if (percent > 5) | |
return 4 // 15% | |
else | |
return 5 // 5% | |
default: | |
return Math.ceil(percent / 20) | |
} | |
} | |
function v2(h) { | |
return (h == "b") | |
? 2 | |
: 1 | |
} | |
// use in ประเมินตัวเอง, 5 choice | |
function vote_m(h, i) { | |
document | |
.getElementById("choice" + i + "-" + v5(h)) | |
.checked = true | |
} | |
// use in ประเมินอาจารย์, 2 choice | |
function vote_t(h, i) { | |
document | |
.getElementById("proper" + i + "-" + v2(h)) | |
.checked = true | |
form_disable(i) | |
} | |
function b(n, h, fn) { | |
for (var i = 1; i <= n; i++) { | |
fn(h, i) | |
} | |
} | |
function a() { | |
document | |
.getElementsByName("OK")[0] | |
.click() | |
} | |
// n = number of question | |
// h = how the result should be ? (g(ood) | n(ormal) | b(ad)) | |
// fn = function to exec (vote_m | vote_t) | |
// s = true | false (true will make the script auto submit the result) | |
function exec(n, h, fn, s) { | |
b(n, h, fn) | |
if (s === true) a() | |
} |
This file contains hidden or 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
function v5(e){var t=Math.ceil(100*Math.random()) | |
switch(e){case"g":return t>65?5:t>40?4:t>20?3:t>5?2:1 | |
case"b":return t>65?1:t>40?2:t>20?3:t>5?4:5 | |
default:return Math.ceil(t/20)}} | |
function v2(e){return"b"==e?2:1} | |
function vote_m(e,t){document.getElementById("choice"+t+"-"+v5(e)).checked=!0} | |
function vote_t(e,t){document.getElementById("proper"+t+"-"+v2(e)).checked=!0,form_disable(t)} | |
function b(e,t,n){for(var c=1;e>=c;c++)n(t,c)} | |
function a(){document.getElementsByName("OK")[0].click()} | |
function exec(e,t,n,c){b(e,t,n),c===!0&&a()} |
This file contains hidden or 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
function v5(e){var t=Math.ceil(100*Math.random()) | |
switch(e){case"g":return t>65?5:t>40?4:t>20?3:t>5?2:1 | |
case"b":return t>65?1:t>40?2:t>20?3:t>5?4:5 | |
default:return Math.ceil(t/20)}} | |
function v2(e){return"b"==e?2:1} | |
function vote_m(e,t){document.getElementById("choice"+t+"-"+v5(e)).checked=!0} | |
function vote_t(e,t){document.getElementById("proper"+t+"-"+v2(e)).checked=!0,form_disable(t)} | |
function b(e,t,n){for(var c=1;e>=c;c++)n(t,c)} | |
function a(){document.getElementsByName("OK")[0].click()} | |
function exec(e,t,n,c){b(e,t,n),c===!0&&a()} | |
exec(13, "g", vote_m, true) |
This file contains hidden or 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
function v5(e){var t=Math.ceil(100*Math.random()) | |
switch(e){case"g":return t>65?5:t>40?4:t>20?3:t>5?2:1 | |
case"b":return t>65?1:t>40?2:t>20?3:t>5?4:5 | |
default:return Math.ceil(t/20)}} | |
function v2(e){return"b"==e?2:1} | |
function vote_m(e,t){document.getElementById("choice"+t+"-"+v5(e)).checked=!0} | |
function vote_t(e,t){document.getElementById("proper"+t+"-"+v2(e)).checked=!0,form_disable(t)} | |
function b(e,t,n){for(var c=1;e>=c;c++)n(t,c)} | |
function a(){document.getElementsByName("OK")[0].click()} | |
function exec(e,t,n,c){b(e,t,n),c===!0&&a()} | |
exec(5, "g", vote_t, true) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment