Code
Code
chrome.tabs.onRemoved.addListener((tabId) => {
console.log(`Tab ${tabId} closed, cleaning up storage.`);
chrome.storage.local.remove([`tab-${tabId}-fromFunSite`, `tab-${tabId}-
previous`, `tab-${tabId}-funUrl`]);
});
chrome.commands.onCommand.addListener((command) => {
if (command === 'shift_mode') {
chrome.tabs.query({active: true, currentWindow: true}, (tabs) => {
const tab = tabs[0];
if (!tab.url || tab.url.startsWith('chrome://')) {
console.log(`Cannot switch: Invalid URL: ${tab.url}`);
return;
}