mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2025-12-18 15:17:42 +03:00
fix javascript issued
This commit is contained in:
parent
ba96a26b71
commit
f3810f3c69
@ -5,7 +5,7 @@ SRC_DIR = "src"
|
||||
|
||||
def minify_html(html: str) -> str:
|
||||
# Tags where whitespace should be preserved
|
||||
preserve_tags = ['pre', 'code', 'textarea']
|
||||
preserve_tags = ['pre', 'code', 'textarea', 'script', 'style']
|
||||
preserve_regex = '|'.join(preserve_tags)
|
||||
|
||||
# Protect preserve blocks with placeholders
|
||||
|
||||
@ -273,7 +273,7 @@ void CrossPointWebServer::handleFileList() {
|
||||
}
|
||||
}
|
||||
|
||||
// Page header with inline breadcrumb and +Add dropdown
|
||||
// Page header with inline breadcrumb and action buttons
|
||||
html += "<div class=\"page-header\">";
|
||||
html += "<div class=\"page-header-left\">";
|
||||
html += "<h1>📁 File Manager</h1>";
|
||||
@ -310,20 +310,14 @@ void CrossPointWebServer::handleFileList() {
|
||||
html += "</div>";
|
||||
html += "</div>";
|
||||
|
||||
// +Add dropdown button
|
||||
html += "<div class=\"add-dropdown\" id=\"addDropdown\">";
|
||||
html += "<button class=\"add-btn\" onclick=\"toggleDropdown()\">";
|
||||
html += "+ Add <span class=\"arrow\">▼</span>";
|
||||
// Action buttons
|
||||
html += "<div class=\"action-buttons\">";
|
||||
html += "<button class=\"action-btn upload-action-btn\" onclick=\"openUploadModal()\">";
|
||||
html += "📤 Upload";
|
||||
html += "</button>";
|
||||
html += "<div class=\"dropdown-menu\">";
|
||||
html += "<button class=\"dropdown-item\" onclick=\"openUploadModal()\">";
|
||||
html += "<span class=\"icon\">📤</span> Upload eBook";
|
||||
html += "<button class=\"action-btn folder-action-btn\" onclick=\"openFolderModal()\">";
|
||||
html += "📁 New Folder";
|
||||
html += "</button>";
|
||||
html += "<div class=\"dropdown-divider\"></div>";
|
||||
html += "<button class=\"dropdown-item\" onclick=\"openFolderModal()\">";
|
||||
html += "<span class=\"icon\">📁</span> New Folder";
|
||||
html += "</button>";
|
||||
html += "</div>";
|
||||
html += "</div>";
|
||||
|
||||
html += "</div>"; // end page-header
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
#include <GfxRenderer.h>
|
||||
#include <WiFi.h>
|
||||
#include <map>
|
||||
|
||||
#include "CrossPointWebServer.h"
|
||||
#include "WifiCredentialStore.h"
|
||||
@ -95,18 +96,35 @@ void WifiScreen::processWifiScanResults() {
|
||||
}
|
||||
|
||||
// Scan complete, process results
|
||||
networks.clear();
|
||||
// Use a map to deduplicate networks by SSID, keeping the strongest signal
|
||||
std::map<std::string, WifiNetworkInfo> uniqueNetworks;
|
||||
|
||||
for (int i = 0; i < scanResult; i++) {
|
||||
WifiNetworkInfo network;
|
||||
network.ssid = WiFi.SSID(i).c_str();
|
||||
network.rssi = WiFi.RSSI(i);
|
||||
network.isEncrypted = (WiFi.encryptionType(i) != WIFI_AUTH_OPEN);
|
||||
network.hasSavedPassword = WIFI_STORE.hasSavedCredential(network.ssid);
|
||||
|
||||
std::string ssid = WiFi.SSID(i).c_str();
|
||||
int32_t rssi = WiFi.RSSI(i);
|
||||
|
||||
// Skip hidden networks (empty SSID)
|
||||
if (!network.ssid.empty()) {
|
||||
networks.push_back(network);
|
||||
if (ssid.empty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check if we've already seen this SSID
|
||||
auto it = uniqueNetworks.find(ssid);
|
||||
if (it == uniqueNetworks.end() || rssi > it->second.rssi) {
|
||||
// New network or stronger signal than existing entry
|
||||
WifiNetworkInfo network;
|
||||
network.ssid = ssid;
|
||||
network.rssi = rssi;
|
||||
network.isEncrypted = (WiFi.encryptionType(i) != WIFI_AUTH_OPEN);
|
||||
network.hasSavedPassword = WIFI_STORE.hasSavedCredential(network.ssid);
|
||||
uniqueNetworks[ssid] = network;
|
||||
}
|
||||
}
|
||||
|
||||
// Convert map to vector
|
||||
networks.clear();
|
||||
for (const auto& pair : uniqueNetworks) {
|
||||
networks.push_back(pair.second);
|
||||
}
|
||||
|
||||
// Sort by signal strength (strongest first)
|
||||
|
||||
@ -52,26 +52,11 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// Dropdown toggle
|
||||
function toggleDropdown() {
|
||||
const dropdown = document.getElementById('addDropdown');
|
||||
dropdown.classList.toggle('open');
|
||||
}
|
||||
|
||||
// Close dropdown when clicking outside
|
||||
document.addEventListener('click', function(e) {
|
||||
const dropdown = document.getElementById('addDropdown');
|
||||
if (dropdown && !dropdown.contains(e.target)) {
|
||||
dropdown.classList.remove('open');
|
||||
}
|
||||
});
|
||||
|
||||
// Modal functions
|
||||
function openUploadModal() {
|
||||
const currentPath = document.getElementById('currentPath').value;
|
||||
document.getElementById('uploadPathDisplay').textContent = currentPath === '/' ? '/ 🏠' : currentPath;
|
||||
document.getElementById('uploadModal').classList.add('open');
|
||||
document.getElementById('addDropdown').classList.remove('open');
|
||||
}
|
||||
|
||||
function closeUploadModal() {
|
||||
@ -87,7 +72,6 @@
|
||||
const currentPath = document.getElementById('currentPath').value;
|
||||
document.getElementById('folderPathDisplay').textContent = currentPath === '/' ? '/ 🏠' : currentPath;
|
||||
document.getElementById('folderModal').classList.add('open');
|
||||
document.getElementById('addDropdown').classList.remove('open');
|
||||
document.getElementById('folderName').value = '';
|
||||
}
|
||||
|
||||
|
||||
@ -79,74 +79,34 @@
|
||||
.nav-links a:hover {
|
||||
background-color: #2980b9;
|
||||
}
|
||||
/* Add dropdown styles */
|
||||
.add-dropdown {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
/* Action buttons */
|
||||
.action-buttons {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
}
|
||||
.add-btn {
|
||||
background-color: #e67e22;
|
||||
.action-btn {
|
||||
color: white;
|
||||
padding: 10px 20px;
|
||||
padding: 10px 16px;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
font-size: 1em;
|
||||
font-size: 0.95em;
|
||||
font-weight: 600;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
.add-btn:hover {
|
||||
background-color: #d35400;
|
||||
.upload-action-btn {
|
||||
background-color: #27ae60;
|
||||
}
|
||||
.add-btn .arrow {
|
||||
font-size: 0.8em;
|
||||
transition: transform 0.2s;
|
||||
.upload-action-btn:hover {
|
||||
background-color: #219a52;
|
||||
}
|
||||
.add-dropdown.open .add-btn .arrow {
|
||||
transform: rotate(180deg);
|
||||
.folder-action-btn {
|
||||
background-color: #f39c12;
|
||||
}
|
||||
.dropdown-menu {
|
||||
display: none;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 100%;
|
||||
margin-top: 5px;
|
||||
background: white;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
||||
min-width: 200px;
|
||||
z-index: 100;
|
||||
overflow: hidden;
|
||||
}
|
||||
.add-dropdown.open .dropdown-menu {
|
||||
display: block;
|
||||
}
|
||||
.dropdown-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 12px 16px;
|
||||
cursor: pointer;
|
||||
border: none;
|
||||
background: none;
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
font-size: 1em;
|
||||
color: #2c3e50;
|
||||
transition: background-color 0.15s;
|
||||
}
|
||||
.dropdown-item:hover {
|
||||
background-color: #f8f9fa;
|
||||
}
|
||||
.dropdown-item .icon {
|
||||
font-size: 1.2em;
|
||||
}
|
||||
.dropdown-divider {
|
||||
height: 1px;
|
||||
background-color: #eee;
|
||||
margin: 0;
|
||||
.folder-action-btn:hover {
|
||||
background-color: #d68910;
|
||||
}
|
||||
/* Upload modal */
|
||||
.modal-overlay {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user