Spaces:
Sleeping
Sleeping
File size: 2,019 Bytes
463f868 | 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 | file_path = r"c:\Users\trios\.gemini\antigravity\vscode\loveca-copy\frontend\web_ui\index.html"
with open(file_path, "r", encoding="utf-8") as f:
lines = f.readlines()
# Find clearHighlights definition
clear_highlights_idx = -1
for i, line in enumerate(lines):
if "function clearHighlights()" in line:
clear_highlights_idx = i
break
if clear_highlights_idx == -1:
print("Could not find clearHighlights function")
exit(1)
print(f"Found clearHighlights at line {clear_highlights_idx + 1}")
# Find duplicate actionsDiv.innerHTML = '' AFTER clearHighlights
start_delete_idx = -1
for i in range(clear_highlights_idx + 1, len(lines)):
if "actionsDiv.innerHTML = '';" in line: # This might be indented
# let's look for the specific line
pass
if "actionsDiv.innerHTML = '';" in lines[i]:
start_delete_idx = i
break
if start_delete_idx == -1:
print("Could not find duplicate actionsDiv.innerHTML")
exit(1)
print(f"Found duplicate start at line {start_delete_idx + 1}")
# Find toggleFullLog
end_delete_idx = -1
for i in range(start_delete_idx, len(lines)):
if "async function toggleFullLog" in lines[i]:
end_delete_idx = i
break
if end_delete_idx == -1:
print("Could not find toggleFullLog")
exit(1)
print(f"Found toggleFullLog at line {end_delete_idx + 1}")
# Adjust end_delete_idx to include the closing braces of the bad block if they are before toggleFullLog
# Actually, we likely want to keep toggleFullLog, so end_delete_idx is the start of the KEPT block.
# We should delete [start_delete_idx, end_delete_idx)
# Verify content to be deleted
print("Deleting lines:")
print(lines[start_delete_idx].strip())
print("...")
print(lines[end_delete_idx - 1].strip())
new_lines = lines[:start_delete_idx] + lines[end_delete_idx:]
with open(file_path, "w", encoding="utf-8") as f:
f.writelines(new_lines)
print("File updated successfully.")
|