|
@ -49,14 +49,15 @@ $.fn.rating = function(parameters) { |
|
|
module = { |
|
|
module = { |
|
|
|
|
|
|
|
|
initialize: function() { |
|
|
initialize: function() { |
|
|
module.verbose('Initializing rating module'); |
|
|
|
|
|
|
|
|
module.verbose('Initializing rating module', settings); |
|
|
|
|
|
|
|
|
if(settings.interactive) { |
|
|
if(settings.interactive) { |
|
|
$icon |
|
|
|
|
|
.bind('mouseenter' + eventNamespace, module.event.mouseenter) |
|
|
|
|
|
.bind('mouseleave' + eventNamespace, module.event.mouseleave) |
|
|
|
|
|
.bind('click' + eventNamespace, module.event.click) |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
module.enable(); |
|
|
} |
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
module.disable(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if(settings.initialRating) { |
|
|
if(settings.initialRating) { |
|
|
module.debug('Setting initial rating'); |
|
|
module.debug('Setting initial rating'); |
|
|
module.setRating(settings.initialRating); |
|
|
module.setRating(settings.initialRating); |
|
@ -65,9 +66,6 @@ $.fn.rating = function(parameters) { |
|
|
module.debug('Rating found in metadata'); |
|
|
module.debug('Rating found in metadata'); |
|
|
module.setRating( $module.data(metadata.rating) ); |
|
|
module.setRating( $module.data(metadata.rating) ); |
|
|
} |
|
|
} |
|
|
$module |
|
|
|
|
|
.addClass(className.active) |
|
|
|
|
|
; |
|
|
|
|
|
module.instantiate(); |
|
|
module.instantiate(); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
@ -141,6 +139,28 @@ $.fn.rating = function(parameters) { |
|
|
return currentRating; |
|
|
return currentRating; |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
enable: function() { |
|
|
|
|
|
module.debug('Setting rating to interactive mode'); |
|
|
|
|
|
$icon |
|
|
|
|
|
.on('mouseenter' + eventNamespace, module.event.mouseenter) |
|
|
|
|
|
.on('mouseleave' + eventNamespace, module.event.mouseleave) |
|
|
|
|
|
.on('click' + eventNamespace, module.event.click) |
|
|
|
|
|
; |
|
|
|
|
|
$module |
|
|
|
|
|
.addClass(className.active) |
|
|
|
|
|
; |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
disable: function() { |
|
|
|
|
|
module.debug('Setting rating to read-only mode'); |
|
|
|
|
|
$icon |
|
|
|
|
|
.off(eventNamespace) |
|
|
|
|
|
; |
|
|
|
|
|
$module |
|
|
|
|
|
.removeClass(className.active) |
|
|
|
|
|
; |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
setRating: function(rating) { |
|
|
setRating: function(rating) { |
|
|
var |
|
|
var |
|
|
ratingIndex = (rating - 1 >= 0) |
|
|
ratingIndex = (rating - 1 >= 0) |
|
|