Check if there are uploaded files before alerting

Harvard student here. I've been using Canvas for one of my courses, and I've found it really annoying that whenever I open up an assignment (just to look at the description, download the pdf spec, etc), I have to confirm via an alert box whenever I want to navigate away or close the tab. I've just added the basic additional check that the confirmation prompt will only come up if a file has actually been uploaded for this assignment.