Skip to content

Instantly share code, notes, and snippets.

@Garywoo
Forked from sdennler/A Sad Web App Notifier
Created March 24, 2020 10:28
Show Gist options
  • Save Garywoo/51cb31a686468d8b29d0b7af9b87d970 to your computer and use it in GitHub Desktop.
Save Garywoo/51cb31a686468d8b29d0b7af9b87d970 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