Move .clearfix to defs.less

clearfix is generic code, and should really be in defs, so we can use it from
everywhere.

Reviewed at http://reviews.reviewboard.org/r/4277/
Merge branch 'release-1.7.x'
Fix key bindings for the diff viewer.

Key bindings didn't always work, due to where they were registered.
They're now registered on the document instead of the element, as they
used to be before the rewrite.

On top of that, the key binding code now filters out any keys pressed on
input or textarea elements.
Fix jshint warnings.

This fixes a bunch of warnings in our JavaScript that JSHint reported.

A .jshintrc has been created which will suppress warnings about
__proto__ being used (needed in _.super), and operators like "&&", "?"
and ":" being at the beginning of lines.

This also turns on a bunch of jshint options for things we want to
enforce, like one var statement at the top of a function, unused
variable checks, trailing comma detection, and more.

One thing to note is that we use some reserved keywords as keys, which
causes warnings in JSHint unless they're always quoted. This so far only
came up with the new RepositoryBranch. I've quoted them, but we may want
to consider coming up with new standardized names, such as "isDefault".
Move the resource models/collections into js/resources/.

As part of an attempt at reorganization before moving to require.js,
I've moved all the resource models and collections into a js/resources/
directory.

There are no code changes, aside from changing the descriptive name of
each unit test suite to have "resources/" prefixed.
Fix "whitespace-only changes" toggle for files with only whitespace changes.

A change made a while back broke the logic for determining when to show
the "This file has only whitespace changes" description. That
description was necessary, because we keyed off the visibility toggles
for whitespace-only chunks based on it. So, the entire feature was
broken.

That description element has been restored and the toggle works again.

Fixes bug #2941
Merge branch 'release-1.7.x'
Move the diff highlighting code out and fix position problems.

The diff highlighting now lives in a ChunkHighlighterView object.
This takes a chunk element (a tbody/thead in the diff viewer) and
surrounds it with black borders.

This is a port of the old code, but with some fixes and changes.

The old DOM mutation events are no longer listened to, as they don't
seem to be needed, from my testing.

The positions of the borders are no longer off by several pixels on
every browser. tbody dimension calculation is horribly inconsistent
across browsers, so we're now using the table's left and width. That
takes care of the most noticeable problems. I've also done some tuning
to make the vertical position work properly across Chrome, Firefox and
IE.
Fix up all the diff viewer anchor code.

The diff viewer anchor code was in a semi-working state. There were
still calls to the now-removed 'gotoAnchor', which errored out, and
there was a hacky global function for the individual DiffReviewableViews
to scroll anchors.

Now the views handle all anchor click events. DiffReviewableView
triggers events when the file header or a chunk is clicked, and
DiffViewerPageView reacts to that. The PageView also handles all clicks
from the index that comes before the diff.
Fix a couple lintian errors in the new diff chunk highlighter.

Some commas were used where semicolons should have been used, due to
moving away from using a var statement.
Listen for keyboard events on document.body.

My previous keyboard event fix was set to use document, but even this
wasn't good enough. Going to document.body now, which works everywhere.
Revert my prior keybinding fixes and fix the root cause of problems.

The previous fixes weren't fixing the root cause of the problem, which
was that the bindings would end up removed prematurely, due to the order
in which the delegate/undelegate functions were called. I've reverted
the previous fixes and gone back to listening on this.$el, and fixed the
order of delegate/undelegate.
Add a centralized list of API error codes.

Right now we don't use the API error codes very much from our frontend code, but
I'm expecting that to change as we make things more dynamic. This adds a
centralized list of them so we don't sprinkle constants everywhere.

Testing done: ran js-tests, used the codes in my new review request rewrite.

Reviewed at http://reviews.reviewboard.org/r/4305/