(This is an offshoot of #222953: Fivestar doesn't work properly with Thickbox in Firefox, to allow Fivestar to work in a Thickbox.)

1. The JS portion does $('...').rating() to kick in the pyrotechnics. However, no protection against multiple calls is in place. A 'guard class', e.g. 'jsrating-processed', should be used --as is done in any other place in Drupal.

2. Currently, the JS code uses "$(document).ready(...)". It should instead use "Drupal.behaviors".

(Preferably, we should use some simple logic to make the code run on D5 as well; We don't want to maintain two versions of 'jquery.rating.js'.)


mooffie’s picture

I forgot to explain what these two points (actually, only the first point) has to do with Thickbox:

When Thickbox loads a page, in a 'box', it does this via Ajax. It eval()s the scripts of this new boxed page, and --that's important!-- it does this in the context of the 'main' page. So if the 'main' page contained some Fivestar widgets already, $(...).rating() would be re-applied on them, and the result is that the widgets are showed twice.

quicksketch’s picture

Yeah agreed on all points. Right now the 6.x version is identical to 5.x javascript. Using behaviors is a good move though to make AHAH additions of Fivestar an easy task.

quicksketch’s picture

Version: 6.x-1.11-beta5 » 6.x-1.13
Category: task » bug
Status: Active » Fixed

Fivestar wasn't properly using behaviors, even in 1.13. I've switched it to using behaviors in the Drupal 6 version, and added the guard class like you suggest in both the Drupal 5 and 6 versions.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.