Rewritten.

From CS to plain JS.

Updated event triggering and AJAX requests.