jquery-bar-rating
Advanced tools
Comparing version 1.2.0 to 1.2.1
{ | ||
"name": "jquery-bar-rating", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"homepage": "http://antenna.io/demo/jquery-bar-rating/examples/", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -0,3 +1,10 @@ | ||
1.2.1 | ||
----- | ||
- fixed variable declaration (@schurig, [#68](https://github.com/antennaio/jquery-bar-rating/pull/68)) | ||
- added a note about [R language integration](https://github.com/harveyl888/barRating) to the FAQ (@harveyl888, [#67](https://github.com/antennaio/jquery-bar-rating/issues/67)) | ||
1.2.0 | ||
_____ | ||
----- | ||
@@ -4,0 +11,0 @@ - deprecated `wrapperClass` option removed |
@@ -1,2 +0,2 @@ | ||
!function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=t(require("jquery")):t(jQuery)}(function(t){var e=function(){function e(){var e=this,n=function(){var n=["br-wrapper"];""!==e.options.theme&&n.push("br-theme-"+e.options.theme),e.$elem.wrap(t("<div />",{"class":n.join(" ")}))},i=function(){e.$elem.unwrap()},a=function(n){return t.isNumeric(n)&&(n=Math.floor(n)),t('option[value="'+n+'"]',e.$elem)},r=function(){var n=e.options.initialRating;return n?a(n):t("option:selected",e.$elem)},o=function(t){var n=e.$elem.data("barrating");return"undefined"!=typeof t?n[t]:n},l=function(t,n){null!==n&&"object"==typeof n?e.$elem.data("barrating",n):e.$elem.data("barrating")[t]=n},s=function(){var t=r(),n=t.val(),i=t.data("html")?t.data("html"):t.text();l(null,{userOptions:e.options,ratingValue:n,ratingText:i,originalRatingValue:n,originalRatingText:i,readOnly:e.options.readonly,ratingMade:!1})},u=function(){e.$elem.removeData("barrating")},d=function(){return o("ratingText")},c=function(){return o("ratingValue")},f=function(){var n=t("<div />",{"class":"br-widget"});return e.$elem.find("option").each(function(){var i,a,r,o;i=t(this).val(),i&&(a=t(this).text(),r=t(this).data("html"),r&&(a=r),o=t("<a />",{href:"#","data-rating-value":i,"data-rating-text":a,html:e.options.showValues?a:""}),n.append(o))}),e.options.showSelectedRating&&n.append(t("<div />",{text:"","class":"br-current-rating"})),e.options.reverse&&n.addClass("br-reverse"),e.options.readonly&&n.addClass("br-readonly"),n},g=function(){return o("userOptions").reverse?"nextAll":"prevAll"},p=function(t){a(t).prop("selected",!0),e.$elem.change()},h=function(){t("option",e.$elem).prop("selected",function(){return this.defaultSelected}),e.$elem.change()},v=function(t){t=t?t:d(),e.options.showSelectedRating&&e.$elem.parent().find(".br-current-rating").text(t)},m=function(t){return Math.round(Math.floor(10*t)/10%1*100)},b=function(){e.$widget.find("a").removeClass()},$=function(){var n,i,a=e.$widget.find('a[data-rating-value="'+c()+'"]'),r=o("userOptions").initialRating,l=t.isNumeric(c())?c():0,s=m(r);if(b(),a.addClass("br-selected br-current")[g()]().addClass("br-selected"),!o("ratingMade")&&t.isNumeric(r)){if(l>=r||!s)return;n=e.$widget.find("a"),i=a.length?a[o("userOptions").reverse?"prev":"next"]():n[o("userOptions").reverse?"last":"first"](),i.addClass("br-fractional"),i.addClass("br-fractional-"+s)}},w=function(t){return e.options.deselectable?e.$elem.find("option:first").val()?!1:c()==t.attr("data-rating-value"):!1},y=function(n){n.on("click.barrating",function(n){var i,a,r=t(this),s=o("userOptions");return n.preventDefault(),i=r.attr("data-rating-value"),a=r.attr("data-rating-text"),w(r)&&(i="",a=""),l("ratingValue",i),l("ratingText",a),l("ratingMade",!0),p(i),v(a),$(),s.onSelect.call(e,c(),d(),n),!1})},x=function(e){e.on("mouseenter.barrating",function(){var e=t(this);b(),e.addClass("br-active")[g()]().addClass("br-active"),v(e.attr("data-rating-text"))})},C=function(t){e.$widget.on("mouseleave.barrating blur.barrating",function(){v(),$()})},O=function(e){e.on("touchstart.barrating",function(e){e.preventDefault(),e.stopPropagation(),t(this).click()})},R=function(t){t.on("click.barrating",function(t){t.preventDefault()})},S=function(t){y(t),e.options.hoverState&&(x(t),C(t))},M=function(t){t.off(".barrating")},V=function(t){$elements=e.$widget.find("a"),O&&O($elements),t?(M($elements),R($elements)):S($elements)};this.show=function(){o()||(n(),s(),e.$widget=f(),e.$widget.insertAfter(e.$elem),$(),v(),V(e.options.readonly),e.$elem.hide())},this.readonly=function(t){"boolean"==typeof t&&o("readOnly")!=t&&(V(t),l("readOnly",t),e.$widget.toggleClass("br-readonly"))},this.set=function(t){var n=o("userOptions");e.$elem.find('option[value="'+t+'"]').val()&&(l("ratingValue",t),l("ratingText",e.$elem.find('option[value="'+t+'"]').text()),l("ratingMade",!0),p(c()),v(d()),$(),n.silent||n.onSelect.call(this,c(),d()))},this.clear=function(){var t=o("userOptions");l("ratingValue",o("originalRatingValue")),l("ratingText",o("originalRatingText")),l("ratingMade",!1),h(),v(d()),$(),t.onClear.call(this,c(),d())},this.destroy=function(){var t=c(),n=d(),a=o("userOptions");M(e.$widget.find("a")),e.$widget.remove(),u(),i(),e.$elem.show(),a.onDestroy.call(this,t,n)}}return e.prototype.init=function(e,n){return this.$elem=t(n),this.options=t.extend({},t.fn.barrating.defaults,e),this.options},e}();t.fn.barrating=function(n,i){return this.each(function(){var a=new e;if(t(this).is("select")||t.error("Sorry, this plugin only works with select fields."),a.hasOwnProperty(n)){if(a.init(i,this),"show"===n)return a.show(i);if(a.$elem.data("barrating"))return a.$widget=t(this).next(".br-widget"),a[n](i)}else{if("object"==typeof n||!n)return i=n,a.init(i,this),a.show();t.error("Method "+n+" does not exist on jQuery.barrating")}})},t.fn.barrating.defaults={theme:"",initialRating:null,showValues:!1,showSelectedRating:!0,deselectable:!0,reverse:!1,readonly:!1,fastClicks:!0,hoverState:!0,silent:!1,onSelect:function(t,e,n){},onClear:function(t,e){},onDestroy:function(t,e){}},t.fn.barrating.BarRating=e}); | ||
!function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=t(require("jquery")):t(jQuery)}(function(t){var e=function(){function e(){var e=this,n=function(){var n=["br-wrapper"];""!==e.options.theme&&n.push("br-theme-"+e.options.theme),e.$elem.wrap(t("<div />",{"class":n.join(" ")}))},i=function(){e.$elem.unwrap()},a=function(n){return t.isNumeric(n)&&(n=Math.floor(n)),t('option[value="'+n+'"]',e.$elem)},r=function(){var n=e.options.initialRating;return n?a(n):t("option:selected",e.$elem)},o=function(t){var n=e.$elem.data("barrating");return"undefined"!=typeof t?n[t]:n},l=function(t,n){null!==n&&"object"==typeof n?e.$elem.data("barrating",n):e.$elem.data("barrating")[t]=n},s=function(){var t=r(),n=t.val(),i=t.data("html")?t.data("html"):t.text();l(null,{userOptions:e.options,ratingValue:n,ratingText:i,originalRatingValue:n,originalRatingText:i,readOnly:e.options.readonly,ratingMade:!1})},u=function(){e.$elem.removeData("barrating")},d=function(){return o("ratingText")},c=function(){return o("ratingValue")},f=function(){var n=t("<div />",{"class":"br-widget"});return e.$elem.find("option").each(function(){var i,a,r,o;i=t(this).val(),i&&(a=t(this).text(),r=t(this).data("html"),r&&(a=r),o=t("<a />",{href:"#","data-rating-value":i,"data-rating-text":a,html:e.options.showValues?a:""}),n.append(o))}),e.options.showSelectedRating&&n.append(t("<div />",{text:"","class":"br-current-rating"})),e.options.reverse&&n.addClass("br-reverse"),e.options.readonly&&n.addClass("br-readonly"),n},g=function(){return o("userOptions").reverse?"nextAll":"prevAll"},p=function(t){a(t).prop("selected",!0),e.$elem.change()},h=function(){t("option",e.$elem).prop("selected",function(){return this.defaultSelected}),e.$elem.change()},v=function(t){t=t?t:d(),e.options.showSelectedRating&&e.$elem.parent().find(".br-current-rating").text(t)},m=function(t){return Math.round(Math.floor(10*t)/10%1*100)},b=function(){e.$widget.find("a").removeClass(function(t,e){return(e.match(/(^|\s)br-\S+/g)||[]).join(" ")})},$=function(){var n,i,a=e.$widget.find('a[data-rating-value="'+c()+'"]'),r=o("userOptions").initialRating,l=t.isNumeric(c())?c():0,s=m(r);if(b(),a.addClass("br-selected br-current")[g()]().addClass("br-selected"),!o("ratingMade")&&t.isNumeric(r)){if(l>=r||!s)return;n=e.$widget.find("a"),i=a.length?a[o("userOptions").reverse?"prev":"next"]():n[o("userOptions").reverse?"last":"first"](),i.addClass("br-fractional"),i.addClass("br-fractional-"+s)}},w=function(t){return e.options.deselectable?e.$elem.find("option:first").val()?!1:c()==t.attr("data-rating-value"):!1},y=function(n){n.on("click.barrating",function(n){var i,a,r=t(this),s=o("userOptions");return n.preventDefault(),i=r.attr("data-rating-value"),a=r.attr("data-rating-text"),w(r)&&(i="",a=""),l("ratingValue",i),l("ratingText",a),l("ratingMade",!0),p(i),v(a),$(),s.onSelect.call(e,c(),d(),n),!1})},x=function(e){e.on("mouseenter.barrating",function(){var e=t(this);b(),e.addClass("br-active")[g()]().addClass("br-active"),v(e.attr("data-rating-text"))})},C=function(t){e.$widget.on("mouseleave.barrating blur.barrating",function(){v(),$()})},O=function(e){e.on("touchstart.barrating",function(e){e.preventDefault(),e.stopPropagation(),t(this).click()})},R=function(t){t.on("click.barrating",function(t){t.preventDefault()})},S=function(t){y(t),e.options.hoverState&&(x(t),C(t))},j=function(t){t.off(".barrating")},M=function(t){var n=e.$widget.find("a");O&&O(n),t?(j(n),R(n)):S(n)};this.show=function(){o()||(n(),s(),e.$widget=f(),e.$widget.insertAfter(e.$elem),$(),v(),M(e.options.readonly),e.$elem.hide())},this.readonly=function(t){"boolean"==typeof t&&o("readOnly")!=t&&(M(t),l("readOnly",t),e.$widget.toggleClass("br-readonly"))},this.set=function(t){var n=o("userOptions");e.$elem.find('option[value="'+t+'"]').val()&&(l("ratingValue",t),l("ratingText",e.$elem.find('option[value="'+t+'"]').text()),l("ratingMade",!0),p(c()),v(d()),$(),n.silent||n.onSelect.call(this,c(),d()))},this.clear=function(){var t=o("userOptions");l("ratingValue",o("originalRatingValue")),l("ratingText",o("originalRatingText")),l("ratingMade",!1),h(),v(d()),$(),t.onClear.call(this,c(),d())},this.destroy=function(){var t=c(),n=d(),a=o("userOptions");j(e.$widget.find("a")),e.$widget.remove(),u(),i(),e.$elem.show(),a.onDestroy.call(this,t,n)}}return e.prototype.init=function(e,n){return this.$elem=t(n),this.options=t.extend({},t.fn.barrating.defaults,e),this.options},e}();t.fn.barrating=function(n,i){return this.each(function(){var a=new e;if(t(this).is("select")||t.error("Sorry, this plugin only works with select fields."),a.hasOwnProperty(n)){if(a.init(i,this),"show"===n)return a.show(i);if(a.$elem.data("barrating"))return a.$widget=t(this).next(".br-widget"),a[n](i)}else{if("object"==typeof n||!n)return i=n,a.init(i,this),a.show();t.error("Method "+n+" does not exist on jQuery.barrating")}})},t.fn.barrating.defaults={theme:"",initialRating:null,showValues:!1,showSelectedRating:!0,deselectable:!0,reverse:!1,readonly:!1,fastClicks:!0,hoverState:!0,silent:!1,onSelect:function(t,e,n){},onClear:function(t,e){},onDestroy:function(t,e){}},t.fn.barrating.BarRating=e}); | ||
//# sourceMappingURL=jquery.barrating.min.js.map |
@@ -5,3 +5,3 @@ var gulp = require('gulp'), | ||
uglify = require('gulp-uglify'), | ||
karma = require('gulp-karma') | ||
KarmaServer = require('karma').Server, | ||
rename = require('gulp-rename'), | ||
@@ -45,12 +45,6 @@ sourcemaps = require('gulp-sourcemaps'), | ||
gulp.task('test', function() { | ||
return gulp.src('dummy') | ||
.pipe(karma({ | ||
configFile: 'karma.conf.js', | ||
action: 'run' | ||
})) | ||
.on('error', function(err) { | ||
// Stop gulp from any further processing. | ||
throw err; | ||
}); | ||
gulp.task('test', function(done) { | ||
new KarmaServer({ | ||
configFile: __dirname + '/karma.conf.js' | ||
}, done).start(); | ||
}); | ||
@@ -57,0 +51,0 @@ |
/** | ||
* jQuery Bar Rating Plugin v1.2.0 | ||
* jQuery Bar Rating Plugin v1.2.1 | ||
* | ||
@@ -36,3 +36,3 @@ * http://github.com/antennaio/jquery-bar-rating | ||
} | ||
self.$elem.wrap($('<div />', { | ||
@@ -218,3 +218,6 @@ 'class': classes.join(' ') | ||
var resetStyle = function() { | ||
self.$widget.find('a').removeClass(); | ||
// remove all classes starting with br-* | ||
self.$widget.find('a').removeClass(function(index, classes) { | ||
return (classes.match(/(^|\s)br-\S+/g) || []).join(' '); | ||
}); | ||
}; | ||
@@ -367,3 +370,3 @@ | ||
var setupHandlers = function(readonly) { | ||
$elements = self.$widget.find('a'); | ||
var $elements = self.$widget.find('a'); | ||
@@ -370,0 +373,0 @@ if (fastClicks) { |
@@ -24,7 +24,11 @@ module.exports = function (config) { | ||
// use dots reporter, as travis terminal does not support escaping sequences | ||
// possible values: 'dots', 'progress' | ||
// possible values: 'progress', 'junit' | ||
// CLI --reporters progress | ||
reporters: ['progress', 'junit'], | ||
junitReporter: { | ||
outputDir: '', | ||
outputFile: 'test-results.xml' | ||
}, | ||
// web server port | ||
@@ -31,0 +35,0 @@ // CLI --port 9876 |
{ | ||
"name": "jquery-bar-rating", | ||
"description": "Minimal, light-weight jQuery ratings.", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"main": "jquery.barrating.js", | ||
"license": "MIT", | ||
"keywords": [ | ||
@@ -20,19 +21,19 @@ "jquery", | ||
"devDependencies": { | ||
"chai": "2.3.0", | ||
"gulp": "3.8.11", | ||
"gulp-jshint": "1.10.0", | ||
"gulp-karma": "0.0.4", | ||
"gulp-less": "3.0.3", | ||
"chai": "3.5.0", | ||
"gulp": "3.9.1", | ||
"gulp-jshint": "2.0.1", | ||
"gulp-less": "3.1.0", | ||
"gulp-rename": "1.2.2", | ||
"gulp-sourcemaps": "1.5.2", | ||
"gulp-uglify": "1.2.0", | ||
"karma": "^0.12.36", | ||
"karma-chai": "^0.1.0", | ||
"karma-chrome-launcher": "^0.1.12", | ||
"karma-mocha": "^0.1.10", | ||
"karma-phantomjs-launcher": "^0.2.0", | ||
"karma-junit-reporter": "~0.2", | ||
"mocha": "2.2.4", | ||
"phantomjs": "^1.9.17", | ||
"run-sequence": "1.1.0" | ||
"gulp-uglify": "1.5.3", | ||
"jshint": "2.9.2", | ||
"karma": "0.13.22", | ||
"karma-chai": "0.1.0", | ||
"karma-chrome-launcher": "0.2.3", | ||
"karma-junit-reporter": "0.4.2", | ||
"karma-mocha": "0.2.2", | ||
"karma-phantomjs-launcher": "1.0.0", | ||
"mocha": "2.5.3", | ||
"phantomjs-prebuilt": "2.1.7", | ||
"run-sequence": "1.2.1" | ||
}, | ||
@@ -39,0 +40,0 @@ "scripts": { |
@@ -1,2 +0,2 @@ | ||
# jQuery Bar Rating Plugin [](https://travis-ci.org/antennaio/jquery-bar-rating) | ||
# jQuery Bar Rating Plugin [](https://travis-ci.org/antennaio/jquery-bar-rating) | ||
@@ -3,0 +3,0 @@ Minimal, light-weight jQuery ratings. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
278867
2994