-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdesksms-contentscript.js
42 lines (34 loc) · 1.1 KB
/
desksms-contentscript.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
(function() {
console.log('desksms content script started.');
var sound;
var toast;
function settingsLooper() {
var newSound = localStorage['play-sound'];
if (newSound != sound) {
sound = newSound;
chrome.extension.sendRequest({"event": "sound", "sound": sound });
}
var newToast = localStorage['chrome-notifications'];
if (newToast != toast) {
toast = newToast;
chrome.extension.sendRequest({"event": "toast", "toast": toast });
}
}
settingsLooper();
var t;
function looper() {
var email = document.getElementById("chrome-extension-data").innerText;
if (email && email != '') {
console.log('notifying extension of login');
chrome.extension.sendRequest({"event": "login", "email": email });
return;
}
t = setTimeout(looper, 10000);
}
looper();
var exists = document.createElement('div');
exists.id = "has-chrome-extension";
exists.setAttribute("class","hidden");
exists.setAttribute("className","hidden");
document.getElementById('browser-extension-data').appendChild(exists);
})();