-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
116 lines (101 loc) · 4.02 KB
/
index.html
File metadata and controls
116 lines (101 loc) · 4.02 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Dining Philosophers Visualizer</title>
<link rel="stylesheet" href="style.css" />
<link rel="icon" href="favicon.ico" type="image/x-icon" />
<script type="module" src="main.js" defer></script>
<script src="https://cdn.jsdelivr.net/npm/pako@2.1.0/dist/pako.min.js"></script>
</head>
<body>
<!-- ▼ TOASTER -->
<div id="toast" class="toast hidden"></div>
<!-- ▼ CONFIG PANEL -->
<div id="configPanel" class="config-panel">
<div class="container">
<h1 class="title">🧠 DINING PHILOSOPHERS VISUALIZER</h1>
<details>
<summary style="text-align: center; margin-bottom: 1rem;">Metadata</summary>
<section class="param-inputs">
<div class="input-wrapper">
<label class="arrow-label" for="timeToDie">time to die</label>
<input type="number" id="timeToDie" placeholder="die (ms)">
</div>
<div class="input-wrapper">
<label class="arrow-label" for="timeToEat">time to eat</label>
<input type="number" id="timeToEat" placeholder="eat (ms)">
</div>
<div class="input-wrapper">
<label class="arrow-label" for="timeToSleep">time to sleep</label>
<input type="number" id="timeToSleep" placeholder="sleep (ms)">
</div>
</section>
</details>
<section class="log-input">
<textarea id="logText" placeholder="Paste your philosophers log here..."></textarea>
<div class="divider">— or —</div>
<input type="file" id="logFile" accept=".txt" />
<div class="divider">— bonus —</div>
<label style="margin-top: 1rem; display: block; text-align: center;">
<input type="checkbox" id="bonusToggle" />
Center Forks
</label>
</section>
<button id="backToVis" class="toggle-btn hidden" style="margin-top: 2rem;">⬇ back to viz</button>
</div>
</div>
<!-- ▼ TOGGLE BUTTON -->
<!-- ▼ VISUALIZER -->
<section id="visualizerPanel" class="visualizer">
<button id="clearStorage" class="toggle-btn">🧹 reset</button>
<button id="togglePanel" class="toggle-btn hidden">⬆ config</button>
<svg id="philosopherCanvas" width="100%" height="400"></svg>
<div class="timeline-wrapper">
<div style="margin: 10px 0;">
<label for="zoomSlider">Zoom</label>
<input id="zoomSlider" type="range" min="0.2" max="5" value="1" step="0.1">
</div>
<div id="timeChart" class="time-chart">
<svg id="timelineCanvas" width="100%" height="200"></svg>
</div>
</div>
</section>
<!-- ▼ PLAYER -->
<div id="playerContainer" class="player-container hidden">
<div id="seekBar" class="seek-bar">
<div id="seekProgress" class="seek-progress"></div>
<div id="seekHoverLabel" class="seek-hover-label">0 ms</div>
</div>
<div class="controls-row">
<div class="controls">
<button id="btnToStart">⏮️</button>
<button id="btnPrev">◀️</button>
<button id="btnPlayPause">▶️</button>
<button id="btnNext">▶️</button>
<button id="btnToEnd">⏭️</button>
<label for="speedSelect">Speed:</label>
<select id="speedSelect">
<option value="0.25">0.25x</option>
<option value="0.5">0.5x</option>
<option value="1" selected>1x</option>
<option value="2">2x</option>
<option value="4">4x</option>
<option value="8">8x</option>
</select>
<span id="currentTimeLabel">0 ms</span>
</div>
</div>
</div>
<a
href="https://github.com/pulgamecanica/42Course/tree/main/42Documentation/philosophers_visualizer"
class="github-float"
target="_blank"
rel="noopener"
>
<img src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/github/github-original.svg" alt="GitHub" class="github-icon" />
<span>Star on GitHub</span>
</a>
</body>
</html>