CRM-12910 - Extract JS from logButton.tpl so it can be reused by client-side apps