(function( $ ) { $.widget("metro.rating", { version: "1.0.0", options: { score: 0, half: false, stars: 5, static: true, hints: ['bad', 'poor', 'regular', 'good', 'gorgeous'], showHint: false, showScore: false, scoreHint: "Current score: ", click: function(value, rating){} }, _create: function(){ var that = this, element = this.element; if (element.data('score') != undefined) { this.options.score = element.data('score'); } if (element.data('half') != undefined) { this.options.half = element.data('half'); } if (element.data('stars') != undefined) { this.options.stars = element.data('stars'); } if (element.data('showHint') != undefined) { this.options.showHint = element.data('showHint'); } if (element.data('static') != undefined) { this.options.static = element.data('static'); } if (element.data('showScore') != undefined) { this.options.showScore = element.data('showScore'); } if (element.data('scoreHint') != undefined) { this.options.scoreHint = element.data('scoreHint'); } this._showRating(); }, rate: function(value){ this.options.score = value; this._showRating(); }, _showRating: function(){ var that = this, element = this.element, options = this.options, ul, li; element.addClass("rating"); element.html(''); ul = $("