Convert javascript to AMD modules
Fixes unread chat messages counter