meatspaces/meatspace-chat — pull request #111 by imakewebthings (2013-11-23 05:13:38+00:00)
Title: Hide offscreen anigifs to improve CPU performance

This commit aims to do the same thing as #59 but addresses the performance concerns brought up by @rwaldron. In this version a class (`out-of-view`) is added to chat list items that are not in the viewport, and `img`s of out-of-view chats are set to `display:none` in CSS. This is done using [jQuery Waypoints](http://imakewebthings.com/jquery-waypoints). Waypoints takes care of these performance concerns by:

- Throttling the scroll event.
- During the throttled handler, not hitting the DOM. Instead for each element an integer value is cached and that is compared against the current scroll position during the throttled event.
- The DOM hits and calculations are done only at times when that value may change: a new chat is added or the window is resized.
- Resize recalculations are also throttled.
- The out-of-view class is considered on both the top edge and bottom edge of the viewport. I believe the previous pull only concerned itself with the top.