diff --git a/template/admin_tabs.tpl b/template/admin_tabs.tpl index 5340a2f..ef8aea9 100644 --- a/template/admin_tabs.tpl +++ b/template/admin_tabs.tpl @@ -43,9 +43,33 @@ } function initNCConnectorPolling(){ - var section=document.getElementById('nc-connector');if(!section)return;var lastSeen=null;var endpoint='plugins/bratonien_tools/nc-connector-status.php'; - function wizardIsOpen(){var dialog=document.getElementById('bratonien-nc-wizard-dialog');if(dialog&&dialog.open)return true;try{return sessionStorage.getItem('bratonienNcWizardOpen')==='1';}catch(e){return false;}} - function poll(){fetch(endpoint+'?_='+Date.now(),{credentials:'same-origin',cache:'no-store'}).then(function(response){if(!response.ok)throw new Error('HTTP '+response.status);return response.json();}).then(function(data){var timestamp=parseInt(data.timestamp||0,10);if(!timestamp)return;if(lastSeen===null){lastSeen=timestamp;return;}if(timestamp>lastSeen){lastSeen=timestamp;if(!wizardIsOpen())window.location.reload();}}).catch(function(){});} + var section=document.getElementById('nc-connector');if(!section)return; + var endpoint='plugins/bratonien_tools/nc-connector-status.php'; + + function valueNodeForLabel(labelText){ + var labels=[].slice.call(section.querySelectorAll('.bratonien-label')); + for(var i=0;i