-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
50 lines (40 loc) · 1.67 KB
/
script.js
File metadata and controls
50 lines (40 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// 固定的Post Threshold Ratio為60%
const ENHANCEMENT_PERCENT = 60;
function adjustValue(id, delta) {
const input = document.getElementById(id);
let currentValue = parseFloat(input.value) || 0;
let newValue = currentValue + delta;
// 設定範圍限制
const min = parseFloat(input.min) || 0;
const max = parseFloat(input.max) || Infinity;
// 確保在範圍內
newValue = Math.max(min, Math.min(max, newValue));
// 根據不同欄位設定小數位數
if (id === 'contrastTotal') {
newValue = Math.round(newValue);
} else {
newValue = Math.round(newValue * 10) / 10; // 保留一位小數
}
input.value = newValue;
updateValues();
}
function updateValues() {
const contrastTotal = parseFloat(document.getElementById('contrastTotal').value);
const injectionRate = parseFloat(document.getElementById('injectionRate').value);
const scanTime = parseFloat(document.getElementById('scanTime').value);
// 使用固定的60%顯影百分比
const ptd1 = (((contrastTotal / injectionRate) - scanTime) * (ENHANCEMENT_PERCENT / 100)).toFixed(1);
const ptd2 = (parseFloat(ptd1) + scanTime + 4).toFixed(1);
const ptd3 = (parseFloat(ptd2) + scanTime + 4).toFixed(1);
document.getElementById('ptd1').textContent = ptd1;
document.getElementById('ptd2').textContent = ptd2;
document.getElementById('ptd3').textContent = ptd3;
}
function resetDefaults() {
document.getElementById('contrastTotal').value = 60;
document.getElementById('injectionRate').value = 4.0;
document.getElementById('scanTime').value = 4.0;
updateValues();
}
// 初始更新
updateValues();