LPS-48281 Encapsulate tree_js code in a taglib to be reusable (we will replace it all around the portal once this is merged)