19 lines
880 B
Python
19 lines
880 B
Python
|
|
import re
|
||
|
|
|
||
|
|
with open('app/modules/sag/templates/detail.html', 'r', encoding='utf-8') as f:
|
||
|
|
text = f.read()
|
||
|
|
|
||
|
|
# Fix the duplicate function
|
||
|
|
text = re.sub(r'( function getTimeV1EmployeeId\(\) \{\n const val = document.getElementById\(\'timeV1EmployeeId\'\)\?\.value;\n return val \? Number\(val\) : null;\n \}\n\n)+', r'\1', text)
|
||
|
|
|
||
|
|
# Fix the undefined updateTimeTotal issue inside DOMContentLoaded
|
||
|
|
# The lines to remove are:
|
||
|
|
# if(hInput) hInput.addEventListener('input', updateTimeTotal);
|
||
|
|
# if(mInput) mInput.addEventListener('input', updateTimeTotal);
|
||
|
|
text = re.sub(r"if\(hInput\)\s*hInput\.addEventListener\('input',\s*updateTimeTotal\);\s*\n\s*if\(mInput\)\s*mInput\.addEventListener\('input',\s*updateTimeTotal\);", "", text)
|
||
|
|
|
||
|
|
with open('app/modules/sag/templates/detail.html', 'w', encoding='utf-8') as f:
|
||
|
|
f.write(text)
|
||
|
|
|
||
|
|
print("done")
|