Results checker
by Venkata Sai Vamsi Penupothu
JavaScript
// Here You can type your custom JavaScript...
function doSomething() {
if(document.getElementsByTagName("table")[1].getElementsByTagName("tbody")[0].getElementsByTagName("tr")[2].cells[1].childNodes["0"].innerText.indexOf("Final MBBS Part-I April 2017") === -1){
notifyMe();
console.log("Got an update");
}else {
if(document.getElementsByTagName("table")[1].getElementsByTagName("tbody")[0].getElementsByTagName("tr").length !== 89){
notifyMe();
}else{
console.log("no update");
setTimeout(function () {
location.reload();
}, 5000);
}
}
}
function notifyMe(){
if (Notification.permission !== "granted")
Notification.requestPermission();
else {
var notification = new Notification('Notification title', {
icon: 'http://cdn.sstatic.net/stackexchange/img/logos/so/so-icon.png',
body: "Hey results are available",
});
notification.onclick = function () {
window.open("http://ntruhs.ap.nic.in/Results.htm");
};
}
}
document.addEventListener('DOMContentLoaded', function () {
if (Notification.permission !== "granted")
Notification.requestPermission();
});
setTimeout(doSomething, 2000);