fix display algorithm for calendar
refactoring
extract TooltipAPI and add .jshintrc