ux improvements

This commit is contained in:
overcuriousity 2025-09-27 22:42:41 +02:00
parent 51a3aacb38
commit 268f78f04c

View File

@ -203,6 +203,12 @@
font-size: 0.95em; font-size: 0.95em;
} }
.unit-indicator {
color: #88cc88;
font-weight: bold;
font-size: 0.85em;
}
.input-group input { .input-group input {
padding: 12px; padding: 12px;
background-color: #333333; background-color: #333333;
@ -226,6 +232,7 @@
align-items: center; align-items: center;
padding: 10px 0; padding: 10px 0;
border-bottom: 1px solid #3a3a3a; border-bottom: 1px solid #3a3a3a;
position: relative;
} }
.result-item:last-child { .result-item:last-child {
@ -236,6 +243,13 @@
color: #cccccc; color: #cccccc;
font-weight: normal; font-weight: normal;
flex: 1; flex: 1;
cursor: help;
}
.result-value-container {
display: flex;
align-items: center;
gap: 8px;
} }
.result-value { .result-value {
@ -244,6 +258,44 @@
text-align: right; text-align: right;
font-weight: bold; font-weight: bold;
min-width: 120px; min-width: 120px;
cursor: help;
}
.copy-btn {
background: none;
border: none;
color: #888888;
cursor: pointer;
padding: 4px;
border-radius: 3px;
transition: all 0.2s;
font-size: 14px;
}
.copy-btn:hover {
color: #ffffff;
background-color: #404040;
}
.copy-btn:active {
color: #88cc88;
}
/* Tooltip */
.tooltip {
position: absolute;
background-color: #1a1a1a;
color: #ffffff;
padding: 8px 12px;
border-radius: 4px;
font-size: 0.85em;
border: 1px solid #555555;
z-index: 1000;
max-width: 400px;
word-wrap: break-word;
box-shadow: 0 4px 8px rgba(0,0,0,0.3);
font-family: 'Consolas', monospace;
line-height: 1.4;
} }
@media (max-width: 600px) { @media (max-width: 600px) {
@ -378,11 +430,11 @@
<h2>Konstanten</h2> <h2>Konstanten</h2>
<div class="input-grid"> <div class="input-grid">
<div class="input-group"> <div class="input-group">
<label for="baseOffset1216">Base Offset (Partition Start):</label> <label for="baseOffset1216">Base Offset <span class="unit-indicator">(Bytes)</span>:</label>
<input type="text" id="baseOffset1216" value="0x0" placeholder="0x0"> <input type="text" id="baseOffset1216" value="0x0" placeholder="0x0">
</div> </div>
<div class="input-group"> <div class="input-group">
<label for="sectorSize1216">Größe eines Sektors (Bytes):</label> <label for="sectorSize1216">Größe eines Sektors <span class="unit-indicator">(Bytes)</span>:</label>
<input type="text" id="sectorSize1216" value="0x200" placeholder="0x200"> <input type="text" id="sectorSize1216" value="0x200" placeholder="0x200">
</div> </div>
</div> </div>
@ -392,31 +444,31 @@
<h2>Eingabeparameter</h2> <h2>Eingabeparameter</h2>
<div class="input-grid"> <div class="input-grid">
<div class="input-group"> <div class="input-group">
<label for="reservedSectors1216">Anzahl reservierter Sektoren:</label> <label for="reservedSectors1216">Anzahl reservierter Sektoren <span class="unit-indicator">(Sektoren)</span>:</label>
<input type="text" id="reservedSectors1216" placeholder="0x1"> <input type="text" id="reservedSectors1216" placeholder="0x1">
</div> </div>
<div class="input-group"> <div class="input-group">
<label for="numFATs1216">Anzahl FATs:</label> <label for="numFATs1216">Anzahl FATs <span class="unit-indicator">(Anzahl)</span>:</label>
<input type="text" id="numFATs1216" placeholder="0x2"> <input type="text" id="numFATs1216" placeholder="0x2">
</div> </div>
<div class="input-group"> <div class="input-group">
<label for="fatSizeBytes1216">Größe einer FAT (Bytes):</label> <label for="fatSizeBytes1216">Größe einer FAT <span class="unit-indicator">(Bytes)</span>:</label>
<input type="text" id="fatSizeBytes1216" placeholder="0x1000"> <input type="text" id="fatSizeBytes1216" placeholder="0x1000">
</div> </div>
<div class="input-group"> <div class="input-group">
<label for="maxRootEntries1216">Anzahl max. Wurzelverzeichnis-Einträge:</label> <label for="maxRootEntries1216">Max. Wurzelverzeichnis-Einträge <span class="unit-indicator">(Anzahl)</span>:</label>
<input type="text" id="maxRootEntries1216" placeholder="0x200"> <input type="text" id="maxRootEntries1216" placeholder="0x200">
</div> </div>
<div class="input-group"> <div class="input-group">
<label for="partitionSize1216">Größe Partition (Bytes):</label> <label for="partitionSizeInSectors1216">Größe Partition <span class="unit-indicator">(Sektoren)</span>:</label>
<input type="text" id="partitionSize1216" placeholder="0x100000"> <input type="text" id="partitionSizeInSectors1216" placeholder="0x4015">
</div> </div>
<div class="input-group"> <div class="input-group">
<label for="clusterSizeSectors1216">Größe eines Clusters (Sektoren):</label> <label for="clusterSizeSectors1216">Größe eines Clusters <span class="unit-indicator">(Sektoren)</span>:</label>
<input type="text" id="clusterSizeSectors1216" placeholder="0x1"> <input type="text" id="clusterSizeSectors1216" placeholder="0x1">
</div> </div>
<div class="input-group"> <div class="input-group">
<label for="clusterNumber1216">Cluster Nummer (für Position):</label> <label for="clusterNumber1216">Cluster Nummer für Position <span class="unit-indicator">(Nummer)</span>:</label>
<input type="text" id="clusterNumber1216" placeholder="0x2"> <input type="text" id="clusterNumber1216" placeholder="0x2">
</div> </div>
</div> </div>
@ -426,40 +478,67 @@
<h2>Berechnete Werte</h2> <h2>Berechnete Werte</h2>
<div id="results1216"> <div id="results1216">
<div class="result-item"> <div class="result-item">
<span class="result-label">Beginn FAT-Bereich:</span> <span class="result-label" data-formula="reservedSectors × sectorSize + baseOffset">Beginn FAT-Bereich:</span>
<span class="result-value" id="fatStart1216">-</span> <div class="result-value-container">
<span class="result-value" id="fatStart1216" data-result-formula="">-</span>
<button class="copy-btn" onclick="copyToClipboard('fatStart1216')" title="Copy to clipboard">📋</button>
</div>
</div> </div>
<div class="result-item"> <div class="result-item">
<span class="result-label">Größe FAT-Bereich:</span> <span class="result-label" data-formula="numFATs × fatSizeBytes">Größe FAT-Bereich:</span>
<span class="result-value" id="fatSize1216">-</span> <div class="result-value-container">
<span class="result-value" id="fatSize1216" data-result-formula="">-</span>
<button class="copy-btn" onclick="copyToClipboard('fatSize1216')" title="Copy to clipboard">📋</button>
</div>
</div> </div>
<div class="result-item"> <div class="result-item">
<span class="result-label">Ende FAT-Bereich:</span> <span class="result-label" data-formula="fatStart + fatSize">Ende FAT-Bereich:</span>
<span class="result-value" id="fatEnd1216">-</span> <div class="result-value-container">
<span class="result-value" id="fatEnd1216" data-result-formula="">-</span>
<button class="copy-btn" onclick="copyToClipboard('fatEnd1216')" title="Copy to clipboard">📋</button>
</div>
</div> </div>
<div class="result-item"> <div class="result-item">
<span class="result-label">Größe Wurzelverzeichnis:</span> <span class="result-label" data-formula="maxRootEntries × 0x20">Größe Wurzelverzeichnis:</span>
<span class="result-value" id="rootDirSize1216">-</span> <div class="result-value-container">
<span class="result-value" id="rootDirSize1216" data-result-formula="">-</span>
<button class="copy-btn" onclick="copyToClipboard('rootDirSize1216')" title="Copy to clipboard">📋</button>
</div>
</div> </div>
<div class="result-item"> <div class="result-item">
<span class="result-label">Beginn Daten-Bereich:</span> <span class="result-label" data-formula="fatEnd + rootDirSize">Beginn Daten-Bereich:</span>
<span class="result-value" id="dataStart1216">-</span> <div class="result-value-container">
<span class="result-value" id="dataStart1216" data-result-formula="">-</span>
<button class="copy-btn" onclick="copyToClipboard('dataStart1216')" title="Copy to clipboard">📋</button>
</div>
</div> </div>
<div class="result-item"> <div class="result-item">
<span class="result-label">Größe Daten-Bereich:</span> <span class="result-label" data-formula="(partitionSizeInSectors × sectorSize) - (dataStart - baseOffset)">Größe Daten-Bereich:</span>
<span class="result-value" id="dataSize1216">-</span> <div class="result-value-container">
<span class="result-value" id="dataSize1216" data-result-formula="">-</span>
<button class="copy-btn" onclick="copyToClipboard('dataSize1216')" title="Copy to clipboard">📋</button>
</div>
</div> </div>
<div class="result-item"> <div class="result-item">
<span class="result-label">Größe eines Clusters:</span> <span class="result-label" data-formula="sectorSize × clusterSizeSectors">Größe eines Clusters:</span>
<span class="result-value" id="clusterSize1216">-</span> <div class="result-value-container">
<span class="result-value" id="clusterSize1216" data-result-formula="">-</span>
<button class="copy-btn" onclick="copyToClipboard('clusterSize1216')" title="Copy to clipboard">📋</button>
</div>
</div> </div>
<div class="result-item"> <div class="result-item">
<span class="result-label">Anzahl Cluster:</span> <span class="result-label" data-formula="dataSize ÷ clusterSize">Anzahl Cluster:</span>
<span class="result-value" id="numClusters1216">-</span> <div class="result-value-container">
<span class="result-value" id="numClusters1216" data-result-formula="">-</span>
<button class="copy-btn" onclick="copyToClipboard('numClusters1216')" title="Copy to clipboard">📋</button>
</div>
</div> </div>
<div class="result-item"> <div class="result-item">
<span class="result-label">Beginn Cluster:</span> <span class="result-label" data-formula="dataStart + (clusterNumber - 0x2) × clusterSize">Beginn Cluster:</span>
<span class="result-value" id="clusterStart1216">-</span> <div class="result-value-container">
<span class="result-value" id="clusterStart1216" data-result-formula="">-</span>
<button class="copy-btn" onclick="copyToClipboard('clusterStart1216')" title="Copy to clipboard">📋</button>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -472,7 +551,7 @@
<div class="formula"><span class="calculated">Ende FAT-Bereich</span> = Beginn FAT-Bereich + Größe FAT-Bereich</div> <div class="formula"><span class="calculated">Ende FAT-Bereich</span> = Beginn FAT-Bereich + Größe FAT-Bereich</div>
<div class="formula"><span class="calculated">Größe Wurzelverzeichnis</span> = Anzahl max. Wurzelverzeichnis-Einträge × 0x20</div> <div class="formula"><span class="calculated">Größe Wurzelverzeichnis</span> = Anzahl max. Wurzelverzeichnis-Einträge × 0x20</div>
<div class="formula"><span class="calculated">Beginn Daten-Bereich</span> = Ende FAT-Bereich + Größe Wurzelverzeichnis</div> <div class="formula"><span class="calculated">Beginn Daten-Bereich</span> = Ende FAT-Bereich + Größe Wurzelverzeichnis</div>
<div class="formula"><span class="calculated">Größe Daten-Bereich</span> = Größe Partition - (Beginn Daten-Bereich - Base Offset)</div> <div class="formula"><span class="calculated">Größe Daten-Bereich</span> = (Größe Partition in Sektoren × Größe eines Sektors) - (Beginn Daten-Bereich - Base Offset)</div>
<div class="formula"><span class="calculated">Größe eines Clusters</span> = Größe eines Sektors × Größe eines Clusters in Sektoren</div> <div class="formula"><span class="calculated">Größe eines Clusters</span> = Größe eines Sektors × Größe eines Clusters in Sektoren</div>
<div class="formula"><span class="calculated">Anzahl Cluster</span> = Größe Daten-Bereich ÷ Größe eines Clusters</div> <div class="formula"><span class="calculated">Anzahl Cluster</span> = Größe Daten-Bereich ÷ Größe eines Clusters</div>
<div class="formula"><span class="calculated">Beginn Cluster</span> = Beginn Daten-Bereich + (Cluster - 0x2) × Größe eines Clusters</div> <div class="formula"><span class="calculated">Beginn Cluster</span> = Beginn Daten-Bereich + (Cluster - 0x2) × Größe eines Clusters</div>
@ -486,11 +565,11 @@
<h2>Konstanten</h2> <h2>Konstanten</h2>
<div class="input-grid"> <div class="input-grid">
<div class="input-group"> <div class="input-group">
<label for="baseOffset32">Base Offset (Partition Start):</label> <label for="baseOffset32">Base Offset <span class="unit-indicator">(Bytes)</span>:</label>
<input type="text" id="baseOffset32" value="0x0" placeholder="0x0"> <input type="text" id="baseOffset32" value="0x0" placeholder="0x0">
</div> </div>
<div class="input-group"> <div class="input-group">
<label for="sectorSize32">Größe eines Sektors (Bytes):</label> <label for="sectorSize32">Größe eines Sektors <span class="unit-indicator">(Bytes)</span>:</label>
<input type="text" id="sectorSize32" value="0x200" placeholder="0x200"> <input type="text" id="sectorSize32" value="0x200" placeholder="0x200">
</div> </div>
</div> </div>
@ -500,31 +579,31 @@
<h2>Eingabeparameter</h2> <h2>Eingabeparameter</h2>
<div class="input-grid"> <div class="input-grid">
<div class="input-group"> <div class="input-group">
<label for="reservedSectors32">Anzahl reservierter Sektoren:</label> <label for="reservedSectors32">Anzahl reservierter Sektoren <span class="unit-indicator">(Sektoren)</span>:</label>
<input type="text" id="reservedSectors32" placeholder="0x20"> <input type="text" id="reservedSectors32" placeholder="0x20">
</div> </div>
<div class="input-group"> <div class="input-group">
<label for="numFATs32">Anzahl FATs:</label> <label for="numFATs32">Anzahl FATs <span class="unit-indicator">(Anzahl)</span>:</label>
<input type="text" id="numFATs32" placeholder="0x2"> <input type="text" id="numFATs32" placeholder="0x2">
</div> </div>
<div class="input-group"> <div class="input-group">
<label for="fatSizeBytes32">Größe einer FAT (Bytes):</label> <label for="fatSizeBytes32">Größe einer FAT <span class="unit-indicator">(Bytes)</span>:</label>
<input type="text" id="fatSizeBytes32" placeholder="0x10000"> <input type="text" id="fatSizeBytes32" placeholder="0x10000">
</div> </div>
<div class="input-group"> <div class="input-group">
<label for="rootDirCluster32">Root Directory Cluster:</label> <label for="rootDirCluster32">Root Directory Cluster <span class="unit-indicator">(Nummer)</span>:</label>
<input type="text" id="rootDirCluster32" placeholder="0x2"> <input type="text" id="rootDirCluster32" placeholder="0x2">
</div> </div>
<div class="input-group"> <div class="input-group">
<label for="partitionSize32">Größe Partition (Bytes):</label> <label for="partitionSizeInSectors32">Größe Partition <span class="unit-indicator">(Sektoren)</span>:</label>
<input type="text" id="partitionSize32" placeholder="0x10000000"> <input type="text" id="partitionSizeInSectors32" placeholder="0x20000">
</div> </div>
<div class="input-group"> <div class="input-group">
<label for="clusterSizeSectors32">Größe eines Clusters (Sektoren):</label> <label for="clusterSizeSectors32">Größe eines Clusters <span class="unit-indicator">(Sektoren)</span>:</label>
<input type="text" id="clusterSizeSectors32" placeholder="0x8"> <input type="text" id="clusterSizeSectors32" placeholder="0x8">
</div> </div>
<div class="input-group"> <div class="input-group">
<label for="clusterNumber32">Cluster Nummer (für Position):</label> <label for="clusterNumber32">Cluster Nummer für Position <span class="unit-indicator">(Nummer)</span>:</label>
<input type="text" id="clusterNumber32" placeholder="0x2"> <input type="text" id="clusterNumber32" placeholder="0x2">
</div> </div>
</div> </div>
@ -534,40 +613,67 @@
<h2>Berechnete Werte</h2> <h2>Berechnete Werte</h2>
<div id="results32"> <div id="results32">
<div class="result-item"> <div class="result-item">
<span class="result-label">Beginn FAT-Bereich:</span> <span class="result-label" data-formula="reservedSectors × sectorSize + baseOffset">Beginn FAT-Bereich:</span>
<span class="result-value" id="fatStart32">-</span> <div class="result-value-container">
<span class="result-value" id="fatStart32" data-result-formula="">-</span>
<button class="copy-btn" onclick="copyToClipboard('fatStart32')" title="Copy to clipboard">📋</button>
</div>
</div> </div>
<div class="result-item"> <div class="result-item">
<span class="result-label">Größe FAT-Bereich:</span> <span class="result-label" data-formula="numFATs × fatSizeBytes">Größe FAT-Bereich:</span>
<span class="result-value" id="fatSize32">-</span> <div class="result-value-container">
<span class="result-value" id="fatSize32" data-result-formula="">-</span>
<button class="copy-btn" onclick="copyToClipboard('fatSize32')" title="Copy to clipboard">📋</button>
</div>
</div> </div>
<div class="result-item"> <div class="result-item">
<span class="result-label">Ende FAT-Bereich:</span> <span class="result-label" data-formula="fatStart + fatSize">Ende FAT-Bereich:</span>
<span class="result-value" id="fatEnd32">-</span> <div class="result-value-container">
<span class="result-value" id="fatEnd32" data-result-formula="">-</span>
<button class="copy-btn" onclick="copyToClipboard('fatEnd32')" title="Copy to clipboard">📋</button>
</div>
</div> </div>
<div class="result-item"> <div class="result-item">
<span class="result-label">Beginn Daten-Bereich:</span> <span class="result-label" data-formula="fatEnd">Beginn Daten-Bereich:</span>
<span class="result-value" id="dataStart32">-</span> <div class="result-value-container">
<span class="result-value" id="dataStart32" data-result-formula="">-</span>
<button class="copy-btn" onclick="copyToClipboard('dataStart32')" title="Copy to clipboard">📋</button>
</div>
</div> </div>
<div class="result-item"> <div class="result-item">
<span class="result-label">Größe Daten-Bereich:</span> <span class="result-label" data-formula="(partitionSizeInSectors × sectorSize) - (dataStart - baseOffset)">Größe Daten-Bereich:</span>
<span class="result-value" id="dataSize32">-</span> <div class="result-value-container">
<span class="result-value" id="dataSize32" data-result-formula="">-</span>
<button class="copy-btn" onclick="copyToClipboard('dataSize32')" title="Copy to clipboard">📋</button>
</div>
</div> </div>
<div class="result-item"> <div class="result-item">
<span class="result-label">Größe eines Clusters:</span> <span class="result-label" data-formula="sectorSize × clusterSizeSectors">Größe eines Clusters:</span>
<span class="result-value" id="clusterSize32">-</span> <div class="result-value-container">
<span class="result-value" id="clusterSize32" data-result-formula="">-</span>
<button class="copy-btn" onclick="copyToClipboard('clusterSize32')" title="Copy to clipboard">📋</button>
</div>
</div> </div>
<div class="result-item"> <div class="result-item">
<span class="result-label">Anzahl Cluster:</span> <span class="result-label" data-formula="dataSize ÷ clusterSize">Anzahl Cluster:</span>
<span class="result-value" id="numClusters32">-</span> <div class="result-value-container">
<span class="result-value" id="numClusters32" data-result-formula="">-</span>
<button class="copy-btn" onclick="copyToClipboard('numClusters32')" title="Copy to clipboard">📋</button>
</div>
</div> </div>
<div class="result-item"> <div class="result-item">
<span class="result-label">Beginn Cluster:</span> <span class="result-label" data-formula="dataStart + (clusterNumber - 0x2) × clusterSize">Beginn Cluster:</span>
<span class="result-value" id="clusterStart32">-</span> <div class="result-value-container">
<span class="result-value" id="clusterStart32" data-result-formula="">-</span>
<button class="copy-btn" onclick="copyToClipboard('clusterStart32')" title="Copy to clipboard">📋</button>
</div>
</div> </div>
<div class="result-item"> <div class="result-item">
<span class="result-label">Root Directory Position:</span> <span class="result-label" data-formula="dataStart + (rootDirCluster - 0x2) × clusterSize">Root Directory Position:</span>
<span class="result-value" id="rootDirPos32">-</span> <div class="result-value-container">
<span class="result-value" id="rootDirPos32" data-result-formula="">-</span>
<button class="copy-btn" onclick="copyToClipboard('rootDirPos32')" title="Copy to clipboard">📋</button>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -579,7 +685,7 @@
<div class="formula"><span class="calculated">Größe FAT-Bereich</span> = Anzahl FATs × Größe einer FAT</div> <div class="formula"><span class="calculated">Größe FAT-Bereich</span> = Anzahl FATs × Größe einer FAT</div>
<div class="formula"><span class="calculated">Ende FAT-Bereich</span> = Beginn FAT-Bereich + Größe FAT-Bereich</div> <div class="formula"><span class="calculated">Ende FAT-Bereich</span> = Beginn FAT-Bereich + Größe FAT-Bereich</div>
<div class="formula"><span class="calculated">Beginn Daten-Bereich</span> = Ende FAT-Bereich (kein festes Root Directory)</div> <div class="formula"><span class="calculated">Beginn Daten-Bereich</span> = Ende FAT-Bereich (kein festes Root Directory)</div>
<div class="formula"><span class="calculated">Größe Daten-Bereich</span> = Größe Partition - (Beginn Daten-Bereich - Base Offset)</div> <div class="formula"><span class="calculated">Größe Daten-Bereich</span> = (Größe Partition in Sektoren × Größe eines Sektors) - (Beginn Daten-Bereich - Base Offset)</div>
<div class="formula"><span class="calculated">Größe eines Clusters</span> = Größe eines Sektors × Größe eines Clusters in Sektoren</div> <div class="formula"><span class="calculated">Größe eines Clusters</span> = Größe eines Sektors × Größe eines Clusters in Sektoren</div>
<div class="formula"><span class="calculated">Anzahl Cluster</span> = Größe Daten-Bereich ÷ Größe eines Clusters</div> <div class="formula"><span class="calculated">Anzahl Cluster</span> = Größe Daten-Bereich ÷ Größe eines Clusters</div>
<div class="formula"><span class="calculated">Beginn Cluster</span> = Beginn Daten-Bereich + (Cluster - 0x2) × Größe eines Clusters</div> <div class="formula"><span class="calculated">Beginn Cluster</span> = Beginn Daten-Bereich + (Cluster - 0x2) × Größe eines Clusters</div>
@ -595,7 +701,7 @@
<div class="footer-section"> <div class="footer-section">
<h3>About</h3> <h3>About</h3>
<p>Filesystem calculator for educational and forensic purposes.</p> <p>Filesystem calculator for educational and forensic purposes.</p>
<p>Version 0.1.0</p> <p>Version 0.2.0</p>
</div> </div>
<div class="footer-section"> <div class="footer-section">
<h3>Support</h3> <h3>Support</h3>
@ -619,10 +725,55 @@
</footer> </footer>
<script> <script>
// Global tooltip element
let tooltip = null;
// Create tooltip element
function createTooltip() {
if (!tooltip) {
tooltip = document.createElement('div');
tooltip.className = 'tooltip';
tooltip.style.display = 'none';
document.body.appendChild(tooltip);
}
}
// Show tooltip
function showTooltip(element, text) {
createTooltip();
tooltip.innerHTML = text;
tooltip.style.display = 'block';
const rect = element.getBoundingClientRect();
const tooltipRect = tooltip.getBoundingClientRect();
let left = rect.left + (rect.width / 2) - (tooltipRect.width / 2);
let top = rect.top - tooltipRect.height - 8;
// Keep tooltip within viewport
if (left < 10) left = 10;
if (left + tooltipRect.width > window.innerWidth - 10) {
left = window.innerWidth - tooltipRect.width - 10;
}
if (top < 10) {
top = rect.bottom + 8;
}
tooltip.style.left = left + 'px';
tooltip.style.top = top + 'px';
}
// Hide tooltip
function hideTooltip() {
if (tooltip) {
tooltip.style.display = 'none';
}
}
// Filesystem calculation implementations // Filesystem calculation implementations
const filesystems = { const filesystems = {
fat1216: { fat1216: {
requiredFields: ['reservedSectors1216', 'numFATs1216', 'fatSizeBytes1216', 'maxRootEntries1216', 'partitionSize1216', 'clusterSizeSectors1216'], requiredFields: ['reservedSectors1216', 'numFATs1216', 'fatSizeBytes1216', 'maxRootEntries1216', 'partitionSizeInSectors1216', 'clusterSizeSectors1216'],
calculate: function() { calculate: function() {
const baseOffset = parseHex(document.getElementById('baseOffset1216').value); const baseOffset = parseHex(document.getElementById('baseOffset1216').value);
const sectorSize = parseHex(document.getElementById('sectorSize1216').value); const sectorSize = parseHex(document.getElementById('sectorSize1216').value);
@ -630,7 +781,7 @@
const numFATs = parseHex(document.getElementById('numFATs1216').value); const numFATs = parseHex(document.getElementById('numFATs1216').value);
const fatSizeBytes = parseHex(document.getElementById('fatSizeBytes1216').value); const fatSizeBytes = parseHex(document.getElementById('fatSizeBytes1216').value);
const maxRootEntries = parseHex(document.getElementById('maxRootEntries1216').value); const maxRootEntries = parseHex(document.getElementById('maxRootEntries1216').value);
const partitionSize = parseHex(document.getElementById('partitionSize1216').value); const partitionSizeInSectors = parseHex(document.getElementById('partitionSizeInSectors1216').value);
const clusterSizeSectors = parseHex(document.getElementById('clusterSizeSectors1216').value); const clusterSizeSectors = parseHex(document.getElementById('clusterSizeSectors1216').value);
const clusterNumber = parseHex(document.getElementById('clusterNumber1216').value); const clusterNumber = parseHex(document.getElementById('clusterNumber1216').value);
@ -639,19 +790,32 @@
const fatEnd = fatStart + fatSize; const fatEnd = fatStart + fatSize;
const rootDirSize = maxRootEntries * 0x20; const rootDirSize = maxRootEntries * 0x20;
const dataStart = fatEnd + rootDirSize; const dataStart = fatEnd + rootDirSize;
const dataSize = partitionSize - (dataStart - baseOffset); const dataSize = partitionSizeInSectors * sectorSize - (dataStart - baseOffset);
const clusterSize = sectorSize * clusterSizeSectors; const clusterSize = sectorSize * clusterSizeSectors;
const numClusters = clusterSize > 0 ? Math.floor(dataSize / clusterSize) : 0; const numClusters = clusterSize > 0 ? Math.floor(dataSize / clusterSize) : 0;
const clusterStart = dataStart + (clusterNumber - 0x2) * clusterSize; const clusterStart = dataStart + (clusterNumber - 0x2) * clusterSize;
// Store calculation formulas with actual values
const calculations = {
fatStart: `${reservedSectors.toString(16)} × ${sectorSize.toString(16)} + ${baseOffset.toString(16)} = ${fatStart.toString(16)}`,
fatSize: `${numFATs.toString(16)} × ${fatSizeBytes.toString(16)} = ${fatSize.toString(16)}`,
fatEnd: `${fatStart.toString(16)} + ${fatSize.toString(16)} = ${fatEnd.toString(16)}`,
rootDirSize: `${maxRootEntries.toString(16)} × 0x20 = ${rootDirSize.toString(16)}`,
dataStart: `${fatEnd.toString(16)} + ${rootDirSize.toString(16)} = ${dataStart.toString(16)}`,
dataSize: `(${partitionSizeInSectors.toString(16)} × ${sectorSize.toString(16)}) - (${dataStart.toString(16)} - ${baseOffset.toString(16)}) = ${dataSize.toString(16)}`,
clusterSize: `${sectorSize.toString(16)} × ${clusterSizeSectors.toString(16)} = ${clusterSize.toString(16)}`,
numClusters: `${dataSize.toString(16)} ÷ ${clusterSize.toString(16)} = ${numClusters.toString(16)}`,
clusterStart: `${dataStart.toString(16)} + (${clusterNumber.toString(16)} - 0x2) × ${clusterSize.toString(16)} = ${clusterStart.toString(16)}`
};
return { return {
fatStart, fatSize, fatEnd, rootDirSize, dataStart, dataSize, fatStart, fatSize, fatEnd, rootDirSize, dataStart, dataSize,
clusterSize, numClusters, clusterStart clusterSize, numClusters, clusterStart, calculations
}; };
} }
}, },
fat32: { fat32: {
requiredFields: ['reservedSectors32', 'numFATs32', 'fatSizeBytes32', 'rootDirCluster32', 'partitionSize32', 'clusterSizeSectors32'], requiredFields: ['reservedSectors32', 'numFATs32', 'fatSizeBytes32', 'rootDirCluster32', 'partitionSizeInSectors32', 'clusterSizeSectors32'],
calculate: function() { calculate: function() {
const baseOffset = parseHex(document.getElementById('baseOffset32').value); const baseOffset = parseHex(document.getElementById('baseOffset32').value);
const sectorSize = parseHex(document.getElementById('sectorSize32').value); const sectorSize = parseHex(document.getElementById('sectorSize32').value);
@ -659,23 +823,35 @@
const numFATs = parseHex(document.getElementById('numFATs32').value); const numFATs = parseHex(document.getElementById('numFATs32').value);
const fatSizeBytes = parseHex(document.getElementById('fatSizeBytes32').value); const fatSizeBytes = parseHex(document.getElementById('fatSizeBytes32').value);
const rootDirCluster = parseHex(document.getElementById('rootDirCluster32').value); const rootDirCluster = parseHex(document.getElementById('rootDirCluster32').value);
const partitionSize = parseHex(document.getElementById('partitionSize32').value); const partitionSizeInSectors = parseHex(document.getElementById('partitionSizeInSectors32').value);
const clusterSizeSectors = parseHex(document.getElementById('clusterSizeSectors32').value); const clusterSizeSectors = parseHex(document.getElementById('clusterSizeSectors32').value);
const clusterNumber = parseHex(document.getElementById('clusterNumber32').value); const clusterNumber = parseHex(document.getElementById('clusterNumber32').value);
const fatStart = reservedSectors * sectorSize + baseOffset; const fatStart = reservedSectors * sectorSize + baseOffset;
const fatSize = numFATs * fatSizeBytes; const fatSize = numFATs * fatSizeBytes;
const fatEnd = fatStart + fatSize; const fatEnd = fatStart + fatSize;
const dataStart = fatEnd; // No fixed root directory in FAT32 const dataStart = fatEnd;
const dataSize = partitionSize - (dataStart - baseOffset); const dataSize = partitionSizeInSectors * sectorSize - (dataStart - baseOffset);
const clusterSize = sectorSize * clusterSizeSectors; const clusterSize = sectorSize * clusterSizeSectors;
const numClusters = clusterSize > 0 ? Math.floor(dataSize / clusterSize) : 0; const numClusters = clusterSize > 0 ? Math.floor(dataSize / clusterSize) : 0;
const clusterStart = dataStart + (clusterNumber - 0x2) * clusterSize; const clusterStart = dataStart + (clusterNumber - 0x2) * clusterSize;
const rootDirPos = dataStart + (rootDirCluster - 0x2) * clusterSize; const rootDirPos = dataStart + (rootDirCluster - 0x2) * clusterSize;
const calculations = {
fatStart: `${reservedSectors.toString(16)} × ${sectorSize.toString(16)} + ${baseOffset.toString(16)} = ${fatStart.toString(16)}`,
fatSize: `${numFATs.toString(16)} × ${fatSizeBytes.toString(16)} = ${fatSize.toString(16)}`,
fatEnd: `${fatStart.toString(16)} + ${fatSize.toString(16)} = ${fatEnd.toString(16)}`,
dataStart: `${fatEnd.toString(16)}`,
dataSize: `(${partitionSizeInSectors.toString(16)} × ${sectorSize.toString(16)}) - (${dataStart.toString(16)} - ${baseOffset.toString(16)}) = ${dataSize.toString(16)}`,
clusterSize: `${sectorSize.toString(16)} × ${clusterSizeSectors.toString(16)} = ${clusterSize.toString(16)}`,
numClusters: `${dataSize.toString(16)} ÷ ${clusterSize.toString(16)} = ${numClusters.toString(16)}`,
clusterStart: `${dataStart.toString(16)} + (${clusterNumber.toString(16)} - 0x2) × ${clusterSize.toString(16)} = ${clusterStart.toString(16)}`,
rootDirPos: `${dataStart.toString(16)} + (${rootDirCluster.toString(16)} - 0x2) × ${clusterSize.toString(16)} = ${rootDirPos.toString(16)}`
};
return { return {
fatStart, fatSize, fatEnd, dataStart, dataSize, fatStart, fatSize, fatEnd, dataStart, dataSize,
clusterSize, numClusters, clusterStart, rootDirPos clusterSize, numClusters, clusterStart, rootDirPos, calculations
}; };
} }
} }
@ -698,21 +874,38 @@
return '0x' + value.toString(16).toUpperCase(); return '0x' + value.toString(16).toUpperCase();
} }
function copyToClipboard(elementId) {
const element = document.getElementById(elementId);
const text = element.textContent.trim();
if (text === '-' || text.includes('Fehler')) {
return;
}
navigator.clipboard.writeText(text).then(() => {
const btn = element.parentElement.querySelector('.copy-btn');
const originalText = btn.textContent;
btn.textContent = '✓';
btn.style.color = '#88cc88';
setTimeout(() => {
btn.textContent = originalText;
btn.style.color = '';
}, 1000);
}).catch(err => {
console.error('Failed to copy to clipboard:', err);
});
}
function switchTab(tabId) { function switchTab(tabId) {
// Hide all tab contents
document.querySelectorAll('.tab-content').forEach(content => { document.querySelectorAll('.tab-content').forEach(content => {
content.classList.remove('active'); content.classList.remove('active');
}); });
// Remove active class from all tabs
document.querySelectorAll('.tab').forEach(tab => { document.querySelectorAll('.tab').forEach(tab => {
tab.classList.remove('active'); tab.classList.remove('active');
}); });
// Show selected tab content
document.getElementById(tabId).classList.add('active'); document.getElementById(tabId).classList.add('active');
// Add active class to clicked tab
event.target.classList.add('active'); event.target.classList.add('active');
} }
@ -726,27 +919,42 @@
const results = fs.calculate(); const results = fs.calculate();
// Update results based on filesystem type
if (fsType === 'fat1216') { if (fsType === 'fat1216') {
document.getElementById('fatStart1216').innerHTML = formatHex(results.fatStart); const mapping = {
document.getElementById('fatSize1216').innerHTML = formatHex(results.fatSize); 'fatStart1216': ['fatStart', 'fatStart'],
document.getElementById('fatEnd1216').innerHTML = formatHex(results.fatEnd); 'fatSize1216': ['fatSize', 'fatSize'],
document.getElementById('rootDirSize1216').innerHTML = formatHex(results.rootDirSize); 'fatEnd1216': ['fatEnd', 'fatEnd'],
document.getElementById('dataStart1216').innerHTML = formatHex(results.dataStart); 'rootDirSize1216': ['rootDirSize', 'rootDirSize'],
document.getElementById('dataSize1216').innerHTML = formatHex(results.dataSize); 'dataStart1216': ['dataStart', 'dataStart'],
document.getElementById('clusterSize1216').innerHTML = formatHex(results.clusterSize); 'dataSize1216': ['dataSize', 'dataSize'],
document.getElementById('numClusters1216').innerHTML = formatHex(results.numClusters); 'clusterSize1216': ['clusterSize', 'clusterSize'],
document.getElementById('clusterStart1216').innerHTML = formatHex(results.clusterStart); 'numClusters1216': ['numClusters', 'numClusters'],
'clusterStart1216': ['clusterStart', 'clusterStart']
};
Object.entries(mapping).forEach(([elementId, [resultKey, calcKey]]) => {
const element = document.getElementById(elementId);
element.innerHTML = formatHex(results[resultKey]);
element.setAttribute('data-result-formula', results.calculations[calcKey]);
});
} else if (fsType === 'fat32') { } else if (fsType === 'fat32') {
document.getElementById('fatStart32').innerHTML = formatHex(results.fatStart); const mapping = {
document.getElementById('fatSize32').innerHTML = formatHex(results.fatSize); 'fatStart32': ['fatStart', 'fatStart'],
document.getElementById('fatEnd32').innerHTML = formatHex(results.fatEnd); 'fatSize32': ['fatSize', 'fatSize'],
document.getElementById('dataStart32').innerHTML = formatHex(results.dataStart); 'fatEnd32': ['fatEnd', 'fatEnd'],
document.getElementById('dataSize32').innerHTML = formatHex(results.dataSize); 'dataStart32': ['dataStart', 'dataStart'],
document.getElementById('clusterSize32').innerHTML = formatHex(results.clusterSize); 'dataSize32': ['dataSize', 'dataSize'],
document.getElementById('numClusters32').innerHTML = formatHex(results.numClusters); 'clusterSize32': ['clusterSize', 'clusterSize'],
document.getElementById('clusterStart32').innerHTML = formatHex(results.clusterStart); 'numClusters32': ['numClusters', 'numClusters'],
document.getElementById('rootDirPos32').innerHTML = formatHex(results.rootDirPos); 'clusterStart32': ['clusterStart', 'clusterStart'],
'rootDirPos32': ['rootDirPos', 'rootDirPos']
};
Object.entries(mapping).forEach(([elementId, [resultKey, calcKey]]) => {
const element = document.getElementById(elementId);
element.innerHTML = formatHex(results[resultKey]);
element.setAttribute('data-result-formula', results.calculations[calcKey]);
});
} }
} catch (error) { } catch (error) {
@ -759,32 +967,34 @@
const fs = filesystems[fsType]; const fs = filesystems[fsType];
if (!fs) return; if (!fs) return;
// Clear input fields
fs.requiredFields.forEach(fieldId => { fs.requiredFields.forEach(fieldId => {
const element = document.getElementById(fieldId); const element = document.getElementById(fieldId);
if (element) element.value = ''; if (element) element.value = '';
}); });
// Clear cluster number field
const clusterField = document.getElementById(`clusterNumber${fsType === 'fat1216' ? '1216' : '32'}`); const clusterField = document.getElementById(`clusterNumber${fsType === 'fat1216' ? '1216' : '32'}`);
if (clusterField) clusterField.value = ''; if (clusterField) clusterField.value = '';
// Reset results
if (fsType === 'fat1216') { if (fsType === 'fat1216') {
const resultElements = ['fatStart1216', 'fatSize1216', 'fatEnd1216', 'rootDirSize1216', 'dataStart1216', 'dataSize1216', 'clusterSize1216', 'numClusters1216', 'clusterStart1216']; const resultElements = ['fatStart1216', 'fatSize1216', 'fatEnd1216', 'rootDirSize1216', 'dataStart1216', 'dataSize1216', 'clusterSize1216', 'numClusters1216', 'clusterStart1216'];
resultElements.forEach(id => { resultElements.forEach(id => {
document.getElementById(id).innerHTML = '-'; const element = document.getElementById(id);
element.innerHTML = '-';
element.setAttribute('data-result-formula', '');
}); });
} else if (fsType === 'fat32') { } else if (fsType === 'fat32') {
const resultElements = ['fatStart32', 'fatSize32', 'fatEnd32', 'dataStart32', 'dataSize32', 'clusterSize32', 'numClusters32', 'clusterStart32', 'rootDirPos32']; const resultElements = ['fatStart32', 'fatSize32', 'fatEnd32', 'dataStart32', 'dataSize32', 'clusterSize32', 'numClusters32', 'clusterStart32', 'rootDirPos32'];
resultElements.forEach(id => { resultElements.forEach(id => {
document.getElementById(id).innerHTML = '-'; const element = document.getElementById(id);
element.innerHTML = '-';
element.setAttribute('data-result-formula', '');
}); });
} }
} }
// Add event listeners for real-time calculation // Add event listeners
document.addEventListener('DOMContentLoaded', function() { document.addEventListener('DOMContentLoaded', function() {
// Real-time calculation
Object.keys(filesystems).forEach(fsType => { Object.keys(filesystems).forEach(fsType => {
const fs = filesystems[fsType]; const fs = filesystems[fsType];
fs.requiredFields.forEach(fieldId => { fs.requiredFields.forEach(fieldId => {
@ -801,9 +1011,31 @@
} }
}); });
}); });
// Tooltip event listeners
document.addEventListener('mouseover', function(e) {
if (e.target.classList.contains('result-label')) {
const formula = e.target.getAttribute('data-formula');
if (formula) {
showTooltip(e.target, `Formula: ${formula}`);
}
} else if (e.target.classList.contains('result-value')) {
const formula = e.target.getAttribute('data-result-formula');
if (formula && formula !== '') {
showTooltip(e.target, `Calculation: ${formula}`);
}
}
});
document.addEventListener('mouseout', function(e) {
if (e.target.classList.contains('result-label') || e.target.classList.contains('result-value')) {
hideTooltip();
}
});
// Hide tooltip when scrolling
document.addEventListener('scroll', hideTooltip);
}); });
</script> </script>
</body> </body>
</html> </html>
87.123.43.152