Skip to content

Commit

Permalink
CO2 Gadget Beta v0.14.005
Browse files Browse the repository at this point in the history
Update web server files
  • Loading branch information
melkati committed Jun 8, 2024
1 parent ee4e3be commit 55b335c
Show file tree
Hide file tree
Showing 22 changed files with 56 additions and 71 deletions.
Binary file removed data/combined.js.gz
Binary file not shown.
Binary file modified data/index.html.gz
Binary file not shown.
Binary file added data/index.js.gz
Binary file not shown.
Binary file removed data/main.js.gz
Binary file not shown.
1 change: 0 additions & 1 deletion data/main.min.js

This file was deleted.

Binary file modified data/ota.html.gz
Binary file not shown.
Binary file added data/ota.js.gz
Binary file not shown.
Binary file modified data/preferences.html.gz
Binary file not shown.
Binary file modified data/preferences.js.gz
Binary file not shown.
1 change: 0 additions & 1 deletion data/preferences.min.js

This file was deleted.

Binary file modified data/status.html.gz
Binary file not shown.
Binary file modified data/status.js.gz
Binary file not shown.
1 change: 0 additions & 1 deletion data/status.min.js

This file was deleted.

Binary file modified data/style.css.gz
Binary file not shown.
64 changes: 16 additions & 48 deletions webserver/captiveportal.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,6 @@ var previousData = {
captivePortalNoTimeout: false
};

// CO2 Gadget Features: SUPPORT_BLE, SUPPORT_BUZZER, SUPPORT_ESPNOW, SUPPORT_MDNS, SUPPORT_MQTT, SUPPORT_MQTT_DISCOVERY, SUPPORT_OTA
// {
// "BLE": true,
// "Buzzer": true,
// "ESPNow": false,
// "mDNS": true,
// "MQTT": true,
// "MQTTDiscovery": true,
// "OTA": true
// }
var features = {
SUPPORT_BLE: false,
SUPPORT_BUZZER: false,
SUPPORT_ESPNOW: false,
SUPPORT_MDNS: false,
SUPPORT_MQTT: false,
SUPPORT_MQTT_DISCOVERY: false,
SUPPORT_OTA: false
};

/**
* Sets the captive portal settings and sends them to the server.
* @param {number} timeToWait - The time to wait for the captive portal.
Expand Down Expand Up @@ -267,20 +247,6 @@ function setupInitialSettings() {
setCaptivePortalSettings(60, true);
}

/**
* Adds the 'active' class to the current page link in the navigation bar.
*/
function highlightCurrentPage() {
const currentPage = window.location.pathname.split("/").pop();
const navLinks = document.querySelectorAll(".navbar .nav-content a");

navLinks.forEach(link => {
if (link.getAttribute("href") === currentPage) {
link.classList.add("active");
}
});
}

/**
* Initialize the captive portal for preferences.html.
*/
Expand Down Expand Up @@ -329,23 +295,25 @@ document.addEventListener("DOMContentLoaded", function () {
if (currentPage === "preferences.html") {
initializeCaptivePortal();
highlightCurrentPage(); // Highlight the current page in the navigation bar
} else {
if (captivePortalDebug) console.log('Not on preferences.html, skipping debug window initialization');
}

const debugWindow = document.getElementById('debug-window');
if (captivePortalDebug || debugWindowActive) {
if (debugWindow) {
createDebugWindow(debugWindow);
debugWindowActive = true;
debugWindow.style.display = 'block';
const debugWindow = document.getElementById('debug-window');
if (captivePortalDebug || debugWindowActive) {
if (debugWindow) {
createDebugWindow(debugWindow);
debugWindowActive = true;
debugWindow.style.display = 'block';
} else {
console.error('Element with ID "debug-window" not found.');
}
} else {
console.error('Element with ID "debug-window" not found.');
if (debugWindow) {
debugWindow.style.display = 'none';
debugWindowActive = false;
}
}
} else {
if (debugWindow) {
debugWindow.style.display = 'none';
debugWindowActive = false;
}
if (captivePortalDebug) console.log('Not on preferences.html, skipping debug window initialization');
}


});
27 changes: 26 additions & 1 deletion webserver/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,29 @@ var previousData = {
relaxedSecurity: false,
forcedCaptivePortalDebug: false,
captivePortalNoTimeout: false
};
};

// Global variables to store the CO2 Gadget features supported by the device (selected at compile time)
var features = {
SUPPORT_BLE: false,
SUPPORT_BUZZER: false,
SUPPORT_ESPNOW: false,
SUPPORT_MDNS: false,
SUPPORT_MQTT: false,
SUPPORT_MQTT_DISCOVERY: false,
SUPPORT_OTA: false
};

/**
* Adds the 'active' class to the current page link in the navigation bar.
*/
function highlightCurrentPage() {
const currentPage = window.location.pathname.split("/").pop();
const navLinks = document.querySelectorAll(".navbar .nav-content a");

navLinks.forEach(link => {
if (link.getAttribute("href") === currentPage) {
link.classList.add("active");
}
});
}
4 changes: 2 additions & 2 deletions webserver/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
})();
</script>
<link rel="stylesheet" type="text/css" href="./style.css" />
<script defer type="text/javascript" src="./main.js"></script>
<script defer type="text/javascript" src="./combined.js"></script>
<script defer type="text/javascript" src="./index.js"></script>
<!-- <script defer type="text/javascript" src="./combined.js"></script> -->
</head>

<body>
Expand Down
Loading

0 comments on commit 55b335c

Please sign in to comment.