Skip to content

Instantly share code, notes, and snippets.

@vizv
Last active March 22, 2019 18:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vizv/0a2b53d4c15569020152aa52e43fd0cb to your computer and use it in GitHub Desktop.
Save vizv/0a2b53d4c15569020152aa52e43fd0cb to your computer and use it in GitHub Desktop.
Outlook Notification UserScript
// ==UserScript==
// @name Outlook Notification
// @namespace http://tampermonkey.net/
// @version 0.3
// @description Send desktop notification from Outlook Web Application
// @author Wenxuan Zhao
// @match https://outlook.office.com/mail/inbox
// @iconURL http://ow2.res.office365.com/owamail/2019031801.04/resources/images/favicons/mail-seen.ico
// @updateURL https://gist.githubusercontent.com/vizv/0a2b53d4c15569020152aa52e43fd0cb/raw/outlook-notification.js
// @grant GM_notification
// ==/UserScript==
(function() {
'use strict';
var sentSet = new Set();
console.log('[Outlook Notification] UserScript loaded')
setInterval(function () {
var reminders = Array.from(document.querySelector('.ms-Layer').firstChild.firstChild.lastChild.children).slice(1)
reminders.forEach(function (reminder) {
if (sentSet.has(reminder)) return;
sentSet.add(reminder)
var event = reminder.querySelector('.ms-Button-flexContainer').lastChild
var message = event.firstChild.firstChild.textContent
var time = event.lastChild.firstChild.textContent
var location = event.lastChild.lastChild.textContent
var title = 'Outlook Notification'
var text = message + " / " + time + " @ " + location
console.log('[Outlook Notification] Send notification: ', message, time, location)
GM_notification(text, title, 'http://ow2.res.office365.com/owamail/2019031801.04/resources/images/favicons/mail-seen.ico')
})
}, 1000);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment