Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions Source/mooRatings-1.1.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,16 +145,24 @@ var mooRatings = new Class({
// get the current selected rating star
var current = this.container.getElement('a[title=ui-rating-value-' + rating + ']');
if (current){
//if the current star is already full, empty it and the next stars
if (current.get('class').indexOf('ui-rating-full') > -1){
current.set('class', 'ui-rating-star ui-rating-empty');
current.getAllNext()
.set('class', 'ui-rating-star ui-rating-empty');
}
else {
// highlight current and previous stars in yellow
current.set('class', 'ui-rating-star ui-rating-full')
.getAllPrevious()
.set('class', 'ui-rating-star ui-rating-full');

// remove highlight from higher ratings
current.getAllNext()
.set('class', 'ui-rating-star ui-rating-empty');
current.set('class', 'ui-rating-star ui-rating-full')
.getAllPrevious()
.set('class', 'ui-rating-star ui-rating-full');

// remove highlight from higher ratings
current.getAllNext()
.set('class', 'ui-rating-star ui-rating-empty');
}
}
// synchronize the rate with the selectbox
this.selectBox.set('value', rating);
}
});
});