Extract main page JavaScript
Format messages