Update script.js
This commit is contained in:
1 parent
3bd6e83523
commit
fd344b7441
1 file changed
-18
@@ -41,17 +41,8 @@ function updateStats(position) {
|
||||
document.getElementById("currentPos").textContent = position;
|
||||
}
|
||||
|
||||
function resetButtonStates() {
|
||||
const buttons = document.querySelectorAll("button");
|
||||
buttons.forEach((button) => button.classList.remove("active"));
|
||||
}
|
||||
|
||||
function startFCFS() {
|
||||
reset();
|
||||
resetButtonStates();
|
||||
document
|
||||
.querySelector('button[onclick="startFCFS()"]')
|
||||
.classList.add("active");
|
||||
const diskTrack = document.getElementById("diskTrack");
|
||||
let currentPosition = parseInt(
|
||||
document.getElementById("initialHead").value
|
||||
@@ -93,10 +84,6 @@ function startFCFS() {
|
||||
|
||||
function startSSTF() {
|
||||
reset();
|
||||
resetButtonStates();
|
||||
document
|
||||
.querySelector('button[onclick="startSSTF()"]')
|
||||
.classList.add("active");
|
||||
const diskTrack = document.getElementById("diskTrack");
|
||||
const trackWidth = diskTrack.offsetWidth;
|
||||
const initialHead = parseInt(document.getElementById("initialHead").value);
|
||||
@@ -144,10 +131,6 @@ function startSSTF() {
|
||||
|
||||
function startSCAN() {
|
||||
reset();
|
||||
resetButtonStates();
|
||||
document
|
||||
.querySelector('button[onclick="startSCAN()"]')
|
||||
.classList.add("active");
|
||||
const diskTrack = document.getElementById("diskTrack");
|
||||
const trackWidth = diskTrack.offsetWidth;
|
||||
const initialHead = parseInt(document.getElementById("initialHead").value);
|
||||
@@ -211,7 +194,6 @@ function reset() {
|
||||
if (animationInterval) {
|
||||
clearInterval(animationInterval);
|
||||
}
|
||||
resetButtonStates();
|
||||
const diskTrack = document.getElementById("diskTrack");
|
||||
updateTrackElements(diskTrack);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user