Refactor post-reply JavaScript

Change-Id: Icb43dfa10ee4af64ac99cf884682b4b0453b5558
Merge "Refactor post-reply JavaScript"