User:Galadhanu/monobook.js

function ChatbotRequests { var sub = ['Chatbot_Requests']; //pages to check

var on = false; for(var i = 0; i < sub.length; i++) { if(wgPageName == 'User:' + wgUserName + '/' + sub[i]) {on = true; break;} } 	if(!on) { xhr = new XMLHttpRequest; xhr.open('GET', '/api.php?action=query&format=json&prop=info&titles=User:' + wgUserName + '/' + sub.join('|User:' + wgUserName + '/'), true); xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); xhr.onreadystatechange = function { if(this.readyState == 4 && this.status == 200) { var pages = JSON.parse(this.responseText).query.pages; for(var i in pages) { if(i > 0 && pages[i].lastrevid > localStorage.getItem('msgwl_' + pages[i].title.substring(pages[i].title.indexOf('/')) + 1)) { if(skin == 'oasis') {

document.getElementById('WikiaFooter').getElementsByTagName('ul')[0].outerHTML += '

You have new messages.

';

} 						else {

document.getElementById('contentSub').outerHTML += '

You have new messages (show most recent).

';

} 					} 				} 			} 		} 		xhr.send; } 	else {localStorage.setItem('msgwl_' + wgPageName.substring(wgPageName.lastIndexOf('/') + 1), wgCurRevisionId);} } //addOnloadHook(ChatbotRequests);