How to expand all items in main content tree when loading page

Well, I have tried many different variants of my own solutions but all of them failed/did not fetch all nodes correctly. was wondering if anyone was trying to expand all the items when the page is loaded?


This is a companion discussion topic for the original entry at https://our.umbraco.com/forum/54090-how-to-expand-all-items-in-main-content-tree-when-loading-page