-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathR1.user.js
49 lines (41 loc) · 1.5 KB
/
R1.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// ==UserScript==
// @name R1抢购
// @version 1
// @grant none
// @match *://item.jd.com/6661096.html?*
// @require https://code.jquery.com/jquery-latest.js
// ==/UserScript==
setTimeout(function(){
if(jQuery("#choose-btn-bgm").hasClass("btn-disable")){
var notification = new Notification("没货啊o(╥﹏╥)o");
console.log(window.location.href);
setTimeout(function(){window.location.reload();},5000);
}else{
var notification = new Notification("到货啦!!!");
}
},15000);
function notifyMe() {
if (!("Notification" in window)) {
alert("This browser does not support desktop notification");
}
else if (Notification.permission === "granted") {
var notification = new Notification("Hi there!");
}
// Otherwise, we need to ask the user for permission
// Note, Chrome does not implement the permission static property
// So we have to check for NOT 'denied' instead of 'default'
else if (Notification.permission !== 'denied') {
Notification.requestPermission(function (permission) {
// Whatever the user answers, we make sure we store the information
if(!('permission' in Notification)) {
Notification.permission = permission;
}
// If the user is okay, let's create a notification
if (permission === "granted") {
var notification = new Notification("Hi there!");
}
});
}
// At last, if the user already denied any notification, and you
// want to be respectful there is no need to bother him any more.
}