Added option to hide the video player controls button in the popup.

This commit is contained in:
Ajay Ramachandran
2019-07-12 19:04:24 -04:00
parent baa85cc7d3
commit 6af1f11a6f
4 changed files with 107 additions and 1 deletions

View File

@@ -3,6 +3,8 @@ document.getElementById("sponsorStart").addEventListener("click", sendSponsorSta
document.getElementById("clearTimes").addEventListener("click", clearTimes);
document.getElementById("submitTimes").addEventListener("click", submitTimes);
document.getElementById("showNoticeAgain").addEventListener("click", showNoticeAgain);
document.getElementById("hideVideoPlayerControls").addEventListener("click", hideVideoPlayerControls);
document.getElementById("showVideoPlayerControls").addEventListener("click", showVideoPlayerControls);
//if true, the button now selects the end time
var startTimeChosen = false;
@@ -25,6 +27,15 @@ chrome.storage.local.get(["dontShowNoticeAgain"], function(result) {
}
});
//show proper video player controls option
chrome.storage.local.get(["hideVideoPlayerControls"], function(result) {
let hideVideoPlayerControls = result.hideVideoPlayerControls;
if (hideVideoPlayerControls != undefined && hideVideoPlayerControls) {
document.getElementById("hideVideoPlayerControls").style.display = "none";
document.getElementById("showVideoPlayerControls").style.display = "unset";
}
});
chrome.tabs.query({
active: true,
currentWindow: true
@@ -230,6 +241,40 @@ function showNoticeAgain() {
document.getElementById("showNoticeAgain").style.display = "none";
}
function hideVideoPlayerControls() {
chrome.storage.local.set({"hideVideoPlayerControls": true});
chrome.tabs.query({
active: true,
currentWindow: true
}, function(tabs) {
chrome.tabs.sendMessage(tabs[0].id, {
message: "changeVideoPlayerControlsVisibility",
value: true
});
});
document.getElementById("hideVideoPlayerControls").style.display = "none";
document.getElementById("showVideoPlayerControls").style.display = "unset";
}
function showVideoPlayerControls() {
chrome.storage.local.set({"hideVideoPlayerControls": false});
chrome.tabs.query({
active: true,
currentWindow: true
}, function(tabs) {
chrome.tabs.sendMessage(tabs[0].id, {
message: "changeVideoPlayerControlsVisibility",
value: false
});
});
document.getElementById("hideVideoPlayerControls").style.display = "unset";
document.getElementById("showVideoPlayerControls").style.display = "none";
}
function updateStartTimeChosen() {
//update startTimeChosen variable
if (!startTimeChosen) {