diff --git a/web/index.html b/web/index.html index 093d106..dfd205f 100644 --- a/web/index.html +++ b/web/index.html @@ -92,8 +92,8 @@ #edit-content-content textarea, #edit-modal input, #edit-modal textarea { - background: #ffffff; - color: #222222; /* Dunkelgrau mit ausreichendem Kontrast gegen weiß (8.6:1) */ + background: #222222; + color: #ffffff; /* Weiß auf Dunkelgrau (#222222) */ border: 1px solid #cccccc; border-radius: 4px; padding: 8px; @@ -605,39 +605,59 @@ $ python web/serve.py const isObject = typeof value === 'object' && value !== null; const isArray = Array.isArray(value); - const label = document.createElement('label'); - label.htmlFor = `edit-${fullKey.replace(/[.\s]/g, '-')}`; - label.textContent = fullKey + (isObject ? ' (Objekt) ♦' : isArray ? ' (Array) ♦' : ''); - label.style.cssText = 'font-weight: 600; color: var(--text-primary); margin-bottom: 4px; font-size: 14px; margin-top: 8px;'; - formDiv.appendChild(label); - if (isObject && !isArray) { + const label = document.createElement('label'); + label.htmlFor = `edit-${fullKey.replace(/[.\s]/g, '-')}`; + label.textContent = fullKey + ' (Objekt) ♦'; + label.style.cssText = 'font-weight: 600; color: var(--text-primary); margin-bottom: 4px; font-size: 14px; margin-top: 8px;'; + formDiv.appendChild(label); + const input = document.createElement('textarea'); input.value = JSON.stringify(value, null, 2); input.dataset.key = fullKey; input.rows = Object.keys(value).length > 10 ? 10 : Object.keys(value).length; - input.style.cssText = 'width: 100%; padding: 8px; background: #ffffff; color: #222222; border: 1px solid #cccccc; border-radius: 4px; font-family: var(--mono); font-size: 13px; resize: vertical;'; + input.style.cssText = 'width: 100%; padding: 8px; background: #222222; color: #ffffff; border: 1px solid #cccccc; border-radius: 4px; font-family: var(--mono); font-size: 13px; resize: vertical;'; formDiv.appendChild(input); - } else if (isArray) { + return; + } + + if (isArray) { + const label = document.createElement('label'); + label.htmlFor = `edit-${fullKey.replace(/[.\s]/g, '-')}`; + label.textContent = fullKey + ' (Array) ♦'; + label.style.cssText = 'font-weight: 600; color: var(--text-primary); margin-bottom: 4px; font-size: 14px; margin-top: 8px;'; + formDiv.appendChild(label); + const input = document.createElement('textarea'); input.value = JSON.stringify(value); input.dataset.key = fullKey; input.rows = Math.min(value.length, 5); - input.style.cssText = 'width: 100%; padding: 8px; background: #ffffff; color: #222222; border: 1px solid #cccccc; border-radius: 4px; font-family: var(--mono); font-size: 13px; resize: vertical;'; - formDiv.appendChild(input); - } else { - const type = typeof value === 'boolean' ? 'checkbox' : typeof value === 'number' ? 'number' : 'text'; - const input = document.createElement('input'); - input.type = type; - input.value = value; - input.dataset.key = fullKey; - input.dataset.type = typeof value; - const displayValue = typeof value === 'boolean' ? value : String(value); - if (type === 'checkbox') input.checked = value; - else input.value = displayValue; - input.style.cssText = 'width: 100%; padding: 8px; background: #ffffff; color: #222222; border: 1px solid #cccccc; border-radius: 4px; font-family: var(--mono); font-size: 13px;'; + input.style.cssText = 'width: 100%; padding: 8px; background: #222222; color: #ffffff; border: 1px solid #cccccc; border-radius: 4px; font-family: var(--mono); font-size: 13px; resize: vertical;'; formDiv.appendChild(input); + return; } + + const fieldContainer = document.createElement('div'); + fieldContainer.style.cssText = 'background: var(--bg-input); padding: 8px; border-radius: 4px; border: 1px solid transparent;'; + + const label = document.createElement('label'); + label.htmlFor = `edit-${fullKey.replace(/[.\s]/g, '-')}`; + label.textContent = fullKey; + label.style.cssText = 'font-weight: 600; color: var(--text-primary); display: block; margin-bottom: 4px; font-size: 14px; margin-top: 0;'; + fieldContainer.appendChild(label); + + const type = typeof value === 'boolean' ? 'checkbox' : typeof value === 'number' ? 'number' : 'text'; + const input = document.createElement('input'); + input.type = type; + input.value = value; + input.dataset.key = fullKey; + input.dataset.type = typeof value; + const displayValue = typeof value === 'boolean' ? value : String(value); + if (type === 'checkbox') input.checked = value; + else input.value = displayValue; + input.style.cssText = 'width: 100%; padding: 8px; background: #222222; color: #ffffff; border: 1px solid #cccccc; border-radius: 4px; font-family: var(--mono); font-size: 13px;'; + fieldContainer.appendChild(input); + formDiv.appendChild(fieldContainer); }); } @@ -908,7 +928,7 @@ $ python web/serve.py

${t.description || 'Keine Beschreibung'}

- ${t.tags.map(tag => `#${tag}`).join('')} + ${t.tags.map(tag => `${tag.startsWith('#') ? tag : '#' + tag}`).join('')}
diff --git a/web/serve.py b/web/serve.py index 6b13623..fa2d725 100755 --- a/web/serve.py +++ b/web/serve.py @@ -92,8 +92,6 @@ class Handler(http.server.SimpleHTTPRequestHandler): if os.path.exists(file_path) and not os.path.isdir(file_path): try: - self.path = file_path - # Einfach die Datei senden with open(file_path, 'rb') as f: self.send_response(200) self.send_header('Content-type', 'text/plain' if file_path.endswith('.md') else 'application/json')