In reply to Ben Word.

Regarding the code, what if document.getElementsByClassName('edit-post-sidebar') returns nothing? Would suggest proper error handling.