I suggest you zip the html file including one with the automod and additionally attach these zip files to your post. Then report your post. I made a super short test on a old savegame. It seems to work. You had a better though process than mine. You subverted the booleans. I tried to remove the code pieces.
If this works, I may try to write a js script that can automatically edit these lines. No promises though. I have never really wrote any program in js.

(Usually I work with VBScript in my Dayjob)
I make no promises.
First I will now start a new game with my edited html files.