mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-10 21:47:06 +03:00
Add refresh segments button
This commit is contained in:
14
src/popup.ts
14
src/popup.ts
@@ -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)
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user