Good tip, I actually use something similar for moderating posts. A couple of tips:
1. As donshakespeare said you can use the "delete hidden posts" button on the Admin > Stats page, which will delete all of them.
2. In your code you can actually shorten that to remove "each" as jQuery applies functions to all matching elements by default. You can also do click() instead of using trigger. Example:
3. Depending on your server settings "clicking" 50+ posts simultaneously may not work or it may overload your server. You can use slice() to click a limited amount. In this method you should also use ":visible" in the selector because when deleting posts the HTML is only hidden in the page, not removed entirely (until you reload the page). If you run it twice on the same page it will try and click the deleted posts again. This will delete the first 10 posts that have not been deleted:
For the moderation page, I first skim over the posts and approve any real posts. Then I run this to reject all the spam: