Fix Volumio startup and online updates
This commit is contained in:
+40
-1
@@ -1 +1,40 @@
|
||||
(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){}})();
|
||||
(function () {
|
||||
try {
|
||||
const isVolumio = location.port === '3000';
|
||||
const button = document.createElement('button');
|
||||
const toggle = () => {
|
||||
chrome.runtime.sendMessage(
|
||||
{ cmd: 'toggle', from: isVolumio ? 'volumio' : 'analyzer' },
|
||||
() => {},
|
||||
);
|
||||
};
|
||||
|
||||
chrome.runtime.sendMessage({ cmd: 'bootstrap' }, () => {});
|
||||
|
||||
button.textContent = isVolumio ? 'Analyzer' : 'Volumio';
|
||||
Object.assign(button.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',
|
||||
});
|
||||
button.onmouseenter = () => { button.style.opacity = '1'; };
|
||||
button.onmouseleave = () => { button.style.opacity = '0.85'; };
|
||||
button.onclick = toggle;
|
||||
document.body.appendChild(button);
|
||||
window.addEventListener('keydown', event => {
|
||||
if (event.key.toLowerCase() === 't') {
|
||||
event.preventDefault();
|
||||
toggle();
|
||||
}
|
||||
}, { capture: true });
|
||||
} catch (_) {}
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user