[agent] refactor Search

Refactor the Search functionality. This is just some cleanup that should have happened long ago.

+ Create a Search constructor
+ set instance properties like `currentEl`, `clickMask`
+ move event handlers to instance methods `onMouseOver`...