-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpokemon-go.user.js
81 lines (74 loc) · 2.46 KB
/
pokemon-go.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// ==UserScript==
// @name pokemon go
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author abdullahazad
// @match https://club.pokemon.com/us/pokemon-trainer-club/activated/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=pokemon.com
// @grant GM_notification
// @grant window.focus
// ==/UserScript==
setTimeout(function() {
if (document.querySelector('.cufonAlternate') !== null) {
var win = window.open("", "_self");
shim_GM_notification()
win.close();
}
}, 1000);
if (document.querySelector('div.column-10:nth-child(1) > p:nth-child(2)') !== null) {
var metin = document.querySelector('div.column-10:nth-child(1) > p:nth-child(2)').textContent;
} else {
metin = document.querySelector('.cufonAlternate').textContent;
}
console.log(metin);
var notificationDetails = {
text: metin,
title: 'Pokemon GO Account',
timeout: 3000,
onclick: function() {
window.focus();
}
};
GM_notification(notificationDetails);
/*--- Cross-browser Shim code follows:
*/
function shim_GM_notification() {
if (typeof GM_notification === "function") {
return;
}
window.GM_notification = function(ntcOptions) {
checkPermission();
function checkPermission() {
if (Notification.permission === "granted") {
fireNotice();
} else if (Notification.permission === "denied") {
alert("User has denied notifications for this page/site!");
return;
} else {
Notification.requestPermission(function(permission) {
console.log("New permission: ", permission);
checkPermission();
});
}
}
function fireNotice() {
if (!ntcOptions.title) {
console.log("Title is required for notification");
return;
}
if (ntcOptions.text && !ntcOptions.body) {
ntcOptions.body = ntcOptions.text;
}
var ntfctn = new Notification(ntcOptions.title, ntcOptions);
if (ntcOptions.onclick) {
ntfctn.onclick = ntcOptions.onclick;
}
if (ntcOptions.timeout) {
setTimeout(function() {
ntfctn.close();
}, ntcOptions.timeout);
}
}
}
}