Add refresh segments button

This commit is contained in:
Ajay Ramachandran
2021-07-04 16:12:41 -04:00
parent 0ae34c9603
commit 7f8947dd0a
8 changed files with 43 additions and 16 deletions

View File

@@ -102,6 +102,7 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
"videoFound",
"sponsorMessageTimes",
//"downloadedSponsorMessageTimes",
"refreshSegmentsButton",
"whitelistButton",
"sbDonate"
].forEach(id => PageElements[id] = document.getElementById(id));
@@ -131,6 +132,7 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
PageElements.submitUsername.addEventListener("click", submitUsername);
PageElements.optionsButton.addEventListener("click", openOptions);
PageElements.helpButton.addEventListener("click", openHelp);
PageElements.refreshSegmentsButton.addEventListener("click", refreshSegments);
/** If true, the content script is in the process of creating a new segment. */
let creatingSegment = false;
@@ -676,6 +678,18 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
});
}
function refreshSegments() {
messageHandler.query({
active: true,
currentWindow: true
}, tabs => {
messageHandler.sendMessage(
tabs[0].id,
{message: 'refreshSegments'}
)}
);
}
/**
* Should skipping be disabled (visuals stay)
*/