Skip to content

Instantly share code, notes, and snippets.

@RKursatV
Last active March 11, 2021 22:26
Show Gist options
  • Save RKursatV/73a5ff8435932736cf88116d5d9abc13 to your computer and use it in GitHub Desktop.
Save RKursatV/73a5ff8435932736cf88116d5d9abc13 to your computer and use it in GitHub Desktop.
Metu Add Course Tool
console.log('im in');
var userActive = true;
function inactivityTime() {
var time;
// events
window.onload = resetTime;
window.onclick = resetTime;
window.onkeypress = resetTime;
window.ontouchstart = resetTime;
window.onmousemove = resetTime;
window.onmousedown = resetTime;
window.addEventListener('scroll', resetTime, true);
function alertUser() {
userActive = false;
console.log('pasif');
}
function resetTime() {
clearTimeout(time);
console.log('aktif');
userActive = true;
time = setTimeout(alertUser, 1000 * 10); // 10 seconds
}
};
inactivityTime();
function keep() {
if (userActive == false){
document.getElementsByName('submitReplaceCourse')[0].click();
}
else {console.log('aktif oldugun icin sayfayi yenilemedim');}
}
setInterval(keep, 100000);
document.getElementById('textAddCourseCode').value = ''; //course code
document.getElementById('textAddCourseSection').value = ''; //section
document.getElementById('selectAddCourseCategory').value = ''; // must -> 1, restricted -> 4, free -> 5, tech -> 7, nontech -> 8, ni -> 9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment