-
Notifications
You must be signed in to change notification settings - Fork 46
/
popup.js
29 lines (26 loc) · 911 Bytes
/
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
var btnUpdate = document.getElementById('btnUpdate');
btnUpdate.addEventListener('click', updateState);
chrome.runtime.sendMessage("getState", function(enabled){
enabled ? btnUpdate.innerHTML = "Disable" : btnUpdate.innerHTML = "Enable";
});
function updateState() {
chrome.runtime.sendMessage(btnUpdate.innerHTML);
if (btnUpdate.innerHTML == "Enable") {
btnUpdate.innerHTML = "Disable"
} else {
btnUpdate.innerHTML = "Enable"
}
window.close();
}
document.getElementById('btnSettings').addEventListener('click', function(){
chrome.runtime.openOptionsPage();
});
document.getElementById('btnPlayHlS').addEventListener('click', play_videos);
function play_videos(){
chrome.tabs.executeScript(null, {
file: 'hls.'+current_version+'.min.js'
}, function() {
chrome.tabs.executeScript(null, {file: 'embedded_videos.js'});
window.close();
});
}