Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Userscripts for Outlook webmail
/** If you use Fluid.app, this is a drop-in.
* The variable storing the count of unread mails is window.fluid.dockBadge, change it as needed for your use case.
*/
window.fluid.dockBadge = '';
setTimeout(updateDockBadge, 1000);
setTimeout(updateDockBadge, 3000);
setInterval(updateDockBadge, 5000);
function updateDockBadge() {
var outlookBadge = document.querySelectorAll('[fldrnm="Boîte de réception"] + span span')[0];
window.fluid.dockBadge = outlookBadge ? outlookBadge.innerText : '';
}
/**
* THIS SCRIPT DOES NOT WORK YET
* Some event is not triggered through simulation.
*/
setTimeout(login, 1000);
setTimeout(acceptDisconnectOtherSessions, 1000);
function login() {
// Outlook login
document.getElementById('usernameWODomain').focus();
[0x4E, 0x53, 0x43, 0x48, 0x4E, 0x45, 0x49, 0x44, 0x45, 0x52, 0x6D, 0x41, 0x44, 0x43].forEach(function(keycode) {
var event = document.createEvent('KeyboardEvent');
event.initKeyboardEvent("keypress", true, true, null, false, false, false, false, 9, keycode);
document.getElementById('usernameWODomain').dispatchEvent(event);
});
document.getElementById('password').onfocus();
document.getElementById('password').value = 'your password';
document.getElementById('SubmitCreds').click();
}
setTimeout(login, 1000);
setTimeout(acceptDisconnectOtherSessions, 3000);
function login() {
// Melissa login
document.getElementById('username').value = 'your username';
document.getElementById('password').value = 'your Melissa password';
document.getElementById('passwordSecondary').value = 'your Outlook password';
document.getElementById('btnSubmit_6').click();
}
function acceptDisconnectOtherSessions() {
document.getElementById('btnContinue').click();
document.getElementById('signindiv').click();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment