Expand/collapse master section based on boolean value in Collection

Thank you so much for taking the time to show how to do that! It works! I actually wanted the code to be site wide, not page specific, so I tried putting the code on masterPage.js and that seems to be working as well!