Skip to content

Instantly share code, notes, and snippets.

@sdennler
Last active March 24, 2020 10:28
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save sdennler/5f28807bcf292d1d404b to your computer and use it in GitHub Desktop.
Save sdennler/5f28807bcf292d1d404b to your computer and use it in GitHub Desktop.
Bring the necessary Desktop Notification to Outlook Web App.

Synopsis

Outlook Web App has no Desktop Notification support. Probably because IE doesn't support it as well...

Motivation

I missed to much mails because this feature is missing...

Installation

  1. Install user script manager in your browser:
  1. Open this links and install the script:
  1. Change @match to your Outlook Web App URL

License

Public Domain

Bring the necessary Desktop Notification to Outlook Web App.
// ==UserScript==
// @name Sad Web App Notifier
// @namespace https://gist.github.com/sdennler/
// @version 1
// @description Bring the necessary Desktop Notification to Outlook Web App.
// @author Sdennler
// @match https://webmail.jobs.ch/*
// @exclude */manifests/*
// @grant none
// ==/UserScript==
console.log('Start Sad Web App Notifier');
if (!("Notification" in window)) {
alert("This browser does not support desktop notification. Sad Web App Notifier will not work.");
} else {
Notification.requestPermission();
var BoxName = getBoxName();
checkForNewMail();
}
function getBoxName(){
var name = document.URL.match(/\/([^@\/]+@[^@\/]+)\//);
return name ? name[1] : false;
}
function checkForNewMail(){
NewMailNote = document.getElementsByClassName('_f_jb')[0];
if(!NewMailNote || NewMailNote.firstChild.style.display == 'none'){
console.log('No new mail');
} else {
console.log('New mail!');
var notification = spawnNotification('', 'You have new mail!');
NewMailNote.firstChild.style.display = 'none';
}
setTimeout(checkForNewMail, 10000);
}
function spawnNotification(body, title){
if(BoxName) title += ' ('+BoxName+')';
var options = {
body: body,
icon: 'https://openclipart.org/image/128px/svg_to_png/214764/1424701298.png'
}
return new Notification(title, options);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment