[JS] - Rejigged isVisible function