1 2 3 4var __slice = [].slice; 5(function($, window) { 6 var Starrr; 7 8 Starrr = (function() { 9 Starrr.prototype.defaults = { 10 rating: void 0, 11 numStars: 5, 12 change: function(e, value) {} 13 }; 14 15 function Starrr($el, options) { 16 var i, _, _ref, 17 _this = this; 18 19 this.options = $.extend({}, this.defaults, options); 20 this.$el = $el; 21 _ref = this.defaults; 22 for (i in _ref) { 23 _ = _ref[i]; 24 if (this.$el.data(i) != null) { 25 this.options[i] = this.$el.data(i); 26 } 27 } 28 this.createStars(); 29 this.syncRating(); 30 this.$el.on('mouseover.starrr', 'span', function(e) { 31 return _this.syncRating(_this.$el.find('span').index(e.currentTarget) + 1); 32 }); 33 this.$el.on('mouseout.starrr', function() { 34 return _this.syncRating(); 35 }); 36 this.$el.on('click.starrr', 'span', function(e) { 37 return _this.setRating(_this.$el.find('span').index(e.currentTarget) + 1); 38 }); 39 this.$el.on('starrr:change', this.options.change); 40 } 41 42 Starrr.prototype.createStars = function() { 43 var _i, _ref, _results; 44 45 _results = []; 46 for (_i = 1, _ref = this.options.numStars; 1 <= _ref ? _i <= _ref : _i >= _ref; 1 <= _ref ? _i++ : _i--) { 47 _results.push(this.$el.append("<span class='glyphicon .glyphicon-star ec'></span>")); 48 } 49 return _results; 50 }; 51 52 Starrr.prototype.setRating = function(rating) { 53 if (this.options.rating === rating) { 54 rating = void 0; 55 } 56 this.options.rating = rating; 57 this.syncRating(); 58 return this.$el.trigger('starrr:change', rating); 59 }; 60 61 Starrr.prototype.syncRating = function(rating) { 62 var i, _i, _j, _ref; 63 64 rating || (rating = this.options.rating); 65 if (rating) { 66 for (i = _i = 0, _ref = rating - 1; 0 <= _ref ? _i <= _ref : _i >= _ref; i = 0 <= _ref ? ++_i : --_i) { 67 this.$el.find('span').eq(i).removeClass('glyphicon-star-empty ec').addClass('glyphicon-star'); 68 } 69 } 70 if (rating && rating < 5) { 71 for (i = _j = rating; rating <= 4 ? _j <= 4 : _j >= 4; i = rating <= 4 ? ++_j : --_j) { 72 this.$el.find('span').eq(i).removeClass('glyphicon-star').addClass('glyphicon-star-empty ec'); 73 } 74 } 75 if (!rating) { 76 return this.$el.find('span').removeClass('glyphicon-star').addClass('glyphicon-star-empty ec'); 77 } 78 }; 79 80 return Starrr; 81 82 })(); 83 84 85 86 87 88 89 90 91 return $.fn.extend({ 92 starrr: function() { 93 var args, option; 94 95 option = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : []; 96 return this.each(function() { 97 var data; 98 99 data = $(this).data('star-rating'); 100 if (!data) { 101 $(this).data('star-rating', (data = new Starrr($(this), option))); 102 } 103 if (typeof option === 'string') { 104 return data[option].apply(data, args); 105 } 106 }); 107 } 108 }); 109})(window.jQuery, window) 110 111 112 113$(function() { 114 return $(".starrr").starrr(); 115}); 116 117 118$( document ).ready(function() { 119 120 $('#stars-existing').on('starrr:change', function(e, value){ 121 var result = $('#count-existing').html(value); 122 123 $('#star1.ClientID').attr('value', value); 124 125 126 $('#star1').val(value); 127 128 129 // alert($('#star1').val()); 130 131 }); 132 133 134 135});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.