improved owa script
This commit is contained in:
parent
f0f0dcf5ef
commit
2dcc107a5e
1 changed files with 15 additions and 2 deletions
17
owa.js
17
owa.js
|
|
@ -2,7 +2,10 @@
|
||||||
// @name OWA
|
// @name OWA
|
||||||
// @namespace Violentmonkey Scripts
|
// @namespace Violentmonkey Scripts
|
||||||
// @match https://webmail.med.uni-muenchen.de/owa/*
|
// @match https://webmail.med.uni-muenchen.de/owa/*
|
||||||
|
// @updateURL https://gitea.bmsch.de/balthasar/Scripts/raw/branch/master/owa.js
|
||||||
|
// @downloadURL https://gitea.bmsch.de/balthasar/Scripts/raw/branch/master/owa.js
|
||||||
// @grant none
|
// @grant none
|
||||||
|
// @version 1.0.0
|
||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
|
|
||||||
Notification.requestPermission().then(function(result) {
|
Notification.requestPermission().then(function(result) {
|
||||||
|
|
@ -10,6 +13,8 @@ Notification.requestPermission().then(function(result) {
|
||||||
});
|
});
|
||||||
notified = 0
|
notified = 0
|
||||||
|
|
||||||
|
var matchDigits = RegExp('^\\d+$','');
|
||||||
|
|
||||||
window.setInterval(function(){
|
window.setInterval(function(){
|
||||||
var search = document.querySelectorAll('.ms-font-weight-semibold[title="Posteingang"]')
|
var search = document.querySelectorAll('.ms-font-weight-semibold[title="Posteingang"]')
|
||||||
if (search.length == 0){
|
if (search.length == 0){
|
||||||
|
|
@ -18,7 +23,15 @@ window.setInterval(function(){
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var x = search[0].parentElement.children[2]
|
var x = search[0].parentElement.children[2]
|
||||||
nMails = x.innerHTML
|
var children = search[0].parentElement.children
|
||||||
|
nMails = "x"
|
||||||
|
for (i=0; i<children.length; i++){
|
||||||
|
ih = children[i].innerHTML
|
||||||
|
if (matchDigits.test(ih)){
|
||||||
|
nMails = ih
|
||||||
|
//console.log("matched "+nMails)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (document.title.slice(0,1) === "("){
|
if (document.title.slice(0,1) === "("){
|
||||||
document.title = "("+nMails+') ' + document.title.slice(4)
|
document.title = "("+nMails+') ' + document.title.slice(4)
|
||||||
|
|
@ -30,7 +43,7 @@ window.setInterval(function(){
|
||||||
if (notified !== nMails) {
|
if (notified !== nMails) {
|
||||||
//console.log("OWA: "+nMails+" new mails")
|
//console.log("OWA: "+nMails+" new mails")
|
||||||
var img = 'https://webmail.med.uni-muenchen.de/owa/prem/15.0.1365.1/resources/images/0/favicon.ico';
|
var img = 'https://webmail.med.uni-muenchen.de/owa/prem/15.0.1365.1/resources/images/0/favicon.ico';
|
||||||
var n = new Notification("New mails in your OWA: "+nMails, {icon:img});
|
var n = new Notification("New mails on OWA: "+nMails, {icon:img});
|
||||||
notified = nMails
|
notified = nMails
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue