diff --git a/resources/index.html b/resources/index.html index d7c8ac2..c173ca5 100644 --- a/resources/index.html +++ b/resources/index.html @@ -43,7 +43,7 @@ const icons = []; let services = []; - let selectedService = 0; + let selectedService = null; let forwardButton; let backButton; let addButton; @@ -51,6 +51,11 @@ // Service context menu const serviceContextMenu = new Menu(); + serviceContextMenu.append(new MenuItem({ + label: 'Reload', click: () => { + reloadService(serviceContextMenu.serviceId); + } + })); serviceContextMenu.append(new MenuItem({ label: 'Close', click: () => { unloadService(serviceContextMenu.serviceId); @@ -267,6 +272,10 @@ updateNavigation(); service.li.classList.add('loaded'); service.viewReady = true; + + if (selectedService === null) { + setActiveService(serviceId); + } }); // Load favicon @@ -311,6 +320,16 @@ } } + function reloadService(serviceId) { + const service = services[serviceId]; + if (service.view && service.viewReady) { + document.querySelector('#services > .loader').classList.remove('hidden'); + service.view.reload(); + } else if (!service.view && !service.viewReady) { + loadService(serviceId, service); + } + } + function updateNavigation() { console.debug('Updating navigation'); // Update active list element