1
0
mirror of https://github.com/thooge/esp32-nmea2000-obp60.git synced 2025-12-13 05:53:06 +01:00

#19: add help tab, allow to set the help URL with the HELP_URL capability

This commit is contained in:
andreas
2022-03-02 11:23:31 +01:00
parent 785ece971e
commit a288959009
5 changed files with 17 additions and 2 deletions

View File

@@ -21,6 +21,7 @@
<div class="tab" data-page="xdrPage">XDR</div>
<div class="tab" data-page="dashboardPage">Data</div>
<div class="tab" data-page="updatePage">Update</div>
<div class="tab" data-url="https://github.com/wellenvogel/esp32-nmea2000" data-window="help" id="helpButton">Help</div>
</div>
<div id="statusPage" class="tabPage">
<div id="statusPageContent">

View File

@@ -1073,6 +1073,10 @@ function createConfigDefinitions(parent, capabilities, defs,includeXdr) {
function loadConfigDefinitions() {
getJson("api/capabilities")
.then(function (capabilities) {
if (capabilities.HELP_URL){
let el=document.getElementById('helpButton');
if (el) el.setAttribute('data-url',capabilities.HELP_URL);
}
getJson("config.json")
.then(function (defs) {
getJson("xdrconfig.json")
@@ -1191,7 +1195,11 @@ function converterInfo() {
}
function handleTab(el) {
let activeName = el.getAttribute('data-page');
if (!activeName) return;
if (!activeName) {
let extUrl= el.getAttribute('data-url');
if (! extUrl) return;
window.open(extUrl,el.getAttribute('data-window')||'_');
}
let activeTab = document.getElementById(activeName);
if (!activeTab) return;
let all = document.querySelectorAll('.tabPage');