/** * jQuery Bar Rating Plugin v1.2.2 * * http://github.com/antennaio/jquery-bar-rating * * Copyright (c) 2012-2016 Kazik Pietruszewski * * This plugin is available under the MIT license. * http://www.opensource.org/licenses/mit-license.php */ (function (factory) { if (typeof define === 'function' && define.amd) { // AMD define(['jquery'], factory); } else if (typeof module === 'object' && module.exports) { // Node/CommonJS module.exports = factory(require('jquery')); } else { // browser globals factory(jQuery); } }(function ($) { var BarRating = (function() { function BarRating() { var self = this; // wrap element in a wrapper div var wrapElement = function() { var classes = ['br-wrapper']; if (self.options.theme !== '') { classes.push('br-theme-' + self.options.theme); } self.$elem.wrap($('
', { 'class': classes.join(' ') })); }; // unwrap element var unwrapElement = function() { self.$elem.unwrap(); }; // find option by value var findOption = function(value) { if ($.isNumeric(value)) { value = Math.floor(value); } return $('option[value="' + value + '"]', self.$elem); }; // get initial option var getInitialOption = function() { var initialRating = self.options.initialRating; if (!initialRating) { return $('option:selected', self.$elem); } return findOption(initialRating); }; // get empty option var getEmptyOption = function() { var $emptyOpt = self.$elem.find('option[value="' + self.options.emptyValue + '"]'); if (!$emptyOpt.length && self.options.allowEmpty) { $emptyOpt = $('