[JENKINS-63342] Fix JavaScript errors in Script Console on Mac (#4901)
[JENKINS-63342] Fix JavaScript errors in Script Console on Mac (#4901)

* Fix JavaScript errors in Script Console on Mac

Fixes errors related to keyevent handling in the script console when using a browser on a Mac.

* Partial revert of #4818

Reverts a change in #4818 that changed the scope of some variables that breaks the Script Console on a Mac

* Fix indentation
pjanouse/jenkins,rsandell/jenkins,pjanouse/jenkins,daniel-beck/jenkins,damianszczepanik/jenkins,ikedam/jenkins,DanielWeber/jenkins,ikedam/jenkins,DanielWeber/jenkins,ikedam/jenkins,jenkinsci/jenkins,ikedam/jenkins,DanielWeber/jenkins,rsandell/jenkins,DanielWeber/jenkins,v1v/jenkins,daniel-beck/jenkins,viqueen/jenkins,jenkinsci/jenkins,jenkinsci/jenkins,jenkinsci/jenkins,damianszczepanik/jenkins,DanielWeber/jenkins,jenkinsci/jenkins,v1v/jenkins,damianszczepanik/jenkins,MarkEWaite/jenkins,daniel-beck/jenkins,MarkEWaite/jenkins,viqueen/jenkins,pjanouse/jenkins,v1v/jenkins,v1v/jenkins,damianszczepanik/jenkins,rsandell/jenkins,ikedam/jenkins,rsandell/jenkins,ikedam/jenkins,rsandell/jenkins,viqueen/jenkins,v1v/jenkins,DanielWeber/jenkins,viqueen/jenkins,pjanouse/jenkins,MarkEWaite/jenkins,viqueen/jenkins,daniel-beck/jenkins,daniel-beck/jenkins,MarkEWaite/jenkins,MarkEWaite/jenkins,ikedam/jenkins,v1v/jenkins,daniel-beck/jenkins,daniel-beck/jenkins,rsandell/jenkins,pjanouse/jenkins,rsandell/jenkins,jenkinsci/jenkins,viqueen/jenkins,damianszczepanik/jenkins,jenkinsci/jenkins,ikedam/jenkins,MarkEWaite/jenkins,MarkEWaite/jenkins,damianszczepanik/jenkins,rsandell/jenkins,DanielWeber/jenkins,daniel-beck/jenkins,MarkEWaite/jenkins,damianszczepanik/jenkins,v1v/jenkins,pjanouse/jenkins,viqueen/jenkins,jenkinsci/jenkins,damianszczepanik/jenkins,pjanouse/jenkins