NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name 🤖 Auto BUU Assess
// @namespace http://tampermonkey.net/
// @version 2.3.1
// @description auto assess program for buu assess
// @author Kiratae
// @license MIT
// @match https://assess.buu.ac.th/*
// @grant none
// @require http://code.jquery.com/jquery-3.4.1.min.js
// ==/UserScript==
(function() {
'use strict';
var configs = {
level: localStorage.getItem("config_level") ? parseInt(localStorage.getItem("config_level")) : 5,
timer: localStorage.getItem("config_timer") ? parseInt(localStorage.getItem("config_timer")) : 5
}
// Your code here...
var checkboxes = $('input');
for (var i = 0; i < checkboxes.length; i++) {
if(checkboxes[i].value == configs.level)
checkboxes[i].checked = true;
}
$('#form_assess > input[name="btn_submit"]').click();
var old_dialog = $('._myconfirm > p').html();
var timer = configs.timer;
var x = setInterval(function(){
if(timer <= 0){
clearInterval(x);
$('.button_orange').click();
}else{
$('._myconfirm > p').html(old_dialog + '<br/>⏲ ยืนยันอัตโนมัติในอีก...' + timer + ' วินาที');
timer--;
}
}, 1000);
if(parseInt(localStorage.getItem("continue_rand"))){
$('.button_orange').click();
allRandom();
}
//$('.button_orange').click();
let btn_all_random_element = $('<li><a href="#" id="all_rand_btn" style="color: red;">🤖 ประเมินการเรียนการสอนอัตโนมัติ</a></li>');
if($('body .wrapper .container_content .toolbars div').text().trim() === "ประเมินการเรียนการสอน"){
btn_all_random_element.appendTo('body .wrapper .container_menu .vert-one');
}
let btn_setting_element = $('<li><a href="#" id="setting_btn">🔧 ตั้งค่าบอทประเมิน</a></li>');
btn_setting_element.children('a').append(`<hr/><ul><li style="font-size: 0.8rem;">📝 ระดับของการทำการประเมิน: ${configs.level}</li><li style="font-size: 0.8rem;">⏲ เวลานับถอยหลัง: ${configs.timer} วินาที</li></ul>`);
btn_setting_element.appendTo('body .wrapper .container_menu .vert-one');
$('#all_rand_btn').click(function(){
if(confirm('เริ่มการใช้บอทประเมินทั้งหมด? 🤔')){
localStorage.setItem("continue_rand", 1);
allRandom();
}
});
$('#setting_btn').click(function(){
configs = setting(configs);
});
})();
function allRandom(){
let count = $('form').length;
$.each($('form'), function(index, value){
if(!parseInt($(value).children('#STU_ASSESS').val())){
$(value).submit();
count--;
}
});
if(count == $('form').length){
localStorage.setItem("continue_rand", 0);
alert('ขออภัย 😥\nไม่เหลือการประเมินให้ประเมินอีกแล้ว');
}
}
function setting(oldConfig){
let tempLevel = prompt("กรุณากรอกระดับของการทำการประเมิน (1-5)", oldConfig.level);
if (tempLevel != null)
oldConfig.level = tempLevel;
let temp = -1;
while((temp < 0 || temp > 30)){
temp = prompt("กรุณากรอกเวลาในการยืนยันการส่งแบบประเมินอัตโนมัติ 0-30 วินาที", oldConfig.timer);
}
if (temp != null)
oldConfig.timer = temp;
localStorage.setItem("config_level", oldConfig.level);
localStorage.setItem("config_timer", oldConfig.timer);
return oldConfig;
}