jQuery rewrite of invertSelection() function.

This works for entries, comments and media items including changing
the multidelete marker. Needs to be tested with Karma plugin which
uses the old function as well.