That forces Tree View completely open, each and every category, subcategory, etc. on each and every page.
You said you added JS, so I added your JS in addition to W3Schools JS.
I also replaced W3Schools JS with your JS, but both work the same - completely expand Tree View from top to bottom...