Hopefully a fix for #12364

* register the callback before invoking the toggling
* listen for `hidden` instead of `hide`
* account for the possibility of the associated `show` event being preventDefault-ed

Adds relevant unit tests.
Tweak JSHint and JSCS checks.

Be more consistent across the whole codebase.

Also, make use of JSHint's 2.5.1 `extends` and `qunit` options. This way we set our basis options in js/.jshintrc and override the rest.
Comply to the new style.
carousel.js: remove unneeded variable assignment.

`slideIndex` is assigned to the same value a few lines above.
Minor style tweaks.
Run `grunt`.
Merge pull request #13627 from twbs/maybe-fix-12364

Hopefully fixes trigger focus restoration on modal close
Merge pull request #13388 from twbs/xhmikosr-js-style

Improve JS style