-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDisable Notifications API.user.js
35 lines (34 loc) · 1.07 KB
/
Disable Notifications API.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// ==UserScript==
// @name Disable Notifications API
// @namespace https://greasyfork.org/en/users/85671-jcunews
// @version 1.0.1
// @license GNU AGPLv3
// @description Disable Notifications API where sites may show popup notifications message at bottom-right of the web browser. Any sites which require Notifications API may cause the web browser to ask user for a permission to display notifications. This script disables both the notifications and the permission prompt. It is intended for users who find them annoying.
// @author jcunews
// @match *://*/*
// @grant none
// @run-at document-start
// ==/UserScript==
(function() {
window.Notification = {
get permission() {
return "denied";
},
set permission(a) {
return "denied";
},
requestPermission: function(fn) {
if ("function" === typeof fn) {
fn("denied");
return;
} else {
return {
then: function(fn) {
fn("denied");
return this;
}
};
}
}
};
})();