Initial Phoenix analyzer
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
// Aktiviert den bestehenden Tab mit Ziel-URL (ohne Reload). Falls nicht offen, wird er geöffnet.
|
||||
function activateOrCreate(url) {
|
||||
chrome.tabs.query({}, tabs => {
|
||||
const t = tabs.find(tt => tt.url && tt.url.startsWith(url));
|
||||
if (t) { chrome.tabs.update(t.id, {active: true}); }
|
||||
else { chrome.tabs.create({url}); }
|
||||
});
|
||||
}
|
||||
|
||||
chrome.runtime.onMessage.addListener((msg, _sender, sendResponse) => {
|
||||
if (msg && msg.cmd === 'toggle') {
|
||||
if (msg.from === 'volumio') activateOrCreate('http://localhost:8088/');
|
||||
else activateOrCreate('http://localhost:3000/');
|
||||
sendResponse({ok:true});
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user