diff --git a/CHANGE.md b/CHANGE.md index ac9242e..2da7481 100644 --- a/CHANGE.md +++ b/CHANGE.md @@ -1,6 +1,17 @@ Change Log: `bootstrap-star-rating` =================================== +## Version 4.0.4 + +**Date:** 15-Sep-2018 + +- Enhancements to support Bootstrap v4.x. +- Enhance styling of stars for all rating sizes and themes. +- (enh #187): Add Kazakh translations. +- (enh #182): New Krajee Font Awesome 5.x `fas` theme. +- (bug #177, enh #179): New property `showCaptionAsTitle` + - Useful for caption to be displayed as title for readonly ratings. + ## Version 4.0.3 **Date:** 03-Nov-2017 diff --git a/LICENSE.md b/LICENSE.md index ff6395d..401ac69 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,4 +1,4 @@ -Copyright (c) 2013 - 2017, Kartik Visweswaran +Copyright (c) 2013 - 2018, Kartik Visweswaran Krajee.com All rights reserved. diff --git a/README.md b/README.md index 765f079..0f167ac 100644 --- a/README.md +++ b/README.md @@ -145,4 +145,4 @@ Alternatively, you can directly call the plugin options by setting data attribut ## License -**bootstrap-star-rating** is released under the BSD 3-Clause License. See the bundled `LICENSE.md` for details. \ No newline at end of file +**bootstrap-star-rating** is released under the BSD-3-Clause License. See the bundled `LICENSE.md` for details. \ No newline at end of file diff --git a/bower.json b/bower.json index e01d201..06eb83f 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "bootstrap-star-rating", - "version": "4.0.3", + "version": "4.0.4", "homepage": "https://github.com/kartik-v/bootstrap-star-rating", "authors": [ "Kartik Visweswaran " diff --git a/css/star-rating.css b/css/star-rating.css index 95c1900..349fbac 100644 --- a/css/star-rating.css +++ b/css/star-rating.css @@ -1,9 +1,9 @@ /*! - * bootstrap-star-rating v4.0.3 + * bootstrap-star-rating v4.0.4 * http://plugins.krajee.com/star-rating * * Author: Kartik Visweswaran - * Copyright: 2013 - 2017, Kartik Visweswaran, Krajee.com + * Copyright: 2013 - 2018, Kartik Visweswaran, Krajee.com * * Licensed under the BSD 3-Clause * https://github.com/kartik-v/bootstrap-star-rating/blob/master/LICENSE.md @@ -43,13 +43,18 @@ margin: 0; } +.rating-container.is-display-only .rating-input, +.rating-container.is-display-only .rating-stars { + cursor: default; +} + .rating-disabled .rating-input, .rating-disabled .rating-stars { cursor: not-allowed; } .rating-container .star { display: inline-block; - margin: 0 3px; + margin: 0 2px; text-align: center; } @@ -75,18 +80,14 @@ .rating-animate .filled-stars { transition: width 0.25s ease; - -o-transition: width 0.25s ease; - -moz-transition: width 0.25s ease; - -webkit-transition: width 0.25s ease; } .rating-rtl .filled-stars { left: auto; right: 0; - -moz-transform: matrix(-1, 0, 0, 1, 0, 0) translate3d(0, 0, 0); - -webkit-transform: matrix(-1, 0, 0, 1, 0, 0) translate3d(0, 0, 0); - -o-transform: matrix(-1, 0, 0, 1, 0, 0) translate3d(0, 0, 0); - transform: matrix(-1, 0, 0, 1, 0, 0) translate3d(0, 0, 0); + transition: none; + -webkit-transform: matrix(-1, 0, 0, 1, 0, 0); + transform: matrix(-1, 0, 0, 1, 0, 0); } .rating-rtl.is-star .filled-stars { @@ -97,33 +98,6 @@ margin-right: 0.07em; } -/** - * Sizes - */ -.rating-xl { - font-size: 4.89em; -} - -.rating-lg { - font-size: 3.91em; -} - -.rating-md { - font-size: 3.13em; -} - -.rating-sm { - font-size: 2.5em; -} - -.rating-xs { - font-size: 2em; -} - -.rating-xl { - font-size: 4.89em; -} - /** * Clear */ @@ -165,8 +139,7 @@ color: #999; display: inline-block; vertical-align: middle; - font-size: 60%; - margin-top: -0.6em; + line-height: 1; } .rating-container .caption { @@ -186,4 +159,39 @@ .rating-container .clear-rating { display: none; } -} \ No newline at end of file +} + +/** + * Sizes + */ +.rating-xl { + font-size: 48px; +} +.rating-lg { + font-size: 40px; +} +.rating-md { + font-size: 32px; +} +.rating-sm { + font-size: 24px; +} +.rating-xs { + font-size: 16px; +} + +.rating-xl .caption { + font-size: 20px; +} +.rating-lg .caption { + font-size: 18px; +} +.rating-md .caption { + font-size: 16px; +} +.rating-sm .caption { + font-size: 14px; +} +.rating-xs .caption { + font-size: 12px; +} diff --git a/css/star-rating.min.css b/css/star-rating.min.css index e8f1c5b..7fe03bb 100644 --- a/css/star-rating.min.css +++ b/css/star-rating.min.css @@ -1,10 +1,10 @@ /*! - * bootstrap-star-rating v4.0.3 + * bootstrap-star-rating v4.0.4 * http://plugins.krajee.com/star-rating * * Author: Kartik Visweswaran - * Copyright: 2013 - 2017, Kartik Visweswaran, Krajee.com + * Copyright: 2013 - 2018, Kartik Visweswaran, Krajee.com * * Licensed under the BSD 3-Clause * https://github.com/kartik-v/bootstrap-star-rating/blob/master/LICENSE.md - */.rating-loading{width:25px;height:25px;font-size:0;color:#fff;background:url(../img/loading.gif) top left no-repeat;border:none}.rating-container .rating-stars{position:relative;cursor:pointer;vertical-align:middle;display:inline-block;overflow:hidden;white-space:nowrap}.rating-container .rating-input{position:absolute;cursor:pointer;width:100%;height:1px;bottom:0;left:0;font-size:1px;border:none;background:0 0;padding:0;margin:0}.rating-disabled .rating-input,.rating-disabled .rating-stars{cursor:not-allowed}.rating-container .star{display:inline-block;margin:0 3px;text-align:center}.rating-container .empty-stars{color:#aaa}.rating-container .filled-stars{position:absolute;left:0;top:0;margin:auto;color:#fde16d;white-space:nowrap;overflow:hidden;-webkit-text-stroke:1px #777;text-shadow:1px 1px #999}.rating-rtl{float:right}.rating-animate .filled-stars{transition:width .25s ease;-o-transition:width .25s ease;-moz-transition:width .25s ease;-webkit-transition:width .25s ease}.rating-rtl .filled-stars{left:auto;right:0;-moz-transform:matrix(-1,0,0,1,0,0) translate3d(0,0,0);-webkit-transform:matrix(-1,0,0,1,0,0) translate3d(0,0,0);-o-transform:matrix(-1,0,0,1,0,0) translate3d(0,0,0);transform:matrix(-1,0,0,1,0,0) translate3d(0,0,0)}.rating-rtl.is-star .filled-stars{right:.06em}.rating-rtl.is-heart .empty-stars{margin-right:.07em}.rating-lg{font-size:3.91em}.rating-md{font-size:3.13em}.rating-sm{font-size:2.5em}.rating-xs{font-size:2em}.rating-xl{font-size:4.89em}.rating-container .clear-rating{color:#aaa;cursor:not-allowed;display:inline-block;vertical-align:middle;font-size:60%;padding-right:5px}.clear-rating-active{cursor:pointer!important}.clear-rating-active:hover{color:#843534}.rating-container .caption .label{display:inline-block;padding:.25em .4em;line-height:1;text-align:center;vertical-align:baseline;border-radius:.25rem}.rating-container .caption{color:#999;display:inline-block;vertical-align:middle;font-size:60%;margin-top:-.6em;margin-left:5px;margin-right:0}.rating-rtl .caption{margin-right:5px;margin-left:0}@media print{.rating-container .clear-rating{display:none}} \ No newline at end of file + */.rating-loading{width:25px;height:25px;font-size:0;color:#fff;background:url(../img/loading.gif) top left no-repeat;border:none}.rating-container .rating-stars{position:relative;cursor:pointer;vertical-align:middle;display:inline-block;overflow:hidden;white-space:nowrap}.rating-container .rating-input{position:absolute;cursor:pointer;width:100%;height:1px;bottom:0;left:0;font-size:1px;border:none;background:0 0;padding:0;margin:0}.rating-container.is-display-only .rating-input,.rating-container.is-display-only .rating-stars{cursor:default}.rating-disabled .rating-input,.rating-disabled .rating-stars{cursor:not-allowed}.rating-container .star{display:inline-block;margin:0 2px;text-align:center}.rating-container .empty-stars{color:#aaa}.rating-container .filled-stars{position:absolute;left:0;top:0;margin:auto;color:#fde16d;white-space:nowrap;overflow:hidden;-webkit-text-stroke:1px #777;text-shadow:1px 1px #999}.rating-rtl{float:right}.rating-animate .filled-stars{transition:width .25s ease}.rating-rtl .filled-stars{left:auto;right:0;transition:none;-webkit-transform:matrix(-1,0,0,1,0,0);transform:matrix(-1,0,0,1,0,0)}.rating-rtl.is-star .filled-stars{right:.06em}.rating-rtl.is-heart .empty-stars{margin-right:.07em}.rating-container .clear-rating{color:#aaa;cursor:not-allowed;display:inline-block;vertical-align:middle;font-size:60%;padding-right:5px}.clear-rating-active{cursor:pointer!important}.clear-rating-active:hover{color:#843534}.rating-container .caption .label{display:inline-block;padding:.25em .4em;line-height:1;text-align:center;vertical-align:baseline;border-radius:.25rem}.rating-container .caption{color:#999;display:inline-block;vertical-align:middle;line-height:1;margin-left:5px;margin-right:0}.rating-rtl .caption{margin-right:5px;margin-left:0}@media print{.rating-container .clear-rating{display:none}}.rating-xl{font-size:48px}.rating-lg{font-size:40px}.rating-md{font-size:32px}.rating-sm{font-size:24px}.rating-xs{font-size:16px}.rating-xl .caption{font-size:20px}.rating-lg .caption{font-size:18px}.rating-md .caption{font-size:16px}.rating-sm .caption{font-size:14px}.rating-xs .caption{font-size:12px} \ No newline at end of file diff --git a/js/star-rating.js b/js/star-rating.js index a927ddb..018d254 100644 --- a/js/star-rating.js +++ b/js/star-rating.js @@ -1,9 +1,9 @@ /*! - * bootstrap-star-rating v4.0.3 + * bootstrap-star-rating v4.0.4 * http://plugins.krajee.com/star-rating * * Author: Kartik Visweswaran - * Copyright: 2013 - 2017, Kartik Visweswaran, Krajee.com + * Copyright: 2013 - 2018, Kartik Visweswaran, Krajee.com * * Licensed under the BSD 3-Clause * https://github.com/kartik-v/bootstrap-star-rating/blob/master/LICENSE.md @@ -139,7 +139,9 @@ $h.getCss(self.size, 'rating-' + self.size) + $h.getCss(self.animate, 'rating-animate') + $h.getCss(self.disabled || self.readonly, 'rating-disabled') + - $h.getCss(self.containerClass, self.containerClass); + $h.getCss(self.containerClass, self.containerClass) + + (self.displayOnly ? ' is-display-only' : ''); + }, _checkDisabled: function () { var self = this, $el = self.$element, opts = self.options; @@ -167,6 +169,7 @@ self._renderCaption(); self._renderClear(); self._initHighlight(); + self._initCaptionTitle(); $container.append($el); if (self.rtl) { w = Math.max(self.$emptyStars.outerWidth(), self.$filledStars.outerWidth()); @@ -262,6 +265,18 @@ $el.val(v); return $el.removeClass('rating-loading'); }, + _initCaptionTitle: function() { + var self = this, caption; + if (self.showCaptionAsTitle) { + caption = self.fetchCaption(self.$element.val()); + self.$rating.attr('title', $(caption).text()); + } + }, + _trigChange: function(params) { + var self = this; + self._initCaptionTitle(); + self.$element.trigger('change').trigger('rating:change', params); + }, _initEvents: function () { var self = this; self.events = { @@ -297,7 +312,7 @@ if (e.type === "touchend") { self._setStars(pos); params = [self.$element.val(), self._getCaption()]; - self.$element.trigger('change').trigger('rating:change', params); + self._trigChange(params); self.starClicked = true; } else { out = self.calculate(pos); @@ -317,7 +332,7 @@ pos = self.events._getTouchPosition(ev); self._setStars(pos); params = [self.$element.val(), self._getCaption()]; - self.$element.trigger('change').trigger('rating:change', params); + self._trigChange(params); self.starClicked = true; }); }, @@ -417,6 +432,7 @@ showStars: function (val) { var self = this, v = self._parseValue(val); self.$element.val(v); + self._initCaptionTitle(); return self._setStars(); }, calculate: function (pos) { @@ -454,6 +470,7 @@ } cssVal = typeof vCss === "function" ? vCss(val) : vCss[val]; capVal = typeof vCap === "function" ? vCap(val) : vCap[val]; + // noinspection RegExpRedundantEscape cap = $h.isEmpty(capVal) ? self.defaultCaption.replace(/\{rating}/g, val) : capVal; css = $h.isEmpty(cssVal) ? self.clearCaptionClass : cssVal; caption = (val === self.clearValue) ? self.clearCaption : cap; @@ -556,10 +573,11 @@ clearButton: '', clearButtonBaseClass: 'clear-rating', clearButtonActiveClass: 'clear-rating-active', - clearCaptionClass: 'label label-default', + clearCaptionClass: 'label label-default badge-secondary', clearValue: null, captionElement: null, clearElement: null, + showCaptionAsTitle: true, hoverEnabled: true, hoverChangeCaption: true, hoverChangeStars: true, diff --git a/js/star-rating.min.js b/js/star-rating.min.js index a853597..0a49f54 100644 --- a/js/star-rating.min.js +++ b/js/star-rating.min.js @@ -1,10 +1,11 @@ /*! - * bootstrap-star-rating v4.0.3 + * bootstrap-star-rating v4.0.4 * http://plugins.krajee.com/star-rating * * Author: Kartik Visweswaran - * Copyright: 2013 - 2017, Kartik Visweswaran, Krajee.com + * Copyright: 2013 - 2018, Kartik Visweswaran, Krajee.com * * Licensed under the BSD 3-Clause * https://github.com/kartik-v/bootstrap-star-rating/blob/master/LICENSE.md - */!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof module&&module.exports?module.exports=e(require("jquery")):e(window.jQuery)}(function(e){"use strict";e.fn.ratingLocales={},e.fn.ratingThemes={};var t,a;t={NAMESPACE:".rating",DEFAULT_MIN:0,DEFAULT_MAX:5,DEFAULT_STEP:.5,isEmpty:function(t,a){return null===t||void 0===t||0===t.length||a&&""===e.trim(t)},getCss:function(e,t){return e?" "+t:""},addCss:function(e,t){e.removeClass(t).addClass(t)},getDecimalPlaces:function(e){var t=(""+e).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return t?Math.max(0,(t[1]?t[1].length:0)-(t[2]?+t[2]:0)):0},applyPrecision:function(e,t){return parseFloat(e.toFixed(t))},handler:function(e,a,n,r,i){var l=i?a:a.split(" ").join(t.NAMESPACE+" ")+t.NAMESPACE;r||e.off(l),e.on(l,n)}},a=function(t,a){var n=this;n.$element=e(t),n._init(a)},a.prototype={constructor:a,_parseAttr:function(e,a){var n,r,i,l,s=this,o=s.$element,c=o.attr("type");if("range"===c||"number"===c){switch(r=a[e]||o.data(e)||o.attr(e),e){case"min":i=t.DEFAULT_MIN;break;case"max":i=t.DEFAULT_MAX;break;default:i=t.DEFAULT_STEP}n=t.isEmpty(r)?i:r,l=parseFloat(n)}else l=parseFloat(a[e]);return isNaN(l)?i:l},_parseValue:function(e){var t=this,a=parseFloat(e);return isNaN(a)&&(a=t.clearValue),!t.zeroAsNull||0!==a&&"0"!==a?a:null},_setDefault:function(e,a){var n=this;t.isEmpty(n[e])&&(n[e]=a)},_initSlider:function(e){var a=this,n=a.$element.val();a.initialValue=t.isEmpty(n)?0:n,a._setDefault("min",a._parseAttr("min",e)),a._setDefault("max",a._parseAttr("max",e)),a._setDefault("step",a._parseAttr("step",e)),(isNaN(a.min)||t.isEmpty(a.min))&&(a.min=t.DEFAULT_MIN),(isNaN(a.max)||t.isEmpty(a.max))&&(a.max=t.DEFAULT_MAX),(isNaN(a.step)||t.isEmpty(a.step)||0===a.step)&&(a.step=t.DEFAULT_STEP),a.diff=a.max-a.min},_initHighlight:function(e){var t,a=this,n=a._getCaption();e||(e=a.$element.val()),t=a.getWidthFromValue(e)+"%",a.$filledStars.width(t),a.cache={caption:n,width:t,val:e}},_getContainerCss:function(){var e=this;return"rating-container"+t.getCss(e.theme,"theme-"+e.theme)+t.getCss(e.rtl,"rating-rtl")+t.getCss(e.size,"rating-"+e.size)+t.getCss(e.animate,"rating-animate")+t.getCss(e.disabled||e.readonly,"rating-disabled")+t.getCss(e.containerClass,e.containerClass)},_checkDisabled:function(){var e=this,t=e.$element,a=e.options;e.disabled=void 0===a.disabled?t.attr("disabled")||!1:a.disabled,e.readonly=void 0===a.readonly?t.attr("readonly")||!1:a.readonly,e.inactive=e.disabled||e.readonly,t.attr({disabled:e.disabled,readonly:e.readonly})},_addContent:function(e,t){var a=this,n=a.$container,r="clear"===e;return a.rtl?r?n.append(t):n.prepend(t):r?n.prepend(t):n.append(t)},_generateRating:function(){var a,n,r,i=this,l=i.$element;n=i.$container=e(document.createElement("div")).insertBefore(l),t.addCss(n,i._getContainerCss()),i.$rating=a=e(document.createElement("div")).attr("class","rating-stars").appendTo(n).append(i._getStars("empty")).append(i._getStars("filled")),i.$emptyStars=a.find(".empty-stars"),i.$filledStars=a.find(".filled-stars"),i._renderCaption(),i._renderClear(),i._initHighlight(),n.append(l),i.rtl&&(r=Math.max(i.$emptyStars.outerWidth(),i.$filledStars.outerWidth()),i.$emptyStars.width(r)),l.appendTo(a)},_getCaption:function(){var e=this;return e.$caption&&e.$caption.length?e.$caption.html():e.defaultCaption},_setCaption:function(e){var t=this;t.$caption&&t.$caption.length&&t.$caption.html(e)},_renderCaption:function(){var a,n=this,r=n.$element.val(),i=n.captionElement?e(n.captionElement):"";if(n.showCaption){if(a=n.fetchCaption(r),i&&i.length)return t.addCss(i,"caption"),i.html(a),void(n.$caption=i);n._addContent("caption",'
'+a+"
"),n.$caption=n.$container.find(".caption")}},_renderClear:function(){var a,n=this,r=n.clearElement?e(n.clearElement):"";if(n.showClear){if(a=n._getClearClass(),r.length)return t.addCss(r,a),r.attr({title:n.clearButtonTitle}).html(n.clearButton),void(n.$clear=r);n._addContent("clear",'
'+n.clearButton+"
"),n.$clear=n.$container.find("."+n.clearButtonBaseClass)}},_getClearClass:function(){var e=this;return e.clearButtonBaseClass+" "+(e.inactive?"":e.clearButtonActiveClass)},_toggleHover:function(e){var t,a,n,r=this;e&&(r.hoverChangeStars&&(t=r.getWidthFromValue(r.clearValue),a=e.val<=r.clearValue?t+"%":e.width,r.$filledStars.css("width",a)),r.hoverChangeCaption&&(n=e.val<=r.clearValue?r.fetchCaption(r.clearValue):e.caption,n&&r._setCaption(n+"")))},_init:function(t){var a,n=this,r=n.$element.addClass("rating-input");return n.options=t,e.each(t,function(e,t){n[e]=t}),(n.rtl||"rtl"===r.attr("dir"))&&(n.rtl=!0,r.attr("dir","rtl")),n.starClicked=!1,n.clearClicked=!1,n._initSlider(t),n._checkDisabled(),n.displayOnly&&(n.inactive=!0,n.showClear=!1,n.showCaption=!1),n._generateRating(),n._initEvents(),n._listen(),a=n._parseValue(r.val()),r.val(a),r.removeClass("rating-loading")},_initEvents:function(){var e=this;e.events={_getTouchPosition:function(a){var n=t.isEmpty(a.pageX)?a.originalEvent.touches[0].pageX:a.pageX;return n-e.$rating.offset().left},_listenClick:function(e,t){return e.stopPropagation(),e.preventDefault(),e.handled===!0?!1:(t(e),void(e.handled=!0))},_noMouseAction:function(t){return!e.hoverEnabled||e.inactive||t&&t.isDefaultPrevented()},initTouch:function(a){var n,r,i,l,s,o,c,u,d=e.clearValue||0,p="ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch;p&&!e.inactive&&(n=a.originalEvent,r=t.isEmpty(n.touches)?n.changedTouches:n.touches,i=e.events._getTouchPosition(r[0]),"touchend"===a.type?(e._setStars(i),u=[e.$element.val(),e._getCaption()],e.$element.trigger("change").trigger("rating:change",u),e.starClicked=!0):(l=e.calculate(i),s=l.val<=d?e.fetchCaption(d):l.caption,o=e.getWidthFromValue(d),c=l.val<=d?o+"%":l.width,e._setCaption(s),e.$filledStars.css("width",c)))},starClick:function(t){var a,n;e.events._listenClick(t,function(t){return e.inactive?!1:(a=e.events._getTouchPosition(t),e._setStars(a),n=[e.$element.val(),e._getCaption()],e.$element.trigger("change").trigger("rating:change",n),void(e.starClicked=!0))})},clearClick:function(t){e.events._listenClick(t,function(){e.inactive||(e.clear(),e.clearClicked=!0)})},starMouseMove:function(t){var a,n;e.events._noMouseAction(t)||(e.starClicked=!1,a=e.events._getTouchPosition(t),n=e.calculate(a),e._toggleHover(n),e.$element.trigger("rating:hover",[n.val,n.caption,"stars"]))},starMouseLeave:function(t){var a;e.events._noMouseAction(t)||e.starClicked||(a=e.cache,e._toggleHover(a),e.$element.trigger("rating:hoverleave",["stars"]))},clearMouseMove:function(t){var a,n,r,i;!e.events._noMouseAction(t)&&e.hoverOnClear&&(e.clearClicked=!1,a=''+e.clearCaption+"",n=e.clearValue,r=e.getWidthFromValue(n)||0,i={caption:a,width:r,val:n},e._toggleHover(i),e.$element.trigger("rating:hover",[n,a,"clear"]))},clearMouseLeave:function(t){var a;e.events._noMouseAction(t)||e.clearClicked||!e.hoverOnClear||(a=e.cache,e._toggleHover(a),e.$element.trigger("rating:hoverleave",["clear"]))},resetForm:function(t){t&&t.isDefaultPrevented()||e.inactive||e.reset()}}},_listen:function(){var a=this,n=a.$element,r=n.closest("form"),i=a.$rating,l=a.$clear,s=a.events;return t.handler(i,"touchstart touchmove touchend",e.proxy(s.initTouch,a)),t.handler(i,"click touchstart",e.proxy(s.starClick,a)),t.handler(i,"mousemove",e.proxy(s.starMouseMove,a)),t.handler(i,"mouseleave",e.proxy(s.starMouseLeave,a)),a.showClear&&l.length&&(t.handler(l,"click touchstart",e.proxy(s.clearClick,a)),t.handler(l,"mousemove",e.proxy(s.clearMouseMove,a)),t.handler(l,"mouseleave",e.proxy(s.clearMouseLeave,a))),r.length&&t.handler(r,"reset",e.proxy(s.resetForm,a),!0),n},_getStars:function(e){var t,a=this,n='';for(t=1;t<=a.stars;t++)n+=''+a[e+"Star"]+"";return n+""},_setStars:function(e){var t=this,a=arguments.length?t.calculate(e):t.calculate(),n=t.$element,r=t._parseValue(a.val);return n.val(r),t.$filledStars.css("width",a.width),t._setCaption(a.caption),t.cache=a,n},showStars:function(e){var t=this,a=t._parseValue(e);return t.$element.val(a),t._setStars()},calculate:function(e){var a=this,n=t.isEmpty(a.$element.val())?0:a.$element.val(),r=arguments.length?a.getValueFromPosition(e):n,i=a.fetchCaption(r),l=a.getWidthFromValue(r);return l+="%",{caption:i,width:l,val:r}},getValueFromPosition:function(e){var a,n,r=this,i=t.getDecimalPlaces(r.step),l=r.$rating.width();return n=r.diff*e/(l*r.step),n=r.rtl?Math.floor(n):Math.ceil(n),a=t.applyPrecision(parseFloat(r.min+n*r.step),i),a=Math.max(Math.min(a,r.max),r.min),r.rtl?r.max-a:a},getWidthFromValue:function(e){var t,a,n=this,r=n.min,i=n.max,l=n.$emptyStars;return!e||r>=e||r===i?0:(a=l.outerWidth(),t=a?l.width()/a:1,e>=i?100:(e-r)*t*100/(i-r))},fetchCaption:function(e){var a,n,r,i,l,s=this,o=parseFloat(e)||s.clearValue,c=s.starCaptions,u=s.starCaptionClasses;return o&&o!==s.clearValue&&(o=t.applyPrecision(o,t.getDecimalPlaces(s.step))),i="function"==typeof u?u(o):u[o],r="function"==typeof c?c(o):c[o],n=t.isEmpty(r)?s.defaultCaption.replace(/\{rating}/g,o):r,a=t.isEmpty(i)?s.clearCaptionClass:i,l=o===s.clearValue?s.clearCaption:n,''+l+""},destroy:function(){var a=this,n=a.$element;return t.isEmpty(a.$container)||a.$container.before(n).remove(),e.removeData(n.get(0)),n.off("rating").removeClass("rating rating-input")},create:function(e){var t=this,a=e||t.options||{};return t.destroy().rating(a)},clear:function(){var e=this,t=''+e.clearCaption+"";return e.inactive||e._setCaption(t),e.showStars(e.clearValue).trigger("change").trigger("rating:clear")},reset:function(){var e=this;return e.showStars(e.initialValue).trigger("rating:reset")},update:function(e){var t=this;return arguments.length?t.showStars(e):t.$element},refresh:function(t){var a=this,n=a.$element;return t?a.destroy().rating(e.extend(!0,a.options,t)).trigger("rating:refresh"):n}},e.fn.rating=function(n){var r=Array.apply(null,arguments),i=[];switch(r.shift(),this.each(function(){var l,s=e(this),o=s.data("rating"),c="object"==typeof n&&n,u=c.theme||s.data("theme"),d=c.language||s.data("language")||"en",p={},g={};o||(u&&(p=e.fn.ratingThemes[u]||{}),"en"===d||t.isEmpty(e.fn.ratingLocales[d])||(g=e.fn.ratingLocales[d]),l=e.extend(!0,{},e.fn.rating.defaults,p,e.fn.ratingLocales.en,g,c,s.data()),o=new a(this,l),s.data("rating",o)),"string"==typeof n&&i.push(o[n].apply(o,r))}),i.length){case 0:return this;case 1:return void 0===i[0]?this:i[0];default:return i}},e.fn.rating.defaults={theme:"",language:"en",stars:5,filledStar:'',emptyStar:'',containerClass:"",size:"md",animate:!0,displayOnly:!1,rtl:!1,showClear:!0,showCaption:!0,starCaptionClasses:{.5:"label label-danger badge-danger",1:"label label-danger badge-danger",1.5:"label label-warning badge-warning",2:"label label-warning badge-warning",2.5:"label label-info badge-info",3:"label label-info badge-info",3.5:"label label-primary badge-primary",4:"label label-primary badge-primary",4.5:"label label-success badge-success",5:"label label-success badge-success"},clearButton:'',clearButtonBaseClass:"clear-rating",clearButtonActiveClass:"clear-rating-active",clearCaptionClass:"label label-default",clearValue:null,captionElement:null,clearElement:null,hoverEnabled:!0,hoverChangeCaption:!0,hoverChangeStars:!0,hoverOnClear:!0,zeroAsNull:!0},e.fn.ratingLocales.en={defaultCaption:"{rating} Stars",starCaptions:{.5:"Half Star",1:"One Star",1.5:"One & Half Star",2:"Two Stars",2.5:"Two & Half Stars",3:"Three Stars",3.5:"Three & Half Stars",4:"Four Stars",4.5:"Four & Half Stars",5:"Five Stars"},clearButtonTitle:"Clear",clearCaption:"Not Rated"},e.fn.rating.Constructor=a,e(document).ready(function(){var t=e("input.rating");t.length&&t.removeClass("rating-loading").addClass("rating-loading").rating()})}); \ No newline at end of file + */ +!function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=t(require("jquery")):t(window.jQuery)}(function(t){"use strict";var e,i;t.fn.ratingLocales={},t.fn.ratingThemes={},e={NAMESPACE:".rating",DEFAULT_MIN:0,DEFAULT_MAX:5,DEFAULT_STEP:.5,isEmpty:function(e,i){return null==e||0===e.length||i&&""===t.trim(e)},getCss:function(t,e){return t?" "+e:""},addCss:function(t,e){t.removeClass(e).addClass(e)},getDecimalPlaces:function(t){var e=(""+t).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return e?Math.max(0,(e[1]?e[1].length:0)-(e[2]?+e[2]:0)):0},applyPrecision:function(t,e){return parseFloat(t.toFixed(e))},handler:function(t,i,a,n,s){var r=s?i:i.split(" ").join(e.NAMESPACE+" ")+e.NAMESPACE;n||t.off(r),t.on(r,a)}},(i=function(e,i){this.$element=t(e),this._init(i)}).prototype={constructor:i,_parseAttr:function(t,i){var a,n,s,r,l=this.$element,o=l.attr("type");if("range"===o||"number"===o){switch(n=i[t]||l.data(t)||l.attr(t),t){case"min":s=e.DEFAULT_MIN;break;case"max":s=e.DEFAULT_MAX;break;default:s=e.DEFAULT_STEP}a=e.isEmpty(n)?s:n,r=parseFloat(a)}else r=parseFloat(i[t]);return isNaN(r)?s:r},_parseValue:function(t){var e=parseFloat(t);return isNaN(e)&&(e=this.clearValue),!this.zeroAsNull||0!==e&&"0"!==e?e:null},_setDefault:function(t,i){e.isEmpty(this[t])&&(this[t]=i)},_initSlider:function(t){var i=this.$element.val();this.initialValue=e.isEmpty(i)?0:i,this._setDefault("min",this._parseAttr("min",t)),this._setDefault("max",this._parseAttr("max",t)),this._setDefault("step",this._parseAttr("step",t)),(isNaN(this.min)||e.isEmpty(this.min))&&(this.min=e.DEFAULT_MIN),(isNaN(this.max)||e.isEmpty(this.max))&&(this.max=e.DEFAULT_MAX),(isNaN(this.step)||e.isEmpty(this.step)||0===this.step)&&(this.step=e.DEFAULT_STEP),this.diff=this.max-this.min},_initHighlight:function(t){var e,i=this._getCaption();t||(t=this.$element.val()),e=this.getWidthFromValue(t)+"%",this.$filledStars.width(e),this.cache={caption:i,width:e,val:t}},_getContainerCss:function(){return"rating-container"+e.getCss(this.theme,"theme-"+this.theme)+e.getCss(this.rtl,"rating-rtl")+e.getCss(this.size,"rating-"+this.size)+e.getCss(this.animate,"rating-animate")+e.getCss(this.disabled||this.readonly,"rating-disabled")+e.getCss(this.containerClass,this.containerClass)+(this.displayOnly?" is-display-only":"")},_checkDisabled:function(){var t=this.$element,e=this.options;this.disabled=void 0===e.disabled?t.attr("disabled")||!1:e.disabled,this.readonly=void 0===e.readonly?t.attr("readonly")||!1:e.readonly,this.inactive=this.disabled||this.readonly,t.attr({disabled:this.disabled,readonly:this.readonly})},_addContent:function(t,e){var i=this.$container,a="clear"===t;return this.rtl?a?i.append(e):i.prepend(e):a?i.prepend(e):i.append(e)},_generateRating:function(){var i,a,n,s=this.$element;a=this.$container=t(document.createElement("div")).insertBefore(s),e.addCss(a,this._getContainerCss()),this.$rating=i=t(document.createElement("div")).attr("class","rating-stars").appendTo(a).append(this._getStars("empty")).append(this._getStars("filled")),this.$emptyStars=i.find(".empty-stars"),this.$filledStars=i.find(".filled-stars"),this._renderCaption(),this._renderClear(),this._initHighlight(),this._initCaptionTitle(),a.append(s),this.rtl&&(n=Math.max(this.$emptyStars.outerWidth(),this.$filledStars.outerWidth()),this.$emptyStars.width(n)),s.appendTo(i)},_getCaption:function(){return this.$caption&&this.$caption.length?this.$caption.html():this.defaultCaption},_setCaption:function(t){this.$caption&&this.$caption.length&&this.$caption.html(t)},_renderCaption:function(){var i,a=this.$element.val(),n=this.captionElement?t(this.captionElement):"";if(this.showCaption){if(i=this.fetchCaption(a),n&&n.length)return e.addCss(n,"caption"),n.html(i),void(this.$caption=n);this._addContent("caption",'
'+i+"
"),this.$caption=this.$container.find(".caption")}},_renderClear:function(){var i,a=this.clearElement?t(this.clearElement):"";if(this.showClear){if(i=this._getClearClass(),a.length)return e.addCss(a,i),a.attr({title:this.clearButtonTitle}).html(this.clearButton),void(this.$clear=a);this._addContent("clear",'
'+this.clearButton+"
"),this.$clear=this.$container.find("."+this.clearButtonBaseClass)}},_getClearClass:function(){return this.clearButtonBaseClass+" "+(this.inactive?"":this.clearButtonActiveClass)},_toggleHover:function(t){var e,i,a;t&&(this.hoverChangeStars&&(e=this.getWidthFromValue(this.clearValue),i=t.val<=this.clearValue?e+"%":t.width,this.$filledStars.css("width",i)),this.hoverChangeCaption&&(a=t.val<=this.clearValue?this.fetchCaption(this.clearValue):t.caption)&&this._setCaption(a+""))},_init:function(e){var i,a=this,n=a.$element.addClass("rating-input");return a.options=e,t.each(e,function(t,e){a[t]=e}),(a.rtl||"rtl"===n.attr("dir"))&&(a.rtl=!0,n.attr("dir","rtl")),a.starClicked=!1,a.clearClicked=!1,a._initSlider(e),a._checkDisabled(),a.displayOnly&&(a.inactive=!0,a.showClear=!1,a.showCaption=!1),a._generateRating(),a._initEvents(),a._listen(),i=a._parseValue(n.val()),n.val(i),n.removeClass("rating-loading")},_initCaptionTitle:function(){var e;this.showCaptionAsTitle&&(e=this.fetchCaption(this.$element.val()),this.$rating.attr("title",t(e).text()))},_trigChange:function(t){this._initCaptionTitle(),this.$element.trigger("change").trigger("rating:change",t)},_initEvents:function(){var t=this;t.events={_getTouchPosition:function(i){return(e.isEmpty(i.pageX)?i.originalEvent.touches[0].pageX:i.pageX)-t.$rating.offset().left},_listenClick:function(t,e){if(t.stopPropagation(),t.preventDefault(),!0===t.handled)return!1;e(t),t.handled=!0},_noMouseAction:function(e){return!t.hoverEnabled||t.inactive||e&&e.isDefaultPrevented()},initTouch:function(i){var a,n,s,r,l,o,h,c,u=t.clearValue||0;("ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch)&&!t.inactive&&(a=i.originalEvent,n=e.isEmpty(a.touches)?a.changedTouches:a.touches,s=t.events._getTouchPosition(n[0]),"touchend"===i.type?(t._setStars(s),c=[t.$element.val(),t._getCaption()],t._trigChange(c),t.starClicked=!0):(l=(r=t.calculate(s)).val<=u?t.fetchCaption(u):r.caption,o=t.getWidthFromValue(u),h=r.val<=u?o+"%":r.width,t._setCaption(l),t.$filledStars.css("width",h)))},starClick:function(e){var i,a;t.events._listenClick(e,function(e){if(t.inactive)return!1;i=t.events._getTouchPosition(e),t._setStars(i),a=[t.$element.val(),t._getCaption()],t._trigChange(a),t.starClicked=!0})},clearClick:function(e){t.events._listenClick(e,function(){t.inactive||(t.clear(),t.clearClicked=!0)})},starMouseMove:function(e){var i,a;t.events._noMouseAction(e)||(t.starClicked=!1,i=t.events._getTouchPosition(e),a=t.calculate(i),t._toggleHover(a),t.$element.trigger("rating:hover",[a.val,a.caption,"stars"]))},starMouseLeave:function(e){var i;t.events._noMouseAction(e)||t.starClicked||(i=t.cache,t._toggleHover(i),t.$element.trigger("rating:hoverleave",["stars"]))},clearMouseMove:function(e){var i,a,n;!t.events._noMouseAction(e)&&t.hoverOnClear&&(t.clearClicked=!1,i=''+t.clearCaption+"",a=t.clearValue,n={caption:i,width:t.getWidthFromValue(a)||0,val:a},t._toggleHover(n),t.$element.trigger("rating:hover",[a,i,"clear"]))},clearMouseLeave:function(e){var i;t.events._noMouseAction(e)||t.clearClicked||!t.hoverOnClear||(i=t.cache,t._toggleHover(i),t.$element.trigger("rating:hoverleave",["clear"]))},resetForm:function(e){e&&e.isDefaultPrevented()||t.inactive||t.reset()}}},_listen:function(){var i=this.$element,a=i.closest("form"),n=this.$rating,s=this.$clear,r=this.events;return e.handler(n,"touchstart touchmove touchend",t.proxy(r.initTouch,this)),e.handler(n,"click touchstart",t.proxy(r.starClick,this)),e.handler(n,"mousemove",t.proxy(r.starMouseMove,this)),e.handler(n,"mouseleave",t.proxy(r.starMouseLeave,this)),this.showClear&&s.length&&(e.handler(s,"click touchstart",t.proxy(r.clearClick,this)),e.handler(s,"mousemove",t.proxy(r.clearMouseMove,this)),e.handler(s,"mouseleave",t.proxy(r.clearMouseLeave,this))),a.length&&e.handler(a,"reset",t.proxy(r.resetForm,this),!0),i},_getStars:function(t){var e,i='';for(e=1;e<=this.stars;e++)i+=''+this[t+"Star"]+"";return i+""},_setStars:function(t){var e=arguments.length?this.calculate(t):this.calculate(),i=this.$element,a=this._parseValue(e.val);return i.val(a),this.$filledStars.css("width",e.width),this._setCaption(e.caption),this.cache=e,i},showStars:function(t){var e=this._parseValue(t);return this.$element.val(e),this._initCaptionTitle(),this._setStars()},calculate:function(t){var i=e.isEmpty(this.$element.val())?0:this.$element.val(),a=arguments.length?this.getValueFromPosition(t):i,n=this.fetchCaption(a),s=this.getWidthFromValue(a);return{caption:n,width:s+="%",val:a}},getValueFromPosition:function(t){var i,a,n=e.getDecimalPlaces(this.step),s=this.$rating.width();return a=this.diff*t/(s*this.step),a=this.rtl?Math.floor(a):Math.ceil(a),i=e.applyPrecision(parseFloat(this.min+a*this.step),n),i=Math.max(Math.min(i,this.max),this.min),this.rtl?this.max-i:i},getWidthFromValue:function(t){var e,i,a=this.min,n=this.max,s=this.$emptyStars;return!t||t<=a||a===n?0:(e=(i=s.outerWidth())?s.width()/i:1,t>=n?100:(t-a)*e*100/(n-a))},fetchCaption:function(t){var i,a,n,s=parseFloat(t)||this.clearValue,r=this.starCaptions,l=this.starCaptionClasses;return s&&s!==this.clearValue&&(s=e.applyPrecision(s,e.getDecimalPlaces(this.step))),n="function"==typeof l?l(s):l[s],a="function"==typeof r?r(s):r[s],i=e.isEmpty(a)?this.defaultCaption.replace(/\{rating}/g,s):a,''+(s===this.clearValue?this.clearCaption:i)+""},destroy:function(){var i=this.$element;return e.isEmpty(this.$container)||this.$container.before(i).remove(),t.removeData(i.get(0)),i.off("rating").removeClass("rating rating-input")},create:function(t){var e=t||this.options||{};return this.destroy().rating(e)},clear:function(){var t=''+this.clearCaption+"";return this.inactive||this._setCaption(t),this.showStars(this.clearValue).trigger("change").trigger("rating:clear")},reset:function(){return this.showStars(this.initialValue).trigger("rating:reset")},update:function(t){return arguments.length?this.showStars(t):this.$element},refresh:function(e){var i=this.$element;return e?this.destroy().rating(t.extend(!0,this.options,e)).trigger("rating:refresh"):i}},t.fn.rating=function(a){var n=Array.apply(null,arguments),s=[];switch(n.shift(),this.each(function(){var r,l=t(this),o=l.data("rating"),h="object"==typeof a&&a,c=h.theme||l.data("theme"),u=h.language||l.data("language")||"en",d={},p={};o||(c&&(d=t.fn.ratingThemes[c]||{}),"en"===u||e.isEmpty(t.fn.ratingLocales[u])||(p=t.fn.ratingLocales[u]),r=t.extend(!0,{},t.fn.rating.defaults,d,t.fn.ratingLocales.en,p,h,l.data()),o=new i(this,r),l.data("rating",o)),"string"==typeof a&&s.push(o[a].apply(o,n))}),s.length){case 0:return this;case 1:return void 0===s[0]?this:s[0];default:return s}},t.fn.rating.defaults={theme:"",language:"en",stars:5,filledStar:'',emptyStar:'',containerClass:"",size:"md",animate:!0,displayOnly:!1,rtl:!1,showClear:!0,showCaption:!0,starCaptionClasses:{.5:"label label-danger badge-danger",1:"label label-danger badge-danger",1.5:"label label-warning badge-warning",2:"label label-warning badge-warning",2.5:"label label-info badge-info",3:"label label-info badge-info",3.5:"label label-primary badge-primary",4:"label label-primary badge-primary",4.5:"label label-success badge-success",5:"label label-success badge-success"},clearButton:'',clearButtonBaseClass:"clear-rating",clearButtonActiveClass:"clear-rating-active",clearCaptionClass:"label label-default badge-secondary",clearValue:null,captionElement:null,clearElement:null,showCaptionAsTitle:!0,hoverEnabled:!0,hoverChangeCaption:!0,hoverChangeStars:!0,hoverOnClear:!0,zeroAsNull:!0},t.fn.ratingLocales.en={defaultCaption:"{rating} Stars",starCaptions:{.5:"Half Star",1:"One Star",1.5:"One & Half Star",2:"Two Stars",2.5:"Two & Half Stars",3:"Three Stars",3.5:"Three & Half Stars",4:"Four Stars",4.5:"Four & Half Stars",5:"Five Stars"},clearButtonTitle:"Clear",clearCaption:"Not Rated"},t.fn.rating.Constructor=i,t(document).ready(function(){var e=t("input.rating");e.length&&e.removeClass("rating-loading").addClass("rating-loading").rating()})}); \ No newline at end of file diff --git a/package.json b/package.json index 786ca1b..1a6eb91 100644 --- a/package.json +++ b/package.json @@ -1,14 +1,14 @@ { "name": "bootstrap-star-rating", - "version": "4.0.3", + "version": "4.0.4", "homepage": "https://github.com/kartik-v/bootstrap-star-rating", "author": "Kartik Visweswaran ", "description": "A simple yet powerful JQuery star rating plugin for Bootstrap.", "bugs": { "url": "https://github.com/kartik-v/bootstrap-star-rating/issues" }, - "repository" : { - "type": "git", + "repository": { + "type": "git", "url": "https://github.com/kartik-v/bootstrap-star-rating.git" }, "main": "js/star-rating.min.js", diff --git a/themes/krajee-fa/theme.css b/themes/krajee-fa/theme.css index 8a862d9..011b541 100644 --- a/themes/krajee-fa/theme.css +++ b/themes/krajee-fa/theme.css @@ -7,8 +7,4 @@ */ .theme-krajee-fa .star { font-size: 1.1em; -} - -.theme-krajee-fa .caption { - margin-top: -0.2em; } \ No newline at end of file diff --git a/themes/krajee-fa/theme.min.css b/themes/krajee-fa/theme.min.css index 46cb746..7bffa5e 100644 --- a/themes/krajee-fa/theme.min.css +++ b/themes/krajee-fa/theme.min.css @@ -4,4 +4,4 @@ * * @see http://github.com/kartik-v/bootstrap-star-rating * @author Kartik Visweswaran - */.theme-krajee-fa .star{font-size:1.1em}.theme-krajee-fa .caption{margin-top:-.2em} \ No newline at end of file + */.theme-krajee-fa .star{font-size:1.1em} \ No newline at end of file diff --git a/themes/krajee-fas/theme.css b/themes/krajee-fas/theme.css new file mode 100644 index 0000000..af07dc4 --- /dev/null +++ b/themes/krajee-fas/theme.css @@ -0,0 +1,14 @@ +/*! + * Krajee Font Awesome Theme styling for bootstrap-star-rating. + * This file must be loaded after 'star-rating.css'. + * + * @see http://github.com/kartik-v/bootstrap-star-rating + * @author Kartik Visweswaran + */ +.theme-krajee-fas .clear-rating { + margin: 0 1px 0 0; +} + +.theme-krajee-fas.rating-rtl.is-star .empty-stars { + margin-right: 2px; +} \ No newline at end of file diff --git a/themes/krajee-fas/theme.js b/themes/krajee-fas/theme.js new file mode 100644 index 0000000..f2af73b --- /dev/null +++ b/themes/krajee-fas/theme.js @@ -0,0 +1,15 @@ +/*! + * Krajee Font Awesome Theme configuration for bootstrap-star-rating. + * This file must be loaded after 'star-rating.js'. + * + * @see http://github.com/kartik-v/bootstrap-star-rating + * @author Kartik Visweswaran + */ +(function ($) { + "use strict"; + $.fn.ratingThemes['krajee-fas'] = { + filledStar: '', + emptyStar: '', + clearButton: '' + }; +})(window.jQuery); diff --git a/themes/krajee-fas/theme.min.css b/themes/krajee-fas/theme.min.css new file mode 100644 index 0000000..520a10c --- /dev/null +++ b/themes/krajee-fas/theme.min.css @@ -0,0 +1,7 @@ +/*! + * Krajee Font Awesome Theme styling for bootstrap-star-rating. + * This file must be loaded after 'star-rating.css'. + * + * @see http://github.com/kartik-v/bootstrap-star-rating + * @author Kartik Visweswaran + */.theme-krajee-fas .clear-rating{margin:0 1px 0 0}.theme-krajee-fas.rating-rtl.is-star .empty-stars{margin-right:2px} \ No newline at end of file diff --git a/themes/krajee-fas/theme.min.js b/themes/krajee-fas/theme.min.js new file mode 100644 index 0000000..48ea86f --- /dev/null +++ b/themes/krajee-fas/theme.min.js @@ -0,0 +1,7 @@ +/*! + * Krajee Font Awesome Theme configuration for bootstrap-star-rating. + * This file must be loaded after 'star-rating.js'. + * + * @see http://github.com/kartik-v/bootstrap-star-rating + * @author Kartik Visweswaran + */!function(a){"use strict";a.fn.ratingThemes["krajee-fas"]={filledStar:'',emptyStar:'',clearButton:''}}(window.jQuery); \ No newline at end of file diff --git a/themes/krajee-svg/theme.css b/themes/krajee-svg/theme.css index 3917f8c..8c83c90 100644 --- a/themes/krajee-svg/theme.css +++ b/themes/krajee-svg/theme.css @@ -5,73 +5,62 @@ * @see http://github.com/kartik-v/bootstrap-star-rating * @author Kartik Visweswaran */ -.theme-krajee-svg .krajee-icon { +.theme-krajee-svg .krajee-icon, +.theme-krajee-svg .krajee-icon-clear { display: inline-block; - width: 48px; - height: 48px; + width: 2rem; + height: 2rem; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; } -.theme-krajee-svg.rating-xl .krajee-icon { - width: 80px; - height: 80px; -} - -.theme-krajee-svg.rating-lg .krajee-icon { - width: 64px; - height: 64px; -} - -.theme-krajee-svg.rating-sm .krajee-icon { - width: 40px; - height: 40px; -} - -.theme-krajee-svg.rating-xs .krajee-icon { - width: 30px; - height: 30px; -} - -.theme-krajee-svg .filled-stars .krajee-icon-star { - background-image: url('data:image/svg+xml;charset=utf-8,%3Csvg%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20width%3D%2232%22%20height%3D%2232%22%20viewBox%3D%220%200%2032%2032%22%3E%3Cpath%20fill%3D%22%23fde16d%22%20stroke%3D%22%23777777%22%20d%3D%22M20.6%2011l-4.6-10.5-4.6%2010.5h-10.8l7.8%207.9-3%2012.1%2010.6-6%2010.6%206-3-12.1%207.8-7.9z%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E'); +.theme-krajee-svg .clear-rating, +.theme-krajee-svg .rating-stars { + font-size: 5px; } .theme-krajee-svg .krajee-icon-clear { - display: inline-block; - width: 39px; - height: 39px; - -webkit-background-size: cover; - -moz-background-size: cover; - -o-background-size: cover; - background-size: cover; background-image: url('data:image/svg+xml;charset=utf-8,%3Csvg%20id%3D%22svg2%22%20xmlns%3Ardf%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20158.81%20158.81%22%20version%3D%221.1%22%3E%0D%0A%3Cpath%20id%3D%22path4%22%20style%3D%22fill%3A%23aaa%22%20stroke-linejoin%3D%22round%22%20d%3D%22m155.06%2C79.438c0%2C41.799-33.885%2C75.684-75.684%2C75.684s-75.684-33.885-75.684-75.684%2C33.885-75.684%2C75.684-75.684%2C75.684%2C33.885%2C75.684%2C75.684z%22%20stroke%3D%22%23aaa%22%20stroke-linecap%3D%22round%22%20fill%3D%22none%22%2F%3E%0D%0A%3Cpath%20id%3D%22rect3139%22%20style%3D%22fill%3A%23fff%22%20d%3D%22m37.216%2C64.443v28.67h88.24v-28.67h-88.24z%22%2F%3E%0D%0A%3C%2Fsvg%3E'); } -.theme-krajee-svg .krajee-icon-clear:hover { - background-image: url('data:image/svg+xml;charset=utf-8,%3Csvg%20id%3D%22svg2%22%20xmlns%3Ardf%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20158.81%20158.81%22%20version%3D%221.1%22%3E%0D%0A%3Cpath%20id%3D%22path4%22%20style%3D%22fill%3A%23843534%22%20stroke-linejoin%3D%22round%22%20d%3D%22m155.06%2C79.438c0%2C41.799-33.885%2C75.684-75.684%2C75.684s-75.684-33.885-75.684-75.684%2C33.885-75.684%2C75.684-75.684%2C75.684%2C33.885%2C75.684%2C75.684z%22%20stroke%3D%22%23843534%22%20stroke-linecap%3D%22round%22%20fill%3D%22none%22%2F%3E%0D%0A%3Cpath%20id%3D%22rect3139%22%20style%3D%22fill%3A%23fff%22%20d%3D%22m37.216%2C64.443v28.67h88.24v-28.67h-88.24z%22%2F%3E%0D%0A%3C%2Fsvg%3E'); +.theme-krajee-svg .filled-stars .krajee-icon-star { + background-image: url('data:image/svg+xml;charset=utf-8,%3Csvg%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20width%3D%2232%22%20height%3D%2232%22%20viewBox%3D%220%200%2032%2032%22%3E%3Cpath%20fill%3D%22%23fde16d%22%20stroke%3D%22%23777777%22%20d%3D%22M20.6%2011l-4.6-10.5-4.6%2010.5h-10.8l7.8%207.9-3%2012.1%2010.6-6%2010.6%206-3-12.1%207.8-7.9z%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E'); } +.theme-krajee-svg.rating-xl .krajee-icon, .theme-krajee-svg.rating-xl .krajee-icon-clear { - width: 64px; - height: 64px; + width: 3rem; + height: 3rem; } +.theme-krajee-svg.rating-lg .krajee-icon, .theme-krajee-svg.rating-lg .krajee-icon-clear { - width: 50px; - height: 50px; + width: 2.5rem; + height: 2.5rem; } +.theme-krajee-svg.rating-md .krajee-icon, +.theme-krajee-svg.rating-md .krajee-icon-clear { + width: 2rem; + height: 2rem; +} + +.theme-krajee-svg.rating-sm .krajee-icon, .theme-krajee-svg.rating-sm .krajee-icon-clear { - width: 30px; - height: 30px; + width: 1.5rem; + height: 1.5rem; } +.theme-krajee-svg.rating-xs .krajee-icon, .theme-krajee-svg.rating-xs .krajee-icon-clear { - width: 23px; - height: 23px; + width: 1rem; + height: 1rem; +} + +.theme-krajee-svg .krajee-icon-clear:hover { + background-image: url('data:image/svg+xml;charset=utf-8,%3Csvg%20id%3D%22svg2%22%20xmlns%3Ardf%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20158.81%20158.81%22%20version%3D%221.1%22%3E%0D%0A%3Cpath%20id%3D%22path4%22%20style%3D%22fill%3A%23843534%22%20stroke-linejoin%3D%22round%22%20d%3D%22m155.06%2C79.438c0%2C41.799-33.885%2C75.684-75.684%2C75.684s-75.684-33.885-75.684-75.684%2C33.885-75.684%2C75.684-75.684%2C75.684%2C33.885%2C75.684%2C75.684z%22%20stroke%3D%22%23843534%22%20stroke-linecap%3D%22round%22%20fill%3D%22none%22%2F%3E%0D%0A%3Cpath%20id%3D%22rect3139%22%20style%3D%22fill%3A%23fff%22%20d%3D%22m37.216%2C64.443v28.67h88.24v-28.67h-88.24z%22%2F%3E%0D%0A%3C%2Fsvg%3E'); } .theme-krajee-svg .empty-stars .krajee-icon-star { @@ -86,18 +75,6 @@ background-image: url('data:image/svg+xml;charset=utf-8,%3Csvg%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22%23ffffff%22%20stroke%3D%22%23777777%22%20stroke-width%3D%220.04em%22%20d%3D%22M12%2021.35l-1.45-1.32c-5.15-4.67-8.55-7.75-8.55-11.53%200-3.08%202.42-5.5%205.5-5.5%201.74%200%203.41.81%204.5%202.09%201.09-1.28%202.76-2.09%204.5-2.09%203.08%200%205.5%202.42%205.5%205.5%200%203.78-3.4%206.86-8.55%2011.54l-1.45%201.31z%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E'); } -.theme-krajee-svg .krajee-icon-heart { - margin: 0 -0.08em; -} - -.theme-krajee-svg.is-heart .caption { - margin-top: -0.8em; -} - -.theme-krajee-svg.is-heart .clear-rating { - margin-top: -0.4em; -} - .theme-krajee-svg.rating-rtl.is-heart .filled-stars { right: 0.02em; } diff --git a/themes/krajee-svg/theme.min.css b/themes/krajee-svg/theme.min.css index c45e77d..6231b16 100644 --- a/themes/krajee-svg/theme.min.css +++ b/themes/krajee-svg/theme.min.css @@ -4,5 +4,4 @@ * * @see http://github.com/kartik-v/bootstrap-star-rating * @author Kartik Visweswaran - */ -.theme-krajee-svg .krajee-icon{display:inline-block;width:48px;height:48px;-webkit-background-size:cover;-moz-background-size:cover;-o-background-size:cover;background-size:cover}.theme-krajee-svg.rating-xl .krajee-icon{width:80px;height:80px}.theme-krajee-svg.rating-lg .krajee-icon{width:64px;height:64px}.theme-krajee-svg.rating-sm .krajee-icon{width:40px;height:40px}.theme-krajee-svg.rating-xs .krajee-icon{width:30px;height:30px}.theme-krajee-svg .filled-stars .krajee-icon-star{background-image:url('data:image/svg+xml;charset=utf-8,%3Csvg%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20width%3D%2232%22%20height%3D%2232%22%20viewBox%3D%220%200%2032%2032%22%3E%3Cpath%20fill%3D%22%23fde16d%22%20stroke%3D%22%23777777%22%20d%3D%22M20.6%2011l-4.6-10.5-4.6%2010.5h-10.8l7.8%207.9-3%2012.1%2010.6-6%2010.6%206-3-12.1%207.8-7.9z%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E')}.theme-krajee-svg .empty-stars .krajee-icon-star{background-image:url('data:image/svg+xml;charset=utf-8,%3Csvg%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20width%3D%2232%22%20height%3D%2232%22%20viewBox%3D%220%200%2032%2032%22%3E%3Cpath%20fill%3D%22%23ffffff%22%20stroke%3D%22%23777777%22%20d%3D%22M20.6%2011l-4.6-10.5-4.6%2010.5h-10.8l7.8%207.9-3%2012.1%2010.6-6%2010.6%206-3-12.1%207.8-7.9z%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E')}.theme-krajee-svg .filled-stars .krajee-icon-heart{background-image:url('data:image/svg+xml;charset=utf-8,%3Csvg%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22%23fde16d%22%20stroke%3D%22%23777777%22%20stroke-width%3D%220.04em%22%20d%3D%22M12%2021.35l-1.45-1.32c-5.15-4.67-8.55-7.75-8.55-11.53%200-3.08%202.42-5.5%205.5-5.5%201.74%200%203.41.81%204.5%202.09%201.09-1.28%202.76-2.09%204.5-2.09%203.08%200%205.5%202.42%205.5%205.5%200%203.78-3.4%206.86-8.55%2011.54l-1.45%201.31z%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E')}.theme-krajee-svg .empty-stars .krajee-icon-heart{background-image:url('data:image/svg+xml;charset=utf-8,%3Csvg%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22%23ffffff%22%20stroke%3D%22%23777777%22%20stroke-width%3D%220.04em%22%20d%3D%22M12%2021.35l-1.45-1.32c-5.15-4.67-8.55-7.75-8.55-11.53%200-3.08%202.42-5.5%205.5-5.5%201.74%200%203.41.81%204.5%202.09%201.09-1.28%202.76-2.09%204.5-2.09%203.08%200%205.5%202.42%205.5%205.5%200%203.78-3.4%206.86-8.55%2011.54l-1.45%201.31z%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E')}.theme-krajee-svg .krajee-icon-heart{margin:0 -.08em}.theme-krajee-svg.is-heart .caption{margin-top:-.8em}.theme-krajee-svg.is-heart .clear-rating{margin-top:-.4em}.theme-krajee-svg.rating-rtl.is-heart .filled-stars{right:.02em}.theme-krajee-svg.rating-rtl.is-heart .empty-stars{margin-right:.01em} \ No newline at end of file + */.theme-krajee-svg .krajee-icon,.theme-krajee-svg .krajee-icon-clear{display:inline-block;width:2rem;height:2rem;-webkit-background-size:cover;-moz-background-size:cover;-o-background-size:cover;background-size:cover}.theme-krajee-svg .clear-rating,.theme-krajee-svg .rating-stars{font-size:5px}.theme-krajee-svg .krajee-icon-clear{background-image:url('data:image/svg+xml;charset=utf-8,%3Csvg%20id%3D%22svg2%22%20xmlns%3Ardf%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20158.81%20158.81%22%20version%3D%221.1%22%3E%0D%0A%3Cpath%20id%3D%22path4%22%20style%3D%22fill%3A%23aaa%22%20stroke-linejoin%3D%22round%22%20d%3D%22m155.06%2C79.438c0%2C41.799-33.885%2C75.684-75.684%2C75.684s-75.684-33.885-75.684-75.684%2C33.885-75.684%2C75.684-75.684%2C75.684%2C33.885%2C75.684%2C75.684z%22%20stroke%3D%22%23aaa%22%20stroke-linecap%3D%22round%22%20fill%3D%22none%22%2F%3E%0D%0A%3Cpath%20id%3D%22rect3139%22%20style%3D%22fill%3A%23fff%22%20d%3D%22m37.216%2C64.443v28.67h88.24v-28.67h-88.24z%22%2F%3E%0D%0A%3C%2Fsvg%3E')}.theme-krajee-svg .filled-stars .krajee-icon-star{background-image:url('data:image/svg+xml;charset=utf-8,%3Csvg%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20width%3D%2232%22%20height%3D%2232%22%20viewBox%3D%220%200%2032%2032%22%3E%3Cpath%20fill%3D%22%23fde16d%22%20stroke%3D%22%23777777%22%20d%3D%22M20.6%2011l-4.6-10.5-4.6%2010.5h-10.8l7.8%207.9-3%2012.1%2010.6-6%2010.6%206-3-12.1%207.8-7.9z%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E')}.theme-krajee-svg.rating-xl .krajee-icon,.theme-krajee-svg.rating-xl .krajee-icon-clear{width:3rem;height:3rem}.theme-krajee-svg.rating-lg .krajee-icon,.theme-krajee-svg.rating-lg .krajee-icon-clear{width:2.5rem;height:2.5rem}.theme-krajee-svg.rating-md .krajee-icon,.theme-krajee-svg.rating-md .krajee-icon-clear{width:2rem;height:2rem}.theme-krajee-svg.rating-sm .krajee-icon,.theme-krajee-svg.rating-sm .krajee-icon-clear{width:1.5rem;height:1.5rem}.theme-krajee-svg.rating-xs .krajee-icon,.theme-krajee-svg.rating-xs .krajee-icon-clear{width:1rem;height:1rem}.theme-krajee-svg .krajee-icon-clear:hover{background-image:url('data:image/svg+xml;charset=utf-8,%3Csvg%20id%3D%22svg2%22%20xmlns%3Ardf%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20158.81%20158.81%22%20version%3D%221.1%22%3E%0D%0A%3Cpath%20id%3D%22path4%22%20style%3D%22fill%3A%23843534%22%20stroke-linejoin%3D%22round%22%20d%3D%22m155.06%2C79.438c0%2C41.799-33.885%2C75.684-75.684%2C75.684s-75.684-33.885-75.684-75.684%2C33.885-75.684%2C75.684-75.684%2C75.684%2C33.885%2C75.684%2C75.684z%22%20stroke%3D%22%23843534%22%20stroke-linecap%3D%22round%22%20fill%3D%22none%22%2F%3E%0D%0A%3Cpath%20id%3D%22rect3139%22%20style%3D%22fill%3A%23fff%22%20d%3D%22m37.216%2C64.443v28.67h88.24v-28.67h-88.24z%22%2F%3E%0D%0A%3C%2Fsvg%3E')}.theme-krajee-svg .empty-stars .krajee-icon-star{background-image:url('data:image/svg+xml;charset=utf-8,%3Csvg%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20width%3D%2232%22%20height%3D%2232%22%20viewBox%3D%220%200%2032%2032%22%3E%3Cpath%20fill%3D%22%23ffffff%22%20stroke%3D%22%23777777%22%20d%3D%22M20.6%2011l-4.6-10.5-4.6%2010.5h-10.8l7.8%207.9-3%2012.1%2010.6-6%2010.6%206-3-12.1%207.8-7.9z%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E')}.theme-krajee-svg .filled-stars .krajee-icon-heart{background-image:url('data:image/svg+xml;charset=utf-8,%3Csvg%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22%23fde16d%22%20stroke%3D%22%23777777%22%20stroke-width%3D%220.04em%22%20d%3D%22M12%2021.35l-1.45-1.32c-5.15-4.67-8.55-7.75-8.55-11.53%200-3.08%202.42-5.5%205.5-5.5%201.74%200%203.41.81%204.5%202.09%201.09-1.28%202.76-2.09%204.5-2.09%203.08%200%205.5%202.42%205.5%205.5%200%203.78-3.4%206.86-8.55%2011.54l-1.45%201.31z%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E')}.theme-krajee-svg .empty-stars .krajee-icon-heart{background-image:url('data:image/svg+xml;charset=utf-8,%3Csvg%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22%23ffffff%22%20stroke%3D%22%23777777%22%20stroke-width%3D%220.04em%22%20d%3D%22M12%2021.35l-1.45-1.32c-5.15-4.67-8.55-7.75-8.55-11.53%200-3.08%202.42-5.5%205.5-5.5%201.74%200%203.41.81%204.5%202.09%201.09-1.28%202.76-2.09%204.5-2.09%203.08%200%205.5%202.42%205.5%205.5%200%203.78-3.4%206.86-8.55%2011.54l-1.45%201.31z%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E')}.theme-krajee-svg.rating-rtl.is-heart .filled-stars{right:.02em}.theme-krajee-svg.rating-rtl.is-heart .empty-stars{margin-right:.01em} \ No newline at end of file diff --git a/themes/krajee-uni/theme.css b/themes/krajee-uni/theme.css index 5fae2a1..9ce8a29 100644 --- a/themes/krajee-uni/theme.css +++ b/themes/krajee-uni/theme.css @@ -6,10 +6,12 @@ * @author Kartik Visweswaran */ .theme-krajee-uni .star { - font-size: 1.3em; + font-size: 1.2em; + line-height: 1; margin: 0; } -.theme-krajee-uni .caption { - margin-top: 0; +.theme-krajee-uni .clear-rating { + font-size: 1em; + line-height: 1; } \ No newline at end of file diff --git a/themes/krajee-uni/theme.min.css b/themes/krajee-uni/theme.min.css index cd78a4b..ab2b121 100644 --- a/themes/krajee-uni/theme.min.css +++ b/themes/krajee-uni/theme.min.css @@ -4,4 +4,4 @@ * * @see http://github.com/kartik-v/bootstrap-star-rating * @author Kartik Visweswaran - */.theme-krajee-uni .star{font-size:1.3em;margin:0}.theme-krajee-uni .caption{margin-top:0} \ No newline at end of file + */.theme-krajee-uni .star{font-size:1.2em;line-height:1;margin:0}.theme-krajee-uni .clear-rating{font-size:1em;line-height:1} \ No newline at end of file