Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jquery-bar-rating

Package Overview
Dependencies
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jquery-bar-rating - npm Package Compare versions

Comparing version 1.1.3 to 1.1.4

LICENSE.txt

2

bower.json
{
"name": "jquery-bar-rating",
"version": "1.1.3",
"version": "1.1.4",
"homepage": "http://antenna.io/demo/jquery-bar-rating/examples/",

@@ -5,0 +5,0 @@ "repository": {

@@ -0,1 +1,12 @@

1.1.4
-----
- license file added
- bugfix: when using "set" method the colors are reversed (@hrishiballal, [#59](https://github.com/antennaio/jquery-bar-rating/issues/59))
- update selected rating value when tabbing (fixes issue [#51](https://github.com/antennaio/jquery-bar-rating/issues/51))
- bugfix: click doesn't fire onSelect after changing readonly to true and then to false (@zimarai, [#54](https://github.com/antennaio/jquery-bar-rating/pull/54))
1.1.3

@@ -2,0 +13,0 @@ -----

@@ -1,2 +0,2 @@

!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof module&&module.exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){var t=function(){function t(){var t=this,n=function(){var n=[t.options.wrapperClass];""!==t.options.theme&&n.push("br-theme-"+t.options.theme),t.$elem.wrap(e("<div />",{"class":n.join(" ")}))},r=function(){t.$elem.unwrap()},a=function(){var n;return n=t.options.initialRating?e('option[value="'+t.options.initialRating+'"]',t.$elem):e("option:selected",t.$elem)},i=function(e){var n=t.$elem.data("barrating");return"undefined"!=typeof e?n[e]:n},o=function(e,n){null!==n&&"object"==typeof n?t.$elem.data("barrating",n):t.$elem.data("barrating")[e]=n},s=function(){var e=a();o(null,{userOptions:t.options,ratingValue:e.val(),ratingText:e.data("html")?e.data("html"):e.text(),originalRatingValue:e.val(),originalRatingText:e.data("html")?e.data("html"):e.text(),readOnly:t.options.readonly,deselectable:t.$elem.find("option:first").val()?!1:!0})},l=function(){t.$elem.removeData("barrating")},u=function(){return i("ratingText")},d=function(){return i("ratingValue")},c=function(){var n=e("<div />",{"class":"br-widget"});return t.$elem.find("option").each(function(){var r,a,i,o;r=e(this).val(),r&&(a=e(this).text(),i=e(this).data("html"),i&&(a=i),o=e("<a />",{href:"#","data-rating-value":r,"data-rating-text":a,html:t.options.showValues?a:""}),n.append(o))}),t.options.showSelectedRating&&n.append(e("<div />",{text:"","class":"br-current-rating"})),t.options.reverse&&n.addClass("br-reverse"),t.options.readonly&&n.addClass("br-readonly"),n},f=function(){return t.options.reverse?"nextAll":"prevAll"},g=function(e){t.$elem.find('option[value="'+e+'"]').prop("selected",!0),t.$elem.change()},p=function(e){e=e?e:u(),t.options.showSelectedRating&&t.$elem.parent().find(".br-current-rating").text(e)},h=function(){t.$widget.find("a").removeClass("br-selected br-current"),t.$widget.find('a[data-rating-value="'+d()+'"]').addClass("br-selected br-current")[f()]().addClass("br-selected")},v=function(e){return e.hasClass("br-current")&&i("deselectable")},b=function(n){n.on("click.barrating",function(r){var a,i,s=e(this);return r.preventDefault(),n.removeClass("br-active br-selected"),s.addClass("br-selected")[f()]().addClass("br-selected"),a=s.attr("data-rating-value"),i=s.attr("data-rating-text"),v(s)?(s.removeClass("br-selected br-current")[f()]().removeClass("br-selected br-current"),a="",i=""):(n.removeClass("br-current"),s.addClass("br-current")),o("ratingValue",a),o("ratingText",i),g(a),p(i),t.options.onSelect.call(t,d(),u(),r),!1})},m=function(t){t.on("mouseenter.barrating",function(){var n=e(this);t.removeClass("br-active br-selected"),n.addClass("br-active")[f()]().addClass("br-active"),p(n.attr("data-rating-text"))})},$=function(e){t.$widget.on("mouseleave.barrating",function(){e.removeClass("br-active"),p(),h()})},w=function(t){t.on("touchstart.barrating",function(t){t.preventDefault(),t.stopPropagation(),e(this).click()})},y=function(e){e.on("click.barrating",function(e){e.preventDefault()})},C=function(e){b(e),t.options.hoverState&&(m(e),$(e))},x=function(e){e.off(".barrating")},R=function(e){$elements=t.$widget.find("a"),w&&w($elements),e?(x($elements),y($elements)):C($elements)};this.show=function(){i()||(n(),s(),t.$widget=c(),t.$widget.insertAfter(t.$elem),h(),p(),R(t.options.readonly),t.$elem.hide())},this.readonly=function(e){"boolean"==typeof e&&i("readOnly")!=e&&(R(e),o("readOnly",e),t.$widget.toggleClass("br-readonly"))},this.set=function(e){var n=i("userOptions");t.$elem.find('option[value="'+e+'"]').val()&&(o("ratingValue",e),o("ratingText",t.$elem.find('option[value="'+e+'"]').text()),g(d()),p(u()),h(),n.silent||n.onSelect.call(this,d(),u()))},this.clear=function(){var e=i("userOptions");o("ratingValue",i("originalRatingValue")),o("ratingText",i("originalRatingText")),g(d()),p(u()),h(),e.onClear.call(this,d(),u())},this.destroy=function(){var e=d(),n=u(),a=i("userOptions");x(t.$widget.find("a")),t.$widget.remove(),l(),r(),t.$elem.show(),a.onDestroy.call(this,e,n)}}return t.prototype.init=function(t,n){return this.$elem=e(n),this.options=e.extend({},e.fn.barrating.defaults,t),this.options},t}();e.fn.barrating=function(n,r){return this.each(function(){var a=new t;if(e(this).is("select")||e.error("Sorry, this plugin only works with select fields."),a.hasOwnProperty(n)){if(a.init(r,this),"show"===n)return a.show(r);if(a.$elem.data("barrating"))return a.$widget=e(this).next(".br-widget"),a[n](r)}else{if("object"==typeof n||!n)return r=n,a.init(r,this),a.show();e.error("Method "+n+" does not exist on jQuery.barrating")}})},e.fn.barrating.defaults={theme:"",initialRating:null,showValues:!1,showSelectedRating:!0,reverse:!1,readonly:!1,fastClicks:!0,hoverState:!0,silent:!1,wrapperClass:"br-wrapper",onSelect:function(e,t,n){},onClear:function(e,t){},onDestroy:function(e,t){}},e.fn.barrating.BarRating=t});
!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof module&&module.exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){var t=function(){function t(){var t=this,n=function(){var n=[t.options.wrapperClass];""!==t.options.theme&&n.push("br-theme-"+t.options.theme),t.$elem.wrap(e("<div />",{"class":n.join(" ")}))},r=function(){t.$elem.unwrap()},a=function(){var n;return n=t.options.initialRating?e('option[value="'+t.options.initialRating+'"]',t.$elem):e("option:selected",t.$elem)},i=function(e){var n=t.$elem.data("barrating");return"undefined"!=typeof e?n[e]:n},o=function(e,n){null!==n&&"object"==typeof n?t.$elem.data("barrating",n):t.$elem.data("barrating")[e]=n},s=function(){var e=a();o(null,{userOptions:t.options,ratingValue:e.val(),ratingText:e.data("html")?e.data("html"):e.text(),originalRatingValue:e.val(),originalRatingText:e.data("html")?e.data("html"):e.text(),readOnly:t.options.readonly,deselectable:t.$elem.find("option:first").val()?!1:!0})},l=function(){t.$elem.removeData("barrating")},u=function(){return i("ratingText")},c=function(){return i("ratingValue")},d=function(){var n=e("<div />",{"class":"br-widget"});return t.$elem.find("option").each(function(){var r,a,i,o;r=e(this).val(),r&&(a=e(this).text(),i=e(this).data("html"),i&&(a=i),o=e("<a />",{href:"#","data-rating-value":r,"data-rating-text":a,html:t.options.showValues?a:""}),n.append(o))}),t.options.showSelectedRating&&n.append(e("<div />",{text:"","class":"br-current-rating"})),t.options.reverse&&n.addClass("br-reverse"),t.options.readonly&&n.addClass("br-readonly"),n},f=function(){return i("userOptions").reverse?"nextAll":"prevAll"},g=function(e){t.$elem.find('option[value="'+e+'"]').prop("selected",!0),t.$elem.change()},p=function(e){e=e?e:u(),t.options.showSelectedRating&&t.$elem.parent().find(".br-current-rating").text(e)},h=function(){t.$widget.find("a").removeClass("br-selected br-current"),t.$widget.find('a[data-rating-value="'+c()+'"]').addClass("br-selected br-current")[f()]().addClass("br-selected")},b=function(e){return e.hasClass("br-current")&&i("deselectable")},v=function(n){n.on("click.barrating",function(r){var a,s,l=e(this),d=i("userOptions");return r.preventDefault(),n.removeClass("br-active br-selected"),l.addClass("br-selected")[f()]().addClass("br-selected"),a=l.attr("data-rating-value"),s=l.attr("data-rating-text"),b(l)?(l.removeClass("br-selected br-current")[f()]().removeClass("br-selected br-current"),a="",s=""):(n.removeClass("br-current"),l.addClass("br-current")),o("ratingValue",a),o("ratingText",s),g(a),p(s),d.onSelect.call(t,c(),u(),r),!1})},m=function(t){t.on("mouseenter.barrating focus.barrating",function(){var n=e(this);t.removeClass("br-active br-selected"),n.addClass("br-active")[f()]().addClass("br-active"),p(n.attr("data-rating-text"))})},$=function(e){t.$widget.on("mouseleave.barrating blur.barrating",function(){e.removeClass("br-active"),p(),h()})},w=function(t){t.on("touchstart.barrating",function(t){t.preventDefault(),t.stopPropagation(),e(this).click()})},y=function(e){e.on("click.barrating",function(e){e.preventDefault()})},C=function(e){v(e),t.options.hoverState&&(m(e),$(e))},x=function(e){e.off(".barrating")},R=function(e){$elements=t.$widget.find("a"),w&&w($elements),e?(x($elements),y($elements)):C($elements)};this.show=function(){i()||(n(),s(),t.$widget=d(),t.$widget.insertAfter(t.$elem),h(),p(),R(t.options.readonly),t.$elem.hide())},this.readonly=function(e){"boolean"==typeof e&&i("readOnly")!=e&&(R(e),o("readOnly",e),t.$widget.toggleClass("br-readonly"))},this.set=function(e){var n=i("userOptions");t.$elem.find('option[value="'+e+'"]').val()&&(o("ratingValue",e),o("ratingText",t.$elem.find('option[value="'+e+'"]').text()),g(c()),p(u()),h(),n.silent||n.onSelect.call(this,c(),u()))},this.clear=function(){var e=i("userOptions");o("ratingValue",i("originalRatingValue")),o("ratingText",i("originalRatingText")),g(c()),p(u()),h(),e.onClear.call(this,c(),u())},this.destroy=function(){var e=c(),n=u(),a=i("userOptions");x(t.$widget.find("a")),t.$widget.remove(),l(),r(),t.$elem.show(),a.onDestroy.call(this,e,n)}}return t.prototype.init=function(t,n){return this.$elem=e(n),this.options=e.extend({},e.fn.barrating.defaults,t),this.options},t}();e.fn.barrating=function(n,r){return this.each(function(){var a=new t;if(e(this).is("select")||e.error("Sorry, this plugin only works with select fields."),a.hasOwnProperty(n)){if(a.init(r,this),"show"===n)return a.show(r);if(a.$elem.data("barrating"))return a.$widget=e(this).next(".br-widget"),a[n](r)}else{if("object"==typeof n||!n)return r=n,a.init(r,this),a.show();e.error("Method "+n+" does not exist on jQuery.barrating")}})},e.fn.barrating.defaults={theme:"",initialRating:null,showValues:!1,showSelectedRating:!0,reverse:!1,readonly:!1,fastClicks:!0,hoverState:!0,silent:!1,wrapperClass:"br-wrapper",onSelect:function(e,t,n){},onClear:function(e,t){},onDestroy:function(e,t){}},e.fn.barrating.BarRating=t});
//# sourceMappingURL=jquery.barrating.min.js.map
/**
* jQuery Bar Rating Plugin v1.1.3
* jQuery Bar Rating Plugin v1.1.4
*

@@ -166,3 +166,3 @@ * http://github.com/antennaio/jquery-bar-rating

var nextAllorPreviousAll = function() {
if (self.options.reverse) {
if (getData('userOptions').reverse) {
return 'nextAll';

@@ -212,2 +212,3 @@ } else {

var $a = $(this),
options = getData('userOptions'),
value,

@@ -243,3 +244,3 @@ text;

// onSelect callback
self.options.onSelect.call(
options.onSelect.call(
self,

@@ -257,3 +258,3 @@ ratingValue(),

var attachMouseEnterHandler = function($elements) {
$elements.on('mouseenter.barrating', function() {
$elements.on('mouseenter.barrating focus.barrating', function() {
var $a = $(this);

@@ -271,3 +272,3 @@

var attachMouseLeaveHandler = function($elements) {
self.$widget.on('mouseleave.barrating', function() {
self.$widget.on('mouseleave.barrating blur.barrating', function() {
$elements.removeClass('br-active');

@@ -274,0 +275,0 @@ showSelectedRating();

{
"name": "jquery-bar-rating",
"description": "Minimal, light-weight jQuery ratings.",
"version": "1.1.3",
"version": "1.1.4",
"main": "jquery.barrating.js",

@@ -6,0 +6,0 @@ "keywords": [

@@ -22,4 +22,2 @@ # jQuery Bar Rating Plugin [![Build Status](https://travis-ci.org/antennaio/jquery-bar-rating.svg?branch=master)](https://travis-ci.org/antennaio/jquery-bar-rating)

Dual licensed under the MIT and GPL licenses:<br />
[http://www.opensource.org/licenses/mit-license.php](http://www.opensource.org/licenses/mit-license.php)<br />
[http://www.gnu.org/licenses/gpl.html](http://www.gnu.org/licenses/gpl.html)
This plugin is available under [the MIT license](http://www.opensource.org/licenses/mit-license.php).

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc