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});
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
(function(){try{const e="3000"===location.port,t=document.createElement("button");function o(){chrome.runtime.sendMessage({cmd:"toggle",from:e?"volumio":"analyzer"},(()=>{}))}t.textContent=e?"Analyzer":"Volumio",Object.assign(t.style,{position:"fixed",right:"10px",top:"10px",zIndex:999999,font:"bold 14px ui-monospace,monospace",padding:"6px 10px",background:"#0b0b12",color:"#ddd",border:"1px solid #333",borderRadius:"8px",cursor:"pointer",opacity:"0.85"}),t.onmouseenter=()=>t.style.opacity="1",t.onmouseleave=()=>t.style.opacity="0.85",t.onclick=o,document.body.appendChild(t),window.addEventListener("keydown",(t=>{"t"===t.key.toLowerCase()&&(t.preventDefault(),o())}),{capture:!0})}catch(e){}})();
|
||||
@@ -0,0 +1,7 @@
|
||||
{ "manifest_version":3, "name":"DualTab Switch", "version":"1.2.0",
|
||||
"description":"Wechselt zwischen Volumio (3000) und Analyzer (8088) ohne Reload.",
|
||||
"permissions":["tabs"],
|
||||
"host_permissions":[ "http://localhost:3000/*", "http://localhost:8088/*", "http://127.0.0.1:3000/*", "http://127.0.0.1:8088/*" ],
|
||||
"background":{"service_worker":"bg.js"},
|
||||
"content_scripts":[{"matches":["http://localhost:3000/*","http://localhost:8088/*","http://127.0.0.1:3000/*","http://127.0.0.1:8088/*"],"js":["content.js"],"run_at":"document_end"}],
|
||||
"action":{"default_title":"DualTab Switch"} }
|
||||
Reference in New Issue
Block a user