Fix merge regression issues

So, looks like 95f2912daf5d2060e86168e5a38d04cea0ea9fc2 undid a commit @drewwills did for sidebars. 6f494bc6084272e06ea0f714260d105bbb44b11b then reintroduced a moved block of javascript.  Both merge conflicts, easy fix.

I tested the changes and they seem to be fixed.