// Prevent user from accidentally leaving the page
window.onbeforeunload=function(event){
if($rootScope.connected){
if($scope.command!==null&&$scope.command!==''){
event.preventDefault();
// Chrome requires us to set this or it will not show the dialog
event.returnValue="You have an active connection to your WeeChat relay. Please disconnect using the button in the top-right corner or by double-tapping the Escape key.";
// Chrome requires this
// Firefox does not show the site provides message
event.returnValue="Any unsent input will be lost. Are you sure that you want to quit?";