mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-10 05:27:03 +03:00
Add indicator where current player is for segments in popup
This commit is contained in:
@@ -14,6 +14,8 @@ const utils = new Utils({
|
||||
unregisterFirefoxContentScript
|
||||
});
|
||||
|
||||
const popupPort: Record<string, chrome.runtime.Port> = {};
|
||||
|
||||
// Used only on Firefox, which does not support non persistent background pages.
|
||||
const contentScriptRegistrations = {};
|
||||
|
||||
@@ -53,7 +55,7 @@ if (!Config.configSyncListeners.includes(onNavigationApiAvailableChange)) {
|
||||
Config.configSyncListeners.push(onNavigationApiAvailableChange);
|
||||
}
|
||||
|
||||
chrome.runtime.onMessage.addListener(function (request, _, callback) {
|
||||
chrome.runtime.onMessage.addListener(function (request, sender, callback) {
|
||||
switch(request.message) {
|
||||
case "openConfig":
|
||||
chrome.tabs.create({url: chrome.runtime.getURL('options/options.html' + (request.hash ? '#' + request.hash : ''))});
|
||||
@@ -100,9 +102,25 @@ chrome.runtime.onMessage.addListener(function (request, _, callback) {
|
||||
});
|
||||
return true;
|
||||
}
|
||||
case "time":
|
||||
if (sender.tab) {
|
||||
popupPort[sender.tab.id].postMessage(request);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
chrome.runtime.onConnect.addListener((port) => {
|
||||
if (port.name === "popup") {
|
||||
chrome.tabs.query({
|
||||
active: true,
|
||||
currentWindow: true
|
||||
}, tabs => {
|
||||
popupPort[tabs[0].id] = port;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
//add help page on install
|
||||
chrome.runtime.onInstalled.addListener(function () {
|
||||
// This let's the config sync to run fully before checking.
|
||||
|
||||
Reference in New Issue
Block a user