Function that takes a mouse event and tells you whether it's a simple left-click.
- Works around browser inconsistencies in
event.which
(using jQuery's technique). - Checks that no modifier keys are pressed.
element.addEventListener('click', function (event) {
if (!isSimpleClick(event)) return;
// ok, do something...
});