forked from iann0036/AWSConsoleRecorder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
popup.js
50 lines (45 loc) · 1.51 KB
/
popup.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
var recording = false;
function toggleRecording() {
if (recording) {
chrome.runtime.sendMessage(null, {
"action": "setRecordingOff"
}, null, function(resp){
chrome.tabs.create({
url: chrome.extension.getURL("main.html")
});
window.close();
});
} else {
chrome.runtime.sendMessage(null, {
"action": "setRecordingOn"
}, null, function(resp){
window.close();
});
}
}
document.addEventListener('DOMContentLoaded', function () {
document.getElementById('recordButton').addEventListener('click', toggleRecording);
updatePopupUI();
});
function updatePopupUI() {
chrome.runtime.sendMessage(null, {
"action": "getRecordingStatus"
}, null, function(recording_status){
recording = recording_status;
if (recording) {
document.getElementById('recordButton').innerHTML = "Stop Recording";
document.getElementById('recordButton').setAttribute('class','btn btn-hover btn-danger btn-block');
} else {
document.getElementById('recordButton').innerHTML = "Start Recording";
document.getElementById('recordButton').setAttribute('class','btn btn-hover btn-success btn-block');
}
});
};
window.onload = function() {
document.getElementById('dashLink').onclick = function () {
chrome.tabs.create({
url: chrome.extension.getURL("main.html")
});
window.close();
};
}