Found global variable from YouTube SHARE_ON_VIDEO_END. Switched to changing this variable iinstead of using a hack (it's tested with the HTML5 player and is expected to work with the flash player too).