Code review

Mostly this is just about fixing up some JavaScript stuff. A couple of notes:

1. JS vars need to be declared with the `var` keyword to prevent scope leaking. `$body` and `$anchor` had not been, therefore they bleed up to the global scope. This is to be avoided.
2. Using `$` to prefix a var name in JS can make the above confusing. This is a convention used by some to indicate that the value of this var is a jQuery collection. This is why I removed the prefix for `$size`, since it is not.
3. You don't need to bother with `null` for a var that you want to be empty until it's populated later. When you declare a var without a value, it automatically has the value of `undefined` which is pretty much the same thing in almost every situation.
4. It seems as though you were intending to cache some selectors for re-use, but you weren't. This now does that properly. The performance gains would likely be minimal, but it's a good practice.

Also removed the `has_action` and `add_action` stuff since core handles that properly now.