Flarum is a SPA (Single Page App). This means that sometimes you cannot just stick JavaScript somewhere to do things like this. But, if you want an easy way to do this without having to think about it, install Direct Links. Now you may link to yoursite.com/login and the box will appear.
Edit: This might work (haven’t tried it but I see it in the Direct Links thread). Notice the onclick part.
<button class="Button Button--primary" type="button" title="Sign Up" onclick="app.modal.show(flarum.core.compat['components/LogInModal'])"><span class="Button-label">Sign Up</span></button>