Optimize stars by not emitting inline javascript and loading info out of data attributes.

Review Request #1900 — Created Nov. 9, 2010 and submitted — Latest diff uploaded


Review Board


This change reworks the "star" functionality (shown on reviews and the dashboard) to be lighter weight in terms of HTML page weight and JavaScript execution, by following an "unobtrusive JavaScript" pattern. The stars plugin is changed to load the parameters for stars from data attributes on the star itself instead of a script tag emitted for each star, and then they are all set up at once by class name. The jQuery code to handle stars is also cleaned up and made a bit more efficient partially by moving things out of the loops and closures and partially by caching things using jQuery.data(). This does change the contract for the toggleStar plugin, but as far as I can tell it is only used here.
This change is in use on our ReviewBoard install.