Fix #606, use pagehide instead of unload
Try to make modals wider (incomplete #617)
Fix #583, collapse multiple chat messages into one message