Hallöchen zusammen!
Ich hab mal wieder was gebaut, und zwar ein Script, welches euch den Chat als Brwoserbenahrichtigung puscht.
JavaScript: pushChat.user.js
// ==UserScript==
// @name Push Chat
// @version 1.0.0
// @description Sendet eine Push-Benachrichtigung bei einer neune Chatnachricht!
// @author NiZi112
// @match https://rettungssimulator.online/*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// ==/UserScript==
/* global socket, $ */
(function() {
'use strict';
function notifyMe() {
if (Notification.permission === "granted") {
var news = true;
}
else if (Notification.permission !== 'denied') {
Notification.requestPermission(function (permission) {
if (permission === "granted") {
news = true;
}
});
}
}
notifyMe();
socket.on("associationMessage", (associationMessageObject) =>{
if(associationMessageObject.message && associationMessageObject.userName != $(".username .frame-opener").html()){
new Notification(`${associationMessageObject.userName}`, {body: associationMessageObject.message});
};
});
})();
Alles anzeigen
Viel Spaß!