├── .github ├── CONTRIBUTING.md ├── FUNDING.yml ├── ISSUE_TEMPLATE.md ├── PULL_REQUEST_TEMPLATE.md └── stale.yml ├── CHANGE.md ├── LICENSE.md ├── README.md ├── bower.json ├── composer.json ├── css ├── star-rating.css └── star-rating.min.css ├── examples ├── bs3.html └── bs5.html ├── img └── loading.gif ├── js ├── locales │ ├── LANG.js │ ├── ar.js │ ├── bn.js │ ├── de.js │ ├── es.js │ ├── fa.js │ ├── fr.js │ ├── gr.js │ ├── id.js │ ├── it.js │ ├── kk.js │ ├── ko.js │ ├── nl.js │ ├── pl.js │ ├── pt-BR.js │ ├── ro.js │ ├── ru.js │ ├── tr.js │ ├── ua.js │ └── zh.js ├── star-rating.js └── star-rating.min.js ├── package.json └── themes ├── krajee-fa ├── theme.css ├── theme.js ├── theme.min.css └── theme.min.js ├── krajee-fas ├── theme.css ├── theme.js ├── theme.min.css └── theme.min.js ├── krajee-gly ├── theme.js └── theme.min.js ├── krajee-svg ├── theme.css ├── theme.js ├── theme.min.css └── theme.min.js └── krajee-uni ├── theme.css ├── theme.js ├── theme.min.css └── theme.min.js /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Contributing to bootstrap-star-rating 2 | ===================================== 3 | Looking to contribute something to bootstrap-star-rating? **Here's how you can help.** 4 | 5 | Please take a moment to review this document in order to make the contribution 6 | process easy and effective for everyone involved. 7 | 8 | Following these guidelines helps to communicate that you respect the time of 9 | the developers managing and developing this open source project. In return, 10 | they should reciprocate that respect in addressing your issue or assessing 11 | patches and features. 12 | 13 | Using the issue tracker 14 | ----------------------- 15 | When [reporting bugs][reporting-bugs] or 16 | [requesting features][requesting-features], the 17 | [issue tracker on GitHub][issue-tracker] is the recommended channel to use. 18 | 19 | The issue tracker **is not** a place for support requests. Refer the 20 | [plugin documentation](http://plugins.krajee.com/star-rating), 21 | [plugin demos](http://plugins.krajee.com/star-rating/demo), and / or refer to the 22 | [webtips Q & A forum](http://webtips.krajee.com/questions) which are the better places to get help. 23 | 24 | Reporting bugs with bootstrap-star-rating 25 | ----------------------------------------- 26 | We really appreciate clear bug reports that _consistently_ show an issue 27 | _within bootstrap-star-rating_. 28 | 29 | The ideal bug report follows these guidelines: 30 | 31 | 1. **Use the [GitHub issue search][issue-search]** — Check if the issue 32 | has already been reported. 33 | 2. **Check if the issue has been fixed** — Try to reproduce the problem 34 | using the code in the `master` branch. 35 | 3. **Isolate the problem** — Try to create an 36 | [isolated js fiddle][isolated-case] that consistently reproduces the problem. 37 | 38 | Please try to be as detailed as possible in your bug report, especially if an 39 | isolated test case cannot be made. Some useful questions to include the answer 40 | to are: 41 | 42 | - What steps can be used to reproduce the issue? 43 | - What is the bug and what is the expected outcome? 44 | - What browser(s) and Operating System have you tested with? 45 | - Does the bug happen consistently across all tested browsers? 46 | - What version of jQuery are you using? And what version of bootstrap-star-rating? 47 | - Are you using bootstrap-star-rating with other plugins? 48 | 49 | All of these questions will help others fix and identify any potential bugs. 50 | 51 | Requesting features in bootstrap-star-rating 52 | ------------------------------------------ 53 | Before starting work on a major feature for bootstrap-star-rating, **read the 54 | [documentation](http://plugins.krajee.com/star-rating) first** or you may risk spending a considerable amount of 55 | time on something which the project developers are not interested in bringing into the project. 56 | 57 | ### Submitting a pull request 58 | 59 | We use GitHub's pull request system for submitting patches. Here are some 60 | guidelines to follow when creating the pull request for your fix. 61 | 62 | 1. Make sure to create a ticket for your pull request. This will serve as the 63 | bug ticket, and any discussion about the bug will take place there. Your pull 64 | request will be focused on the specific changes that fix the bug. 65 | 2. Make sure to reference the ticket you are fixing within your pull request. 66 | This will allow us to close off the ticket once we merge the pull request, or 67 | follow up on the ticket if there are any related blocking issues. 68 | 3. Explain why the specific change was made. Not everyone who is reviewing your 69 | pull request will be familiar with the problem it is fixing. 70 | 4. Run your tests first. If your tests aren't passing, the pull request won't 71 | be able to be merged. If you're breaking existing tests, make sure that you 72 | aren't causing any breaking changes. 73 | 5. Only include source changes. While it's not required, only including changes 74 | from the `src` directory will prevent merge conflicts from occuring. Making 75 | this happen can be as a simple as not committing changes from the `dist` 76 | directory. 77 | 78 | By following these steps, you will make it easier for your pull request to be 79 | reviewed and eventually merged. 80 | 81 | Triaging issues and pull requests 82 | --------------------------------- 83 | Anyone can help the project maintainers triage issues and review pull requests. 84 | 85 | ### Handling new issues 86 | 87 | bootstrap-star-rating regularly receives new issues which need to be tested and organized. 88 | 89 | When a new issue that comes in that is similar to another existing issue, it 90 | should be checked to make sure it is not a duplicate. Duplicates issues should 91 | be marked by replying to the issue with "Duplicate of #[issue number]" where 92 | `[issue number]` is the url or issue number for the existing issue. This will 93 | allow the project maintainers to quickly close off additional issues and keep 94 | the discussion focused within a single issue. 95 | 96 | If you can test issues that are reported to bootstrap-star-rating that contain test cases and 97 | confirm under what conditions bugs happen, that will allow others to identify 98 | what causes a bug quicker. 99 | 100 | ### Reviewing pull requests 101 | 102 | It is very common for pull requests to be opened for issues that contain a clear 103 | solution to the problem. These pull requests should be rigorously reviewed by 104 | the community before being accepted. If you are not sure about a piece of 105 | submitted code, or know of a better way to do something, do not hesitate to make 106 | a comment on the pull request. 107 | 108 | ### Reviving old tickets 109 | 110 | If you come across tickets which have not been updated for a while, you are 111 | encouraged to revive them. While this can be as simple as saying `:+1:`, it is 112 | best if you can include more information on the issue. Common bugs and feature 113 | requests are more likely to be fixed, whether it is by the community or the 114 | developers, so keeping tickets up to date is encouraged. 115 | 116 | Licensing 117 | --------- 118 | 119 | It should also be made clear that **all code contributed to bootstrap-star-rating** must be 120 | licensable under the [BSD-3 license][licensing]. Code that cannot be released 121 | under this license **cannot be accepted** into the project. 122 | 123 | [isolated-case]: https://jsfiddle.net/ 124 | [issue-search]: https://github.com/kartik-v/bootstrap-star-rating/search?q=&type=Issues 125 | [issue-tracker]: https://github.com/kartik-v/bootstrap-star-rating/issues 126 | [licensing]: https://github.com/kartik-v/bootstrap-star-rating/blob/master/LICENSE.md 127 | [reporting-bugs]: #reporting-bugs-with-bootstrap-star-rating 128 | [requesting-features]: #requesting-features-in-bootstrap-star-rating -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | # github: [kartik-v] 4 | open_collective: bootstrap-star-rating 5 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Prerequisites 2 | 3 | - [ ] I have searched for similar issues in both open and closed tickets and cannot find a duplicate. 4 | - [ ] The issue still exists against the latest `master` branch of bootstrap-star-rating. 5 | - [ ] This is not an usage question. I confirm having read the plugin [documentation](http://plugins.krajee.com/star-rating) and [demos](http://plugins.krajee.com/star-rating/demo). 6 | - [ ] This is not a general programming / coding question. (Those should be directed to the [webtips Q & A forum](http://webtips.krajee.com/questions)). 7 | - [ ] I have attempted to find the simplest possible steps to reproduce the issue. 8 | - [ ] I have included a failing test as a pull request (Optional). 9 | 10 | ## Steps to reproduce the issue 11 | 12 | 1. 13 | 2. 14 | 3. 15 | 16 | ## Expected behavior and actual behavior 17 | 18 | When I follow those steps, I see... 19 | 20 | I was expecting... 21 | 22 | ## Environment 23 | 24 | Browsers 25 | 26 | - [ ] Google Chrome 27 | - [ ] Mozilla Firefox 28 | - [ ] Internet Explorer 29 | - [ ] Safari 30 | 31 | Operating System 32 | 33 | - [ ] Windows 34 | - [ ] Mac OS X 35 | - [ ] Linux 36 | - [ ] Mobile 37 | 38 | Libraries 39 | 40 | - jQuery version: 41 | - bootstrap-star-rating version: 42 | 43 | ## Isolating the problem 44 | 45 | - [ ] This bug happens [on the plugin demos page](http://plugins.krajee.com/star-rating/demo) 46 | - [ ] The bug happens consistently across all tested browsers 47 | - [ ] This bug happens when using bootstrap-star-rating without other plugins 48 | - [ ] I can reproduce this bug in [a jsbin](https://jsbin.com/) 49 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Scope 2 | This pull request includes a 3 | 4 | - [ ] Bug fix 5 | - [ ] New feature 6 | - [ ] Translation 7 | 8 | ## Changes 9 | The following changes were made 10 | 11 | - 12 | - 13 | - 14 | 15 | ## Related Issues 16 | If this is related to an existing ticket, include a link to it as well. -------------------------------------------------------------------------------- /.github/stale.yml: -------------------------------------------------------------------------------- 1 | # Number of days of inactivity before an issue becomes stale 2 | daysUntilStale: 60 3 | # Number of days of inactivity before a stale issue is closed 4 | daysUntilClose: 7 5 | # Issues with these labels will never be considered stale 6 | exemptLabels: 7 | - bug 8 | - enhancement 9 | - pinned 10 | - security 11 | # Label to use when marking an issue as stale 12 | staleLabel: wontfix 13 | # Comment to post when marking an issue as stale. Set to `false` to disable 14 | markComment: > 15 | This issue has been automatically marked as stale because it has not had 16 | recent activity. It will be closed if no further activity occurs. Thank you 17 | for your contributions. 18 | # Comment to post when closing a stale issue. Set to `false` to disable 19 | closeComment: false -------------------------------------------------------------------------------- /CHANGE.md: -------------------------------------------------------------------------------- 1 | Change Log: `bootstrap-star-rating` 2 | =================================== 3 | 4 | ## Version 4.1.3 5 | 6 | **Date:** _under development_ 7 | 8 | - (bug #216): Correct `rating-input` CSS class position. 9 | 10 | ## Version 4.1.2 11 | 12 | **Date:** 20-Sep-2021 13 | 14 | - Simplify NPM module handling. 15 | 16 | ## Version 4.1.1 17 | 18 | **Date:** 11-Sep-2021 19 | 20 | - (enh #215): Correct NPM module handling. 21 | 22 | ## Version 4.1.0 23 | 24 | **Date:** 25-Jul-2021 25 | 26 | - (bug #213): Correct `mousenter` event to `mouseenter`. 27 | - (enh #212): Enhance caption badge styles. 28 | - (enh #211): Correct keyboard arrow keys behavior for RTL oriented inputs. 29 | - (enh #210): Revamp themes - set default theme to Krajee SVG. 30 | 31 | ## Version 4.0.9 32 | 33 | **Date:** 21-May-2021 34 | 35 | - Correct `minThreshold` default value. 36 | 37 | ## Version 4.0.8 38 | 39 | **Date:** 21-May-2021 40 | 41 | - (enh #209): Enhancements to support BS 5.x (and 4.x/3.x). 42 | 43 | ## Version 4.0.7 44 | 45 | **Date:** 20-May-2021 46 | 47 | - (enh #208): Corrected positioning of the base input on which the rating is triggered. 48 | - (enh #205): Add Dutch Translations. 49 | - (enh #200): Activate Open Collective. 50 | - (enh #199): Add Greek Translations. 51 | - (enh #145): Minimum value threshold validation. 52 | - New property `minThreshold` which allows a star rated with minimum value always. The initial value 53 | of the rating is set to `minThreshold` if it has a value undefined or a value less than `minThreshold` 54 | - The `minThreshold` value must be a value between the `min` and `max` values 55 | - If `minThreshold` is set to less than `min` the plugin will default `minThreshold` to the `min` value 56 | - If `minThreshold` is set to greater than `max` the plugin will default `minThreshold` to the `max` value 57 | - (enh #129): Enhance accessibility & make the stars keyboard focusable. 58 | - New property `keyboardEnabled` - defaults to `true` 59 | - allow use of `tab` keyboard button to navigate to the rating 60 | - allow use of arrow `right` and arrow `left` keyboard buttons to change the rating value 61 | - New property `mouseEnabled` - defaults to `true` 62 | - when set to false - the mouse cannot be used to change the ratings 63 | - (enh #111): Add titles to individual star elements. 64 | - New config property `starTitles` (can be set as object or function) - will set the title for each star 65 | - (enh #110): Hover events reworked. New events added `rating:mouseenter` and `rating:mouseleave` 66 | ``` 67 | $('#ratingInput').on('rating:mouseenter rating:mouseleave', function(e, index, status, $star) { 68 | console.log(index); // the index number of the star where the event was triggered 69 | console.log(status); // whether the mouse event was triggered on `empty-star` or `filled-star` 70 | console.log($star); // the current star jquery object where event was triggered 71 | console.log($star.attr('title')); // can get properties of the star object 72 | }); 73 | ``` 74 | 75 | ## Version 4.0.6 76 | 77 | **Date:** 25-May-2019 78 | 79 | - (enh #195): Update Bootstrap dependency. 80 | - (enh #194, enh #180): Allow StarCaptionClasses CSS classes to also be set by Percentage width. 81 | - (enh #190): Update German Translations. 82 | - Implement stale bot. 83 | 84 | ## Version 4.0.5 85 | 86 | **Date:** 04-Oct-2018 87 | 88 | - (enh #189): Add Bengali Translations. 89 | - (enh #188): Allow `showCaption` when `displayOnly` is `true`. 90 | 91 | ## Version 4.0.4 92 | 93 | **Date:** 15-Sep-2018 94 | 95 | - Enhancements to support Bootstrap v4.x. 96 | - Better styling of stars for the 5 rating sizes and maintain consistency across themes. 97 | - (enh #187): Add Kazakh translations. 98 | - (enh #184): Correct rating-input style to keep it hidden - yet trigger required validation. 99 | - (enh #182): New Krajee Font Awesome 5.x `fas` theme. 100 | - (bug #177, enh #179): New property `showCaptionAsTitle` 101 | - Useful for caption to be displayed as title for readonly ratings. 102 | 103 | ## Version 4.0.3 104 | 105 | **Date:** 03-Nov-2017 106 | 107 | - (bug #173): Correct `rating:change` event. 108 | - (enh #171): Rename events to start with `rating:` instead of `rating`. 109 | - (enh #170): Enhancements to support Bootstrap v4.x framework. 110 | 111 | ## Version 4.0.2 112 | 113 | **Date:** 27-Aug-2017 114 | 115 | - (enh #170): Enhancements to support Bootstrap v4.x framework. 116 | - Chronological sorting of issues and enhancements in the CHANGE log. 117 | - (enh #164): Add Turkish Translations. 118 | - (enh #163): Add Korean Translations. 119 | - (enh #162): Add Italian Translations. 120 | - (enh #161): Add Farsi Translations. 121 | - (enh #156): More correct form reset event listening. 122 | - (enh #155): Styling enhancements and code optimizations. 123 | - (enh #154): New property `zeroAsNull` to treat zero value rating as null. 124 | - (enh #153): Add ability to configure `required` attribute for input. 125 | - Add github issue and PR contribution templates. 126 | - (enh #142): Enable scroll when rating is readonly or disabled. 127 | - (enh #139): Do not refer to minified files in bower main metadata . 128 | - (enh #132): Add Polish Translations. 129 | - (enh #131): Add Arabic Translations. 130 | - (enh #130): Better management of themes and locales. 131 | - (enh #127): Add Chinese Translations. 132 | - (enh #124): Add License Headers. 133 | - (enh #123): Add Italian Translations. 134 | - (enh #122): Add Spanish Translations. 135 | - (enh #115): Add Romanian Translations. 136 | - (enh #108): Add French Translations. 137 | 138 | ## Version 4.0.1 139 | 140 | **Date:** 28-Feb-2016 141 | 142 | - Update package.json to include `peerDependencies` instead of `dependencies`. 143 | - (enh #103): Implement method chaining and revamp private methods 144 | - enhance public methods like `create`, `destroy`, `refresh`, `clear`, `reset` to return the rating element jQuery object 145 | - (bug #102): Revamp generation of rating via `refresh` method. 146 | - (bug #101): Correct caption setting when `showCaption` is `false`. 147 | - (bug #100): Correct caption and clear rendering methods. 148 | - (bug #99): Correct documentation for refresh method. 149 | 150 | ## Version 4.0.0 151 | 152 | **Date:** 16-Feb-2016 153 | 154 | - (enh #97): Add `animate` property to enable / disable animation of star highlight on hover / change. 155 | - (enh #96): Add support for `bootstrap-sass` official repo via `sass` branch. 156 | - (enh #95): Add display only capability. 157 | - (enh #94): Add Theming Functionality. 158 | - New property `theme` will assign a CSS class with the `rating-` to the rating container. 159 | - Themes included 160 | - The default (blank) theme (for displaying bootstrap glyphicons) 161 | - `krajee-svg` (for displaying svg icons) 162 | - `krajee-uni` (for displaying unicode symbols as stars) 163 | - `krajee-fa` (for displaying font awesome icons) 164 | - Add ability to override and add one's own themes 165 | 166 | **Various new features and BC breaking enhancements** 167 | 168 | - **REMOVED**: `symbol`, `glyphicon`, `ratingClass` properties will be removed. 169 | - The requirement for the above will be replaced with the `theme` property (and can also be implemented using the `containerClass` property). 170 | - Stars now have a better padding and spacing that can be configured via CSS and themes 171 | - New property `filledStar` - will allow one to set the markup for `filledStar` - will default to 172 | - `` 173 | - New property `emptyStar` - will allow one to set the markup for `emptyStar` - will default to 174 | - `` 175 | - Exclusive support for SVG (and a prebuilt `krajee-svg` theme that contains two different ready to use SVG icons). 176 | - (enh #91): Add SVG Icon Support 177 | 178 | ## Version 3.5.8 179 | 180 | **Date:** 16-Feb-2016 181 | 182 | - (bug #90): Rename reserved word used as variable. 183 | - (enh #89): Add Portugese Brazilian Translations. 184 | - (enh #88): Add German Translations. 185 | 186 | ## Version 3.5.7 187 | 188 | **Date:** 22-Jan-2016 189 | 190 | - (enh #86): Refactor code for listening events and deep extend options correctly. 191 | - (enh #84): Add Ukranian Translations. 192 | 193 | ## Version 3.5.6 194 | 195 | **Date:** 29-Dec-2015 196 | 197 | - (enh #82): Added "main" key into NPM package.json. 198 | - (enh #81): Simplify README docs. 199 | - (bug #77): Correct `touches` and `changedTouches` validation. 200 | - (enh #76): Add Russian Translations. 201 | 202 | ## Version 3.5.5 203 | 204 | **Date:** 22-Nov-2015 205 | 206 | - (enh #75): Implement Locales and Translations. 207 | - (enh #74): Universal Module Definition for use with CommonJS, AMD or browser globals. 208 | - (enh #71): Fix `Error: Cannot read property 'pageX' of undefined` error on touch devices. 209 | 210 | ## Version 3.5.4 211 | 212 | **Date:** 20-Sep-2015 213 | 214 | - Update bootstrap bower version to support only 3.x variants. 215 | - (enh #63): Add `package.json` for npm install. 216 | - (enh #59): Remove `String.prototype.replaceAll` and implement regex replace. 217 | - (enh #47): Styling enhancements for printed output (better star colors and hide clear button). 218 | 219 | ## Version 3.5.3 220 | 221 | **Date:** 18-Jun-2015 222 | 223 | - Fixes for composer.json dependencies. 224 | - (enh #58): Remove redundant tooltip title on hover of caption element. 225 | 226 | ## Version 3.5.2 227 | 228 | **Date:** 10-May-2015 229 | 230 | - (enh #46): More correct init of `clear` and `caption` elements. 231 | - (enh #45): Validate on `touchstart` for devices that do not support `click` event. 232 | 233 | ## Version 3.5.1 234 | 235 | **Date:** 13-Feb-2015 236 | 237 | - Set copyright year to current. 238 | - (enh #44): Ability to integrate with other font icon CSS frameworks like Font Awesome. 239 | - New property `ratingClass` added to allow configuring other icon framework css classes. 240 | 241 | ## Version 3.5.0 242 | 243 | **Date:** 31-Jan-2015 244 | 245 | - (enh #42): Code cleanup and restructure for JS lint changes (using JSHint Code cleanup library). 246 | - (enh #39): Prevent invalid star rating for numStars > 5 with default value & hoverChange enabled. 247 | 248 | ## Version 3.4.0 249 | 250 | **Date:** 16-Dec-2014 251 | 252 | - (enh #36): Added `create` method to create the rating plugin (typically after a destroy). 253 | - (enh #35): Added `destroy` method to destroy the rating plugin. 254 | 255 | ## Version 3.3.0 256 | 257 | **Date:** 17-Nov-2014 258 | 259 | - (enh #33): Enhance touch methods for compatibility across more wider mobile device browsers. 260 | - (bug #32): Prevent invalid star ratings if cursor is close to left/right edge of star array. 261 | 262 | ## Version 3.2.0 263 | 264 | **Date:** 08-Nov-2014 265 | 266 | - Updated CHANGE log to reflect user friendly date time formats. 267 | - Set release to stable in composer.json. 268 | 269 | ## Version 3.1.0 270 | 271 | **Date:** 27-Oct-2014 272 | 273 | - enh #28: Add rating.refresh event. 274 | - enh #27: Reset events on the rating element before every refresh. 275 | - enh #26: Add touch device support to enable touch and slide across stars. 276 | 277 | 278 | ## Version 3.0.0 279 | 280 | **Date:** 13-Oct-2014 281 | 282 | - enh #24: Set `clearValue` to default to `min` if not set. 283 | - enh #22: More correct minimum value and clear value validation through new `getWidthFromValue` method. 284 | - enh #21: Following new events are added: 285 | - `rating.hover` 286 | - `rating.hoverleave` 287 | - enh #20, #21: Included hover validation routine and rating state change on hover. Following new configurable properties added: 288 | - `hoverEnabled`: _boolean_ whether hover functionality is enabled. This will dynamically change the stars and caption on mouse hover. Defaults to `true`. This functionality will only work on desktop devices and if the input is not `disabled` or `readonly`. 289 | - `hoverChangeCaption`: _boolean_ control whether the caption should dynamically change on mouse hover. Defaults to `true`. Will be applicable only if `hoverEnabled` is `true`. 290 | - `hoverChangeStars`: _boolean_ control whether the stars should dynamically change on mouse hover. Defaults to `true`. Will be applicable only if `hoverEnabled` is `true`. 291 | 292 | ## Version 2.6.0 293 | 294 | **Date:** 23-Aug-2014 295 | 296 | - enh #17: Dynamic configuration for `starCaptions` and `starCaptionClasses` using a function. 297 | 298 | ## Version 2.5.0 299 | 300 | **Date:** 27-May-2014 301 | 302 | - Caption and Clear elements parameters treated as identifiers rather than JQuery object elements. 303 | - Removed cloning of inputs to allow better refreshing of input across ajax and other scenarios. 304 | - Plugin support is now extended to all Touch based and mobile devices like iOS, Android. 305 | - Plugin support is now extended to all browsers including pre IE10 306 | - Uses special JQuery routines to trigger star rating changes. 307 | - Change to entire plugin code to eliminate dependency of HTML5 input. Plugin size reduced to 8KB minified. 308 | 309 | ## Version 2.1.0 310 | 311 | **Date:** 08-May-2014 312 | 313 | - Bug #8,#9,#10: Correct cloning and con## Version of field to a range slider input. 314 | 315 | ## Version 2.0.0 316 | 317 | 318 | **Date:** 25-Apr-2014 319 | 320 | - Automatically degrades to a normal SELECT dropdown input for browsers that do not support 321 | HTML 5 range input. 322 | - Uses HTML 5 range input to change ratings. Polyfills for range input in case JQuery/Javascript is disabled. 323 | - Any star symbol (unicode or icon font) can be embedded instead of Glyphicon. 324 | - Bootstrap style is made optional and configurable. Can override CSS to use any style. 325 | - Right to left (RTL) support enhancement. Optimally uses the `dir` attribute of the range input. 326 | - Render and display fractional star ratings. Configure number of stars, min, max, step, and theoretically 327 | support any fractional rating. 328 | - Revamp of entire plugin code. Cleverly leverages CSS3 styles, animations, and HTML5 input features 329 | to render the plugin. 330 | 331 | ## Version 1.2.0 332 | 333 | **Date:** 04-Apr-2014 334 | 335 | - Clear button class customization added. 336 | - Widget is customizable for using any CSS markup to override Bootstrap styles. 337 | 338 | ## Version 1.1.0 339 | 340 | **Date:** 10-Mar-2014 341 | 342 | Revamped the methods for usage across wider scenarios: 343 | 344 | - Revamped the `refresh` method to enable refreshing all plugin options at runtime via parameters. 345 | - Included `update` method to set a value of a rating via javascript. 346 | 347 | ## Version 1.0.0 348 | 349 | **Date:** 01-Oct-2013 350 | 351 | Initial release. The following features are included in this release: 352 | 353 | - Convert any HTML input to a star rating control. Recommended input is of `type = number`, which will help fallback to a number input for browsers not supporting JQuery or Javascript. 354 | - The plugin automatically converts an input with `type = number` to a star rating control if you set its `class = rating`. All options to the input can be passed as HTML5 `data` attributes. 355 | - Involves pure CSS3 styling of the stars. Say goodbye to image sprites or playing with image backgrounds. Offers clean scalable vector icons for consistent display across devices. 356 | - Specifically uses Bootstrap 3.x styles & glyphs. Can be combined to work better for Bootstrap styled projects (or input group addons). 357 | - Ability to clear values and options for the stars. Control where the clear button element can be shown. 358 | - Reset star rating to the initial value when the form is reset. 359 | - Ability to control and display caption of the selected stars. Each rated star can have its own caption. Control where the caption element can be shown. 360 | - Ability to size the rating control including the stars, caption, and clear button. Five prebuilt size templates are available `xl`, `lg`, `md`, `sm`, and `xs`. 361 | - Support for RIGHT TO LEFT (RTL) input. Automatically changes star styling for RTL. 362 | - Triggers JQuery events for advanced development. Events currently available are `rating.change`, `rating.clear`, and `rating.reset`. 363 | - Disabled and readonly input star rating support. 364 | - Size of the entire plugin is less than 9KB (about 6KB for the minified JS and 3KB for the minified CSS). -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 - 2021, Kartik Visweswaran 2 | Krajee.com 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above copyright notice, this 12 | list of conditions and the following disclaimer in the documentation and/or 13 | other materials provided with the distribution. 14 | 15 | * Neither the names of Kartik Visweswaran or Krajee nor the names of its 16 | contributors may be used to endorse or promote products derived from 17 | this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 26 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 | Krajee Logo 4 | 5 |
6 | bootstrap-star-rating 7 |
8 | Donate 10 |       11 | kartikv 12 |

13 | 14 |
15 | 16 | [![Financial Contributors on Open Collective](https://opencollective.com/bootstrap-star-rating/all/badge.svg?label=financial+contributors)](https://opencollective.com/bootstrap-star-rating) 17 | [![Bower version](https://badge.fury.io/bo/bootstrap-star-rating.svg)](http://badge.fury.io/bo/bootstrap-star-rating) 18 | [![Latest Stable Version](https://poser.pugx.org/kartik-v/bootstrap-star-rating/v/stable)](https://packagist.org/packages/kartik-v/bootstrap-star-rating) 19 | [![License](https://poser.pugx.org/kartik-v/bootstrap-star-rating/license)](https://packagist.org/packages/kartik-v/bootstrap-star-rating) 20 | [![Packagist Downloads](https://poser.pugx.org/kartik-v/bootstrap-star-rating/downloads)](https://packagist.org/packages/kartik-v/bootstrap-star-rating) 21 | [![Monthly Downloads](https://poser.pugx.org/kartik-v/bootstrap-star-rating/d/monthly)](https://packagist.org/packages/kartik-v/bootstrap-star-rating) 22 | 23 |
24 | 25 | A simple yet powerful JQuery star rating plugin for Bootstrap which supports advanced features like fractional star fill and RTL input support. 26 | Developed with a focus on utlizing pure CSS-3 styling to render the control. The plugin uses Bootstrap markup and styling by default, but it 27 | can be overridden with any other CSS markup. View the [documentation](http://plugins.krajee.com/star-rating) or a [complete demo](http://plugins.krajee.com/star-rating/demo) 28 | at Krajee JQuery plugins. 29 | 30 | > NOTE: Release v4.0 is a modified rewrite with various new enhancements and BC breaking features. It allows rendering richer markup for star symbols and offers theming support. 31 | 32 | ![Star Rating Screenshot](https://cdn.jsdelivr.net/gh/kartik-v/bootstrap-fileinput-samples@0.0.1/samples/star-rating-screenshot.png) 33 | 34 | ## Features 35 | 36 | - Convert any HTML input to a star rating control. 37 | - The plugin automatically converts an input to a star rating control if you set its `class = rating`. 38 | All options to the input can be passed as HTML5 `data` attributes. 39 | - You can use the HTML 5 number input for polyfill and the plugin will automatically use the number attributes like `min`, `max`, and `step`. 40 | However, number inputs have a problem with decimal values on the Chrome Browser. Read the Browser Support section in the documentation. 41 | - Involves pure CSS3 styling of the stars. Say goodbye to image sprites or playing with image backgrounds. Offers clean scalable vector 42 | icons for consistent display across devices. Optionally one can use the Unicode character set to override symbols. 43 | - Use any of your favorite font icon frameworks to render your star symbols (for example you can easily use the icons from the FontAwesome library). 44 | - Render and display fractional star ratings. Configure number of stars, min, max, step, and theoretically support any fractional rating. 45 | - Uses Bootstrap 5.x, 4.x, 3.x styles & Bootstrap 3.x glyphicons by default. But this can be overridden with plugin parameters and your own CSS styles. 46 | - Support for RIGHT TO LEFT (RTL) input. Automatically changes star styling for RTL. 47 | - Ability to clear values and options for the stars. Control where the clear button element can be shown. 48 | - Reset star rating to the initial value when the form is reset. 49 | - Ability to control and display caption of the selected stars. Each rated star can have its own caption. Control where the 50 | caption element can be shown. 51 | - Ability to size the rating control including the stars, caption, and clear button. Five prebuilt size templates are 52 | available `xl`, `lg`, `md`, `sm`, and `xs`. 53 | - Triggers JQuery events for advanced development. Events currently available are `rating.change`, `rating.clear`, `rating.reset`, `rating.refresh`, `rating.hover`, and `rating.hoverleave`. 54 | - Disabled and readonly input star rating support. 55 | - Change stars and caption on mouse hover (new feature since v3.0.0). 56 | - Change stars and caption on slide and drag for mobile/touch devices (new feature since v3.1.0). 57 | - Support for translations and locales. 58 | 59 | ### New features/changes since release v4.0 60 | 61 | - **BC Breaking Change**: The `symbol`, `glyphicon`, `ratingClass` properties have been removed. The functionality is replaced with the `theme` property (and can also be complemented or implemented separately using the `containerClass` property). 62 | - New property `theme` will assign a CSS class with the `rating-` to the rating container. 63 | - Themes included 64 | - `krajee-svg` (for displaying svg icons) - default theme since v4.1.0 65 | - `krajee-uni` (for displaying Krajee unicode symbols as stars) 66 | - `krajee-fas` (for displaying font awesome 5.x icons) 67 | - `krajee-fa` (for displaying font awesome 4.x icons) 68 | - `krajee-gly` (for displaying bootstrap 3.x glyphicons) 69 | - Add ability to override and add one's own themes 70 | - Stars now have a better padding and spacing that can be configured via CSS and themes 71 | - New property `filledStar` - will allow one to set the markup for `filledStar` - will default to 72 | - `` 73 | - New property `emptyStar` - will allow one to set the markup for `emptyStar` - will default to 74 | - `` 75 | - Exclusive support for SVG (and a prebuilt `krajee-svg` theme that contains two different ready to use SVG icons). 76 | - Ability to easily set the widget as a "display only" rating via `displayOnly` property. 77 | - New property `animate` to control animation of highlighted stars on hover or click. 78 | 79 | > NOTE: Refer [change log](https://github.com/kartik-v/bootstrap-star-rating/blob/master/CHANGE.md) for details on plugin enhancements, fixes, and changes. 80 | 81 | ## Documentation and Demo 82 | 83 | View the [plugin documentation](http://plugins.krajee.com/star-rating) and [plugin demos](http://plugins.krajee.com/star-rating/demo) at Krajee JQuery plugins. 84 | 85 | ## Pre-requisites 86 | 87 | 1. [Bootstrap 5.x, 4.x, 3.x](http://getbootstrap.com/) 88 | 2. Latest [JQuery](http://jquery.com/) 89 | 3. Most browsers supporting CSS3 & JQuery. 90 | 91 | ## Installation 92 | 93 | ### Using Bower 94 | You can use the `bower` package manager to install. Run: 95 | 96 | bower install bootstrap-star-rating 97 | 98 | ### Using Composer 99 | You can use the `composer` package manager to install. Either run: 100 | 101 | $ php composer.phar require kartik-v/bootstrap-star-rating "@dev" 102 | 103 | or add: 104 | 105 | "kartik-v/bootstrap-star-rating": "@dev" 106 | 107 | to your composer.json file 108 | 109 | > NOTE: You can use the [sass branch](https://github.com/kartik-v/bootstrap-star-rating/tree/sass) for installation using `bootstrap-sass` dependency. 110 | The [master branch](https://github.com/kartik-v/bootstrap-star-rating/tree/master) can be used for installation using plain `bootstrap` dependency. 111 | 112 | ### Manual Install 113 | 114 | You can also manually install the plugin easily to your project. Just download the source [ZIP](https://github.com/kartik-v/bootstrap-star-rating/zipball/master) or [TAR ball](https://github.com/kartik-v/bootstrap-star-rating/tarball/master) and extract the plugin assets (css and js folders) into your project. 115 | 116 | ## Usage 117 | 118 | Step 1: Load the following assets in your header. 119 | 120 | ```html 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | ``` 138 | 139 | If you noticed, you need to load the `jquery.min.js` and `bootstrap.min.css` in addition to the `star-rating.min.css` and `star-rating.min.js` for 140 | the plugin to work with default settings. 141 | 142 | Step 2: Setup your input markup to automatically initialize the rating 143 | ```html 144 | 145 | ``` 146 | 147 | Step 3: Initialize the plugin on your page for other input types. For example, 148 | 149 | ```js 150 | // initialize with defaults 151 | $("#input-id").rating(); 152 | 153 | // with plugin options (do not attach the CSS class "rating" to your input if using this approach) 154 | $("#input-id").rating({'size':'lg'}); 155 | ``` 156 | 157 | The `#input-id` is the identifier for the input on your page (that you used to initialize the rating), and this input is hidden automatically by the plugin (by adding the bootstrap CSS class `hide`). 158 | 159 | Alternatively, you can directly call the plugin options by setting data attributes to your input field. 160 | 161 | ## Contributors 162 | 163 | ### Code Contributors 164 | 165 | This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)]. 166 | 167 | 168 | ### Financial Contributors 169 | 170 | Become a financial contributor and help us sustain our community. [[Contribute](https://opencollective.com/bootstrap-star-rating/contribute)] 171 | 172 | #### Individuals 173 | 174 | 175 | 176 | #### Organizations 177 | 178 | Support this project with your organization. Your logo will show up here with a link to your website. [[Contribute](https://opencollective.com/bootstrap-star-rating/contribute)] 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | ## License 192 | 193 | **bootstrap-star-rating** is released under the BSD-3-Clause License. See the bundled `LICENSE.md` for details. -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bootstrap-star-rating", 3 | "version": "4.1.3", 4 | "homepage": "https://github.com/kartik-v/bootstrap-star-rating", 5 | "authors": [ 6 | "Kartik Visweswaran " 7 | ], 8 | "description": "A simple yet powerful JQuery star rating plugin for Bootstrap.", 9 | "main": [ 10 | "./css/star-rating.min.css", 11 | "./js/star-rating.min.js" 12 | ], 13 | "keywords": [ 14 | "bootstrap", 15 | "star", 16 | "rating", 17 | "font", 18 | "awesome", 19 | "glyphicon", 20 | "svg" 21 | ], 22 | "dependencies": { 23 | "jquery": ">= 1.9.0", 24 | "bootstrap": ">= 3.0.0" 25 | }, 26 | "ignore": [ 27 | "**/.*", 28 | "node_modules", 29 | "composer.json", 30 | "examples", 31 | "bower_components", 32 | "test", 33 | "tests" 34 | ], 35 | "license": "BSD-3-Clause" 36 | } 37 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "kartik-v/bootstrap-star-rating", 3 | "description": "A simple yet powerful JQuery star rating plugin for Bootstrap.", 4 | "keywords": [ 5 | "bootstrap", 6 | "star", 7 | "rating", 8 | "font", 9 | "awesome", 10 | "glyphicon", 11 | "svg" 12 | ], 13 | "homepage": "https://github.com/kartik-v/bootstrap-star-rating", 14 | "license": "BSD-3-Clause", 15 | "authors": [ 16 | { 17 | "name": "Kartik Visweswaran", 18 | "email": "kartikv2@gmail.com", 19 | "homepage": "http://www.krajee.com/" 20 | } 21 | ], 22 | "extra": { 23 | "branch-alias": { 24 | "dev-master": "4.1.x-dev" 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /css/star-rating.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * bootstrap-star-rating v4.1.3 3 | * http://plugins.krajee.com/star-rating 4 | * 5 | * Author: Kartik Visweswaran 6 | * Copyright: 2013 - 2021, Kartik Visweswaran, Krajee.com 7 | * 8 | * Licensed under the BSD 3-Clause 9 | * https://github.com/kartik-v/bootstrap-star-rating/blob/master/LICENSE.md 10 | */ 11 | .rating-loading { 12 | width: 25px; 13 | height: 25px; 14 | font-size: 0; 15 | color: #fff; 16 | background: transparent url('../img/loading.gif') top left no-repeat; 17 | border: none; 18 | } 19 | 20 | /* 21 | * Stars & Input 22 | */ 23 | .rating-container .rating-stars { 24 | position: relative; 25 | cursor: pointer; 26 | vertical-align: middle; 27 | display: inline-block; 28 | overflow: hidden; 29 | white-space: nowrap; 30 | } 31 | 32 | .rating-container .rating-stars:focus { 33 | outline: 1px dotted; 34 | } 35 | 36 | .rating-input { 37 | position: absolute; 38 | cursor: pointer; 39 | width: 100%; 40 | height: 1px; 41 | bottom: 0; 42 | left: 0; 43 | font-size: 1px; 44 | opacity: 0; 45 | padding: 0; 46 | margin: 0; 47 | outline: none; 48 | pointer-events: none; 49 | border: none; 50 | box-shadow: none; 51 | background: none; 52 | } 53 | 54 | .rating-container.is-display-only .rating-stars { 55 | cursor: default; 56 | } 57 | 58 | .rating-disabled .rating-stars { 59 | cursor: not-allowed; 60 | } 61 | 62 | .rating-container .star { 63 | display: inline-block; 64 | margin: 0 2px; 65 | text-align: center; 66 | } 67 | 68 | .rating-container .empty-stars { 69 | color: #aaa; 70 | } 71 | 72 | .rating-container .filled-stars { 73 | position: absolute; 74 | left: 0; 75 | top: 0; 76 | margin: auto; 77 | color: #fde16d; 78 | white-space: nowrap; 79 | overflow: hidden; 80 | -webkit-text-stroke: 1px #777; 81 | text-shadow: 1px 1px #999; 82 | } 83 | 84 | .rating-rtl { 85 | float: right; 86 | } 87 | 88 | .rating-animate .filled-stars { 89 | transition: width 0.25s ease; 90 | } 91 | 92 | .rating-rtl .filled-stars { 93 | left: auto; 94 | right: 0; 95 | transition: none; 96 | -webkit-transform: matrix(-1, 0, 0, 1, 0, 0); 97 | transform: matrix(-1, 0, 0, 1, 0, 0); 98 | } 99 | 100 | .rating-rtl.is-star .filled-stars { 101 | right: 0.06em; 102 | } 103 | 104 | .rating-rtl.is-heart .empty-stars { 105 | margin-right: 0.07em; 106 | } 107 | 108 | /** 109 | * Clear 110 | */ 111 | .rating-container .clear-rating { 112 | color: #aaa; 113 | cursor: not-allowed; 114 | display: inline-block; 115 | vertical-align: middle; 116 | font-size: 60%; 117 | } 118 | 119 | .clear-rating-active { 120 | cursor: pointer !important; 121 | } 122 | 123 | .clear-rating-active:hover { 124 | color: #843534; 125 | } 126 | 127 | .rating-container .clear-rating { 128 | padding-right: 5px; 129 | } 130 | 131 | /** 132 | * Caption 133 | */ 134 | 135 | /* extend support to BS4 */ 136 | .rating-container .caption .label { 137 | display: inline-block; 138 | padding: .25em .4em; 139 | line-height: 1; 140 | text-align: center; 141 | vertical-align: baseline; 142 | border-radius: .25rem; 143 | } 144 | 145 | .rating-container .caption { 146 | color: #999; 147 | display: inline-block; 148 | vertical-align: middle; 149 | line-height: 1; 150 | } 151 | 152 | .rating-container .caption { 153 | margin-left: 5px; 154 | margin-right: 0; 155 | } 156 | 157 | .rating-rtl .caption { 158 | margin-right: 5px; 159 | margin-left: 0; 160 | } 161 | 162 | /** 163 | * Print 164 | */ 165 | @media print { 166 | .rating-container .clear-rating { 167 | display: none; 168 | } 169 | } 170 | 171 | /** 172 | * Sizes 173 | */ 174 | .rating-xl { 175 | font-size: 48px; 176 | } 177 | .rating-lg { 178 | font-size: 40px; 179 | } 180 | .rating-md { 181 | font-size: 32px; 182 | } 183 | .rating-sm { 184 | font-size: 24px; 185 | } 186 | .rating-xs { 187 | font-size: 16px; 188 | } 189 | 190 | .rating-xl .caption { 191 | font-size: 20px; 192 | } 193 | 194 | .rating-lg .caption { 195 | font-size: 18px; 196 | } 197 | 198 | .rating-md .caption { 199 | font-size: 16px; 200 | } 201 | 202 | .rating-sm .caption { 203 | font-size: 14px; 204 | } 205 | 206 | .rating-xs .caption { 207 | font-size: 12px; 208 | } 209 | 210 | /** 211 | * Caption 212 | */ 213 | .caption-badge { 214 | font-family: Arial, Helvetica, sans-serif; 215 | display: inline-block; 216 | padding: .35em .65em; 217 | font-size: .75em; 218 | font-weight: 700; 219 | line-height: 1; 220 | color: #fff; 221 | text-align: center; 222 | white-space: nowrap; 223 | vertical-align: baseline; 224 | border-radius: .25rem; 225 | } 226 | 227 | .caption-secondary { 228 | background-color: #6c757d; 229 | } 230 | 231 | .caption-danger { 232 | background-color: #dc3545; 233 | } 234 | 235 | .caption-warning { 236 | background-color: #ffc107; 237 | color: #212529; 238 | } 239 | 240 | .caption-info { 241 | background-color: #0dcaf0; 242 | color: #212529; 243 | } 244 | 245 | .caption-primary { 246 | background-color: #0d6efd; 247 | } 248 | 249 | .caption-success { 250 | background-color: #198754; 251 | } -------------------------------------------------------------------------------- /css/star-rating.min.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * bootstrap-star-rating v4.1.3 3 | * http://plugins.krajee.com/star-rating 4 | * 5 | * Author: Kartik Visweswaran 6 | * Copyright: 2013 - 2021, Kartik Visweswaran, Krajee.com 7 | * 8 | * Licensed under the BSD 3-Clause 9 | * https://github.com/kartik-v/bootstrap-star-rating/blob/master/LICENSE.md 10 | */ 11 | .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-stars:focus{outline:dotted 1px}.rating-input{position:absolute;cursor:pointer;width:100%;height:1px;bottom:0;left:0;font-size:1px;opacity:0;padding:0;margin:0;outline:0;pointer-events:none;border:none;box-shadow:none;background:0 0}.caption-badge,.rating-container .caption .label{line-height:1;text-align:center;border-radius:.25rem}.rating-container.is-display-only .rating-stars{cursor:default}.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;vertical-align:baseline}.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}.caption-badge{font-family:Arial,Helvetica,sans-serif;display:inline-block;padding:.35em .65em;font-size:.75em;font-weight:700;color:#fff;white-space:nowrap;vertical-align:baseline}.caption-secondary{background-color:#6c757d}.caption-danger{background-color:#dc3545}.caption-warning{background-color:#ffc107;color:#212529}.caption-info{background-color:#0dcaf0;color:#212529}.caption-primary{background-color:#0d6efd}.caption-success{background-color:#198754} -------------------------------------------------------------------------------- /examples/bs3.html: -------------------------------------------------------------------------------- 1 | 11 | 12 | 13 | 14 | 15 | 16 | Krajee JQuery Plugins - © Kartik 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 | 36 |
37 | 40 | 41 |
42 | 43 |
44 | 45 |
46 | 47 |
48 | 49 |
50 | 51 | 54 | 55 |
56 |
57 | 58 |
59 |
60 | 61 |
62 |
63 | 64 |
65 |
66 | 67 |
68 |
69 | 70 | 73 | 74 |
75 | 76 |
77 | 78 |
79 | 80 |
81 | 82 |
83 | 84 | 87 | 88 |
89 |
90 | 91 |
92 |
93 | 94 |
95 |
96 | 97 |
98 |
99 | 100 |
101 |
102 | 103 | 106 | 107 |
108 | 109 |
110 | 111 |
112 | 113 |
114 | 115 |
116 | 117 | 120 | 121 |
122 |
123 | 124 |
125 |
126 | 127 |
128 |
129 | 130 |
131 |
132 | 133 |
134 |
135 | 136 | 139 | 140 |
141 | 142 |
143 | 144 |
145 | 146 |
147 | 148 |
149 | 150 | 153 | 154 |
155 |
156 | 157 |
158 |
159 | 160 |
161 |
162 | 163 |
164 |
165 | 166 |
167 |
168 | 169 | 172 | 173 |
174 | 175 |
176 | 177 |
178 | 179 |
180 | 181 |
182 | 183 | 186 | 187 |
188 |
189 | 190 |
191 |
192 | 193 |
194 |
195 | 196 |
197 |
198 | 199 |
200 |
201 | 202 | 205 | 207 |
208 | 209 |
210 | 211 |
212 | 213 |
214 | 215 |
216 | 217 | 220 | 221 |
222 |
223 | 224 |
225 |
226 | 227 |
228 |
229 | 230 |
231 |
232 | 233 |
234 |
235 | 236 | 239 | 240 |
241 | 242 |
243 | 244 |
245 | 246 |
247 | 248 |
249 | 250 | 253 | 254 |
255 |
256 | 257 |
258 |
259 | 260 |
261 |
262 | 263 |
264 |
265 | 266 |
267 |
268 | 269 | 272 | 273 |
274 | 275 |
276 | 277 |
278 | 279 |
280 | 281 |
282 | 283 | 286 | 287 |
288 |
289 | 290 |
291 |
292 | 293 |
294 |
295 | 296 |
297 |
298 | 299 |
300 |
301 |
302 |
303 | 304 | 368 | 369 | 370 | 371 | -------------------------------------------------------------------------------- /examples/bs5.html: -------------------------------------------------------------------------------- 1 | 11 | 12 | 13 | 14 | 15 | Krajee JQuery Plugins - © Kartik 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 |

Bootstrap Star Rating Examples 30 | © Kartik Visweswaran, Krajee.com 31 |

32 |
33 |
34 | 36 |
37 |
38 | 39 |
40 |
41 | 43 |
44 | 46 |
47 | 48 |
49 | 51 |
52 | 54 |
55 |
56 | 57 |
58 | 59 | 60 |
61 | 62 |
63 | 64 | 65 | 66 | 67 |
68 |
69 |
70 | 134 |
135 | 136 | 137 | -------------------------------------------------------------------------------- /img/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kartik-v/bootstrap-star-rating/6f8575fe14ca186ff80aa776c4e234fd5b26af83/img/loading.gif -------------------------------------------------------------------------------- /js/locales/LANG.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Star Rating Translations 3 | * 4 | * This file must be loaded after 'star-rating.js'. Patterns in braces '{}', or 5 | * any HTML markup tags in the messages must not be converted or translated. 6 | * 7 | * NOTE: this file must be saved in UTF-8 encoding. 8 | * 9 | * bootstrap-star-rating v4.1.3 10 | * http://plugins.krajee.com/star-rating 11 | * 12 | * Copyright: 2013 - 2021, Kartik Visweswaran, Krajee.com 13 | * 14 | * Licensed under the BSD 3-Clause 15 | * https://github.com/kartik-v/bootstrap-star-rating/blob/master/LICENSE.md 16 | */ 17 | (function (factory) { 18 | 'use strict'; 19 | if (typeof define === 'function' && define.amd) { 20 | define(['jquery'], factory); 21 | } else if (typeof module === 'object' && typeof module.exports === 'object') { 22 | factory(require('jquery')); 23 | } else { 24 | factory(window.jQuery); 25 | } 26 | }(function ($) { 27 | "use strict"; 28 | $.fn.ratingLocales[''] = { 29 | defaultCaption: '{rating} Stars', 30 | starCaptions: { 31 | 0.5: 'Half Star', 32 | 1: 'One Star', 33 | 1.5: 'One & Half Star', 34 | 2: 'Two Stars', 35 | 2.5: 'Two & Half Stars', 36 | 3: 'Three Stars', 37 | 3.5: 'Three & Half Stars', 38 | 4: 'Four Stars', 39 | 4.5: 'Four & Half Stars', 40 | 5: 'Five Stars' 41 | }, 42 | clearButtonTitle: 'Clear', 43 | clearCaption: 'Not Rated' 44 | }; 45 | })); 46 | -------------------------------------------------------------------------------- /js/locales/ar.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Star Rating Arabic Translations 3 | * @author Abdulrahman Zaiter 4 | * 5 | * This file must be loaded after 'star-rating.js'. Patterns in braces '{}', or 6 | * any HTML markup tags in the messages must not be converted or translated. 7 | * 8 | * NOTE: this file must be saved in UTF-8 encoding. 9 | * 10 | * bootstrap-star-rating v4.1.3 11 | * http://plugins.krajee.com/star-rating 12 | * 13 | * Copyright: 2013 - 2021, Kartik Visweswaran, Krajee.com 14 | * 15 | * Licensed under the BSD 3-Clause 16 | * https://github.com/kartik-v/bootstrap-star-rating/blob/master/LICENSE.md 17 | */ 18 | (function (factory) { 19 | 'use strict'; 20 | if (typeof define === 'function' && define.amd) { 21 | define(['jquery'], factory); 22 | } else if (typeof module === 'object' && typeof module.exports === 'object') { 23 | factory(require('jquery')); 24 | } else { 25 | factory(window.jQuery); 26 | } 27 | }(function ($) { 28 | "use strict"; 29 | $.fn.ratingLocales['ar'] = { 30 | defaultCaption: '{rating} نجوم', 31 | starCaptions: { 32 | 0.5: 'نصف نجمة', 33 | 1: 'نجمة واحدة', 34 | 1.5: 'نجمة ونصف', 35 | 2: 'نجمتين', 36 | 2.5: 'نجمتين ونصف', 37 | 3: 'ثلاث نجمات', 38 | 3.5: 'ثلاث نجمات ونصف', 39 | 4: 'أربع نجمات', 40 | 4.5: 'أربع نجمات ونصف', 41 | 5: 'خمسة نجمات' 42 | }, 43 | clearButtonTitle: 'مسح', 44 | clearCaption: 'غير مصنّف' 45 | }; 46 | })); 47 | -------------------------------------------------------------------------------- /js/locales/bn.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Star Rating Bengali Translations 3 | * 4 | * This file must be loaded after 'star-rating.js'. Patterns in braces '{}', or 5 | * any HTML markup tags in the messages must not be converted or translated. 6 | * 7 | * NOTE: this file must be saved in UTF-8 encoding. 8 | * 9 | * bootstrap-star-rating v4.1.3 10 | * http://plugins.krajee.com/star-rating 11 | * 12 | * Copyright: 2013 - 2021, Kartik Visweswaran, Krajee.com 13 | * 14 | * Licensed under the BSD 3-Clause 15 | * https://github.com/kartik-v/bootstrap-star-rating/blob/master/LICENSE.md 16 | */ 17 | (function (factory) { 18 | 'use strict'; 19 | if (typeof define === 'function' && define.amd) { 20 | define(['jquery'], factory); 21 | } else if (typeof module === 'object' && typeof module.exports === 'object') { 22 | factory(require('jquery')); 23 | } else { 24 | factory(window.jQuery); 25 | } 26 | }(function ($) { 27 | "use strict"; 28 | $.fn.ratingLocales['bn'] = { 29 | defaultCaption: '{rating} তারা', 30 | starCaptions: { 31 | 0.5: 'অর্ধেক তারা', 32 | 1: 'এক তারা', 33 | 1.5: 'দেড় তারা', 34 | 2: 'দুই তারা', 35 | 2.5: 'আড়াই তারা', 36 | 3: 'তিন তারা', 37 | 3.5: 'সাড়ে তিন তারা', 38 | 4: 'চার তারা', 39 | 4.5: 'সাড়ে চার তারা', 40 | 5: 'পাঁচ তারা' 41 | }, 42 | clearButtonTitle: 'মুছে ফেলুন', 43 | clearCaption: 'কোন তারা নেই' 44 | }; 45 | })); 46 | -------------------------------------------------------------------------------- /js/locales/de.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Star Rating German Translations 3 | * 4 | * This file must be loaded after 'star-rating.js'. Patterns in braces '{}', or 5 | * any HTML markup tags in the messages must not be converted or translated. 6 | * 7 | * NOTE: this file must be saved in UTF-8 encoding. 8 | * 9 | * bootstrap-star-rating v4.1.3 10 | * http://plugins.krajee.com/star-rating 11 | * 12 | * Copyright: 2013 - 2021, Kartik Visweswaran, Krajee.com 13 | * 14 | * Licensed under the BSD 3-Clause 15 | * https://github.com/kartik-v/bootstrap-star-rating/blob/master/LICENSE.md 16 | */ 17 | (function (factory) { 18 | 'use strict'; 19 | if (typeof define === 'function' && define.amd) { 20 | define(['jquery'], factory); 21 | } else if (typeof module === 'object' && typeof module.exports === 'object') { 22 | factory(require('jquery')); 23 | } else { 24 | factory(window.jQuery); 25 | } 26 | }(function ($) { 27 | "use strict"; 28 | $.fn.ratingLocales['de'] = { 29 | defaultCaption: '{rating} Sterne', 30 | starCaptions: { 31 | 0.5: 'Halber Stern', 32 | 1: 'Ein Stern', 33 | 1.5: 'Eineinhalb Sterne', 34 | 2: 'Zwei Sterne', 35 | 2.5: 'Zweieinhalb Sterne', 36 | 3: 'Drei Sterne', 37 | 3.5: 'Dreieinhalb Sterne', 38 | 4: 'Vier Sterne', 39 | 4.5: 'Viereinhalb Sterne', 40 | 5: 'Fünf Sterne' 41 | }, 42 | clearButtonTitle: 'Zurücksetzen', 43 | clearCaption: 'Nicht bewertet' 44 | }; 45 | })); 46 | -------------------------------------------------------------------------------- /js/locales/es.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Star Rating Spanish Translations 3 | * 4 | * This file must be loaded after 'star-rating.js'. Patterns in braces '{}', or 5 | * any HTML markup tags in the messages must not be converted or translated. 6 | * 7 | * NOTE: this file must be saved in UTF-8 encoding. 8 | * 9 | * bootstrap-star-rating v4.1.3 10 | * http://plugins.krajee.com/star-rating 11 | * 12 | * Copyright: 2013 - 2021, Kartik Visweswaran, Krajee.com 13 | * 14 | * Licensed under the BSD 3-Clause 15 | * https://github.com/kartik-v/bootstrap-star-rating/blob/master/LICENSE.md 16 | */ 17 | (function (factory) { 18 | 'use strict'; 19 | if (typeof define === 'function' && define.amd) { 20 | define(['jquery'], factory); 21 | } else if (typeof module === 'object' && typeof module.exports === 'object') { 22 | factory(require('jquery')); 23 | } else { 24 | factory(window.jQuery); 25 | } 26 | }(function ($) { 27 | "use strict"; 28 | $.fn.ratingLocales.es = { 29 | defaultCaption: '{rating} Estrellas', 30 | starCaptions: { 31 | 0.5: 'Media Estrella', 32 | 1: 'Una Estrella', 33 | 1.5: 'Una Estrella y Media', 34 | 2: 'Dos Estrellas', 35 | 2.5: 'Dos Estrellas y Media', 36 | 3: 'Tres Estrellas', 37 | 3.5: 'Tres Estrellas y Media', 38 | 4: 'Cuatro Estrellas', 39 | 4.5: 'Cuatro Estrellas y Media', 40 | 5: 'Cinco Estrellas' 41 | }, 42 | clearButtonTitle: 'Limpiar', 43 | clearCaption: 'Sin Calificar' 44 | }; 45 | })); -------------------------------------------------------------------------------- /js/locales/fa.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Star Rating Persian / Farsi Translations 3 | * @author Bt Saeed Sajadi (http://saeedsajadi.ir) 4 | * 5 | * This file must be loaded after 'star-rating.js'. Patterns in braces '{}', or 6 | * any HTML markup tags in the messages must not be converted or translated. 7 | * 8 | * NOTE: this file must be saved in UTF-8 encoding. 9 | * 10 | * bootstrap-star-rating v4.1.3 11 | * http://plugins.krajee.com/star-rating 12 | * 13 | * Copyright: 2013 - 2021, Kartik Visweswaran, Krajee.com 14 | * 15 | * Licensed under the BSD 3-Clause 16 | * https://github.com/kartik-v/bootstrap-star-rating/blob/master/LICENSE.md 17 | */ 18 | (function (factory) { 19 | 'use strict'; 20 | if (typeof define === 'function' && define.amd) { 21 | define(['jquery'], factory); 22 | } else if (typeof module === 'object' && typeof module.exports === 'object') { 23 | factory(require('jquery')); 24 | } else { 25 | factory(window.jQuery); 26 | } 27 | }(function ($) { 28 | "use strict"; 29 | $.fn.ratingLocales['fa'] = { 30 | defaultCaption: '{rating} ستاره', 31 | starCaptions: { 32 | 0.5: 'نیم ستاره', 33 | 1: 'یک ستاره', 34 | 1.5: 'یک و نیم ستاره', 35 | 2: 'دو ستاره', 36 | 2.5: 'دو و نیم ستاره', 37 | 3: 'سه ستاره', 38 | 3.5: 'سه و نیم ستاره', 39 | 4: 'چهار ستاره', 40 | 4.5: 'چهار ستاره', 41 | 5: 'پنج ستاره' 42 | }, 43 | clearButtonTitle: 'پاک کردن', 44 | clearCaption: 'بدون رای' 45 | }; 46 | })); 47 | -------------------------------------------------------------------------------- /js/locales/fr.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Star Rating French Translations 3 | * 4 | * This file must be loaded after 'star-rating.js'. Patterns in braces '{}', or 5 | * any HTML markup tags in the messages must not be converted or translated. 6 | * 7 | * NOTE: this file must be saved in UTF-8 encoding. 8 | * 9 | * bootstrap-star-rating v4.1.3 10 | * http://plugins.krajee.com/star-rating 11 | * 12 | * Copyright: 2013 - 2021, Kartik Visweswaran, Krajee.com 13 | * 14 | * Licensed under the BSD 3-Clause 15 | * https://github.com/kartik-v/bootstrap-star-rating/blob/master/LICENSE.md 16 | */ 17 | (function (factory) { 18 | 'use strict'; 19 | if (typeof define === 'function' && define.amd) { 20 | define(['jquery'], factory); 21 | } else if (typeof module === 'object' && typeof module.exports === 'object') { 22 | factory(require('jquery')); 23 | } else { 24 | factory(window.jQuery); 25 | } 26 | }(function ($) { 27 | "use strict"; 28 | $.fn.ratingLocales['fr'] = { 29 | defaultCaption: '{rating} étoiles', 30 | starCaptions: { 31 | 0.5: 'Une demi étoile', 32 | 1: 'Une étoile', 33 | 1.5: 'Une étoile et demi', 34 | 2: 'Deux étoiles', 35 | 2.5: 'Deux étoiles et demi', 36 | 3: 'Trois étoiles', 37 | 3.5: 'Trois étoiles et demi', 38 | 4: 'Quatre étoiles', 39 | 4.5: 'Quatre étoiles et demi', 40 | 5: 'Cinq étoiles' 41 | }, 42 | clearButtonTitle: 'Effacer', 43 | clearCaption: 'Non noté' 44 | }; 45 | })); 46 | -------------------------------------------------------------------------------- /js/locales/gr.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Star Rating Greek Translations 3 | * 4 | * This file must be loaded after 'star-rating.js'. Patterns in braces '{}', or 5 | * any HTML markup tags in the messages must not be converted or translated. 6 | * 7 | * NOTE: this file must be saved in UTF-8 encoding. 8 | * 9 | * bootstrap-star-rating v4.1.3 10 | * http://plugins.krajee.com/star-rating 11 | * 12 | * Copyright: 2013 - 2021, Kartik Visweswaran, Krajee.com 13 | * 14 | * Licensed under the BSD 3-Clause 15 | * https://github.com/kartik-v/bootstrap-star-rating/blob/master/LICENSE.md 16 | */ 17 | (function (factory) { 18 | 'use strict'; 19 | if (typeof define === 'function' && define.amd) { 20 | define(['jquery'], factory); 21 | } else if (typeof module === 'object' && typeof module.exports === 'object') { 22 | factory(require('jquery')); 23 | } else { 24 | factory(window.jQuery); 25 | } 26 | }(function ($) { 27 | "use strict"; 28 | $.fn.ratingLocales.gr = { 29 | defaultCaption: '{rating} Αστέρια', 30 | starCaptions: { 31 | 0.5: 'Μισό Αστέρι', 32 | 1: 'Ένα Αστέρι', 33 | 1.5: 'Ένα Αστέρι και Μισό', 34 | 2: 'Δύο Αστέρια', 35 | 2.5: 'Δύο Αστέρια και Μισό', 36 | 3: 'Τρία Αστέρια', 37 | 3.5: 'Τρία Αστέρια και Μισό', 38 | 4: 'Τέσσερα Αστέρια', 39 | 4.5: 'Τέσσερα Αστέρια και Μισό', 40 | 5: 'Πέντε Αστέρια' 41 | }, 42 | clearButtonTitle: 'Καθαρισμός', 43 | clearCaption: 'Χωρίς Βαθμολογία' 44 | }; 45 | })); 46 | -------------------------------------------------------------------------------- /js/locales/id.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Star Rating Translations 3 | * 4 | * This file must be loaded after 'star-rating.js'. Patterns in braces '{}', or 5 | * any HTML markup tags in the messages must not be converted or translated. 6 | * 7 | * NOTE: this file must be saved in UTF-8 encoding. 8 | * 9 | * bootstrap-star-rating v4.1.3 10 | * http://plugins.krajee.com/star-rating 11 | * 12 | * Copyright: 2013 - 2021, Kartik Visweswaran, Krajee.com 13 | * 14 | * Licensed under the BSD 3-Clause 15 | * https://github.com/kartik-v/bootstrap-star-rating/blob/master/LICENSE.md 16 | */ 17 | (function (factory) { 18 | 'use strict'; 19 | if (typeof define === 'function' && define.amd) { 20 | define(['jquery'], factory); 21 | } else if (typeof module === 'object' && typeof module.exports === 'object') { 22 | factory(require('jquery')); 23 | } else { 24 | factory(window.jQuery); 25 | } 26 | }(function ($) { 27 | "use strict"; 28 | $.fn.ratingLocales['id'] = { 29 | defaultCaption: '{rating} Bintang', 30 | starCaptions: { 31 | 0.5: 'Setengah Bintang', 32 | 1: 'Satu Bintang', 33 | 1.5: 'Satu Setengah Bintang', 34 | 2: 'Dua Bintang', 35 | 2.5: 'Dua Setengah Bintang', 36 | 3: 'Tiga Bintang', 37 | 3.5: 'Tiga Setangah Bintang', 38 | 4: 'Empat Bintang', 39 | 4.5: 'Empat Setangah Bintang', 40 | 5: 'Lima Bintang' 41 | }, 42 | clearButtonTitle: 'Bersihkan', 43 | clearCaption: 'Belum ada penilaian' 44 | }; 45 | })); 46 | -------------------------------------------------------------------------------- /js/locales/it.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Star Rating Italian Translations 3 | * 4 | * This file must be loaded after 'star-rating.js'. Patterns in braces '{}', or 5 | * any HTML markup tags in the messages must not be converted or translated. 6 | * 7 | * NOTE: this file must be saved in UTF-8 encoding. 8 | * 9 | * bootstrap-star-rating v4.1.3 10 | * http://plugins.krajee.com/star-rating 11 | * 12 | * Copyright: 2013 - 2021, Kartik Visweswaran, Krajee.com 13 | * 14 | * Licensed under the BSD 3-Clause 15 | * https://github.com/kartik-v/bootstrap-star-rating/blob/master/LICENSE.md 16 | */ 17 | (function (factory) { 18 | 'use strict'; 19 | if (typeof define === 'function' && define.amd) { 20 | define(['jquery'], factory); 21 | } else if (typeof module === 'object' && typeof module.exports === 'object') { 22 | factory(require('jquery')); 23 | } else { 24 | factory(window.jQuery); 25 | } 26 | }(function ($) { 27 | "use strict"; 28 | $.fn.ratingLocales['it'] = { 29 | defaultCaption: '{rating} Stelle', 30 | starCaptions: { 31 | 0.5: 'Mezza Stella', 32 | 1: 'Una Stella', 33 | 1.5: 'Una Stella & Mezzo', 34 | 2: 'Due Stelle', 35 | 2.5: 'Due Stelle & Mezzo', 36 | 3: 'Tre Stelle', 37 | 3.5: 'Tre Stelle & Mezzo', 38 | 4: 'Quattro Stelle', 39 | 4.5: 'Quattro Stelle & Mezzo', 40 | 5: 'Cinque Stelle' 41 | }, 42 | clearButtonTitle: 'Rimuovi', 43 | clearCaption: 'Nessuna valutazione' 44 | }; 45 | })); 46 | -------------------------------------------------------------------------------- /js/locales/kk.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Star Rating Kazakh Translations 3 | * 4 | * This file must be loaded after 'star-rating.js'. Patterns in braces '{}', or 5 | * any HTML markup tags in the messages must not be converted or translated. 6 | * 7 | * NOTE: this file must be saved in UTF-8 encoding. 8 | * 9 | * bootstrap-star-rating v4.1.3 10 | * http://plugins.krajee.com/star-rating 11 | * 12 | * Copyright: 2013 - 2021, Kartik Visweswaran, Krajee.com 13 | * 14 | * Licensed under the BSD 3-Clause 15 | * https://github.com/kartik-v/bootstrap-star-rating/blob/master/LICENSE.md 16 | */ 17 | (function (factory) { 18 | 'use strict'; 19 | if (typeof define === 'function' && define.amd) { 20 | define(['jquery'], factory); 21 | } else if (typeof module === 'object' && typeof module.exports === 'object') { 22 | factory(require('jquery')); 23 | } else { 24 | factory(window.jQuery); 25 | } 26 | }(function ($) { 27 | "use strict"; 28 | $.fn.ratingLocales['kk'] = { 29 | defaultCaption: '{rating} Жұлдыз', 30 | starCaptions: { 31 | 0.5: 'Жарты жұлдыз', 32 | 1: 'Бір жұлдыз', 33 | 1.5: 'Бір жарым жұлдыз', 34 | 2: 'Екі жұлдыз', 35 | 2.5: 'Екі жарым жұлдыз', 36 | 3: 'Үш жұлдыз', 37 | 3.5: 'Үш жарым жұлдыз', 38 | 4: 'Төрт жұлдыз', 39 | 4.5: 'Төрт жарым жұлдыз', 40 | 5: 'Бес жұлдыз' 41 | }, 42 | clearButtonTitle: 'Өшіру', 43 | clearCaption: 'Рейтингсіз' 44 | }; 45 | })); 46 | -------------------------------------------------------------------------------- /js/locales/ko.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Star Rating Korean Translations 3 | * 4 | * This file must be loaded after 'star-rating.js'. Patterns in braces '{}', or 5 | * any HTML markup tags in the messages must not be converted or translated. 6 | * 7 | * NOTE: this file must be saved in UTF-8 encoding. 8 | * 9 | * bootstrap-star-rating v4.1.3 10 | * http://plugins.krajee.com/star-rating 11 | * 12 | * Copyright: 2013 - 2021, Kartik Visweswaran, Krajee.com 13 | * 14 | * Licensed under the BSD 3-Clause 15 | * https://github.com/kartik-v/bootstrap-star-rating/blob/master/LICENSE.md 16 | */ 17 | (function (factory) { 18 | 'use strict'; 19 | if (typeof define === 'function' && define.amd) { 20 | define(['jquery'], factory); 21 | } else if (typeof module === 'object' && typeof module.exports === 'object') { 22 | factory(require('jquery')); 23 | } else { 24 | factory(window.jQuery); 25 | } 26 | }(function ($) { 27 | "use strict"; 28 | $.fn.ratingLocales['ko'] = { 29 | defaultCaption: '{rating} 별점', 30 | starCaptions: { 31 | 0.5: '0.5 점', 32 | 1: '1 점', 33 | 1.5: '1.5 점', 34 | 2: '2 점', 35 | 2.5: '2.5 점', 36 | 3: '3 점', 37 | 3.5: '3.5 점', 38 | 4: '4 점', 39 | 4.5: '4.5 점', 40 | 5: '5 점' 41 | }, 42 | clearButtonTitle: '초기화', 43 | clearCaption: '평점 없음' 44 | }; 45 | })); 46 | -------------------------------------------------------------------------------- /js/locales/nl.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Star Rating Dutch Translations 3 | * 4 | * This file must be loaded after 'star-rating.js'. Patterns in braces '{}', or 5 | * any HTML markup tags in the messages must not be converted or translated. 6 | * 7 | * NOTE: this file must be saved in UTF-8 encoding. 8 | * 9 | * bootstrap-star-rating v4.1.3 10 | * http://plugins.krajee.com/star-rating 11 | * 12 | * Copyright: 2013 - 2021, Kartik Visweswaran, Krajee.com 13 | * 14 | * Licensed under the BSD 3-Clause 15 | * https://github.com/kartik-v/bootstrap-star-rating/blob/master/LICENSE.md 16 | */ 17 | (function (factory) { 18 | 'use strict'; 19 | if (typeof define === 'function' && define.amd) { 20 | define(['jquery'], factory); 21 | } else if (typeof module === 'object' && typeof module.exports === 'object') { 22 | factory(require('jquery')); 23 | } else { 24 | factory(window.jQuery); 25 | } 26 | }(function ($) { 27 | "use strict"; 28 | $.fn.ratingLocales[''] = { 29 | defaultCaption: '{rating} Sterren', 30 | starCaptions: { 31 | 0.5: 'halve ster', 32 | 1: 'Één ster', 33 | 1.5: 'Anderhalve ster', 34 | 2: 'Twee sterren', 35 | 2.5: 'Twee en een half sterren', 36 | 3: 'Drie sterren', 37 | 3.5: 'Drie en een half sterren', 38 | 4: 'Vier sterren', 39 | 4.5: 'Vier en een half sterren', 40 | 5: 'Vijf sterren' 41 | }, 42 | clearButtonTitle: 'Wissen', 43 | clearCaption: 'Niet beoordeeld' 44 | }; 45 | })); 46 | -------------------------------------------------------------------------------- /js/locales/pl.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Star Rating Polish Translations 3 | * 4 | * This file must be loaded after 'star-rating.js'. Patterns in braces '{}', or 5 | * any HTML markup tags in the messages must not be converted or translated. 6 | * 7 | * NOTE: this file must be saved in UTF-8 encoding. 8 | * 9 | * bootstrap-star-rating v4.1.3 10 | * http://plugins.krajee.com/star-rating 11 | * 12 | * Copyright: 2013 - 2021, Kartik Visweswaran, Krajee.com 13 | * 14 | * Licensed under the BSD 3-Clause 15 | * https://github.com/kartik-v/bootstrap-star-rating/blob/master/LICENSE.md 16 | */ 17 | (function (factory) { 18 | 'use strict'; 19 | if (typeof define === 'function' && define.amd) { 20 | define(['jquery'], factory); 21 | } else if (typeof module === 'object' && typeof module.exports === 'object') { 22 | factory(require('jquery')); 23 | } else { 24 | factory(window.jQuery); 25 | } 26 | }(function ($) { 27 | "use strict"; 28 | $.fn.ratingLocales['pl'] = { 29 | defaultCaption: '{rating} Gwiazdek', 30 | starCaptions: { 31 | 0.5: 'Pół Gwiazdki', 32 | 1: 'Jedna Gwiazdka', 33 | 1.5: 'Półtora Gwiazdek', 34 | 2: 'Dwie Gwiazdki', 35 | 2.5: 'Dwa i pół Gwiazdek', 36 | 3: 'Trzy Gwiazdki', 37 | 3.5: 'Trzy i pół Gwiazdek', 38 | 4: 'Cztery Gwiazdki', 39 | 4.5: 'Cztery i pół Gwiazdek', 40 | 5: 'Pięć Gwiazdek' 41 | }, 42 | clearButtonTitle: 'Powrót', 43 | clearCaption: 'Brak oceny' 44 | }; 45 | })); 46 | -------------------------------------------------------------------------------- /js/locales/pt-BR.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Star Rating Portugese Brazilian Translations 3 | * 4 | * This file must be loaded after 'star-rating.js'. Patterns in braces '{}', or 5 | * any HTML markup tags in the messages must not be converted or translated. 6 | * 7 | * NOTE: this file must be saved in UTF-8 encoding. 8 | * 9 | * bootstrap-star-rating v4.1.3 10 | * http://plugins.krajee.com/star-rating 11 | * 12 | * Copyright: 2013 - 2021, Kartik Visweswaran, Krajee.com 13 | * 14 | * Licensed under the BSD 3-Clause 15 | * https://github.com/kartik-v/bootstrap-star-rating/blob/master/LICENSE.md 16 | */ 17 | (function (factory) { 18 | 'use strict'; 19 | if (typeof define === 'function' && define.amd) { 20 | define(['jquery'], factory); 21 | } else if (typeof module === 'object' && typeof module.exports === 'object') { 22 | factory(require('jquery')); 23 | } else { 24 | factory(window.jQuery); 25 | } 26 | }(function ($) { 27 | "use strict"; 28 | $.fn.ratingLocales['pt-BR'] = { 29 | defaultCaption: '{rating} Estrelas', 30 | starCaptions: { 31 | 0.5: 'Meia Estrela', 32 | 1: 'Uma Estrela', 33 | 1.5: 'Uma Estrela e Meia', 34 | 2: 'Duas Estrelas', 35 | 2.5: 'Duas Estrelas e Meia', 36 | 3: 'Três Estrelas', 37 | 3.5: 'Três Estrelas e Meia', 38 | 4: 'Quatro Estrelas', 39 | 4.5: 'Quatro Estrelas e Meia', 40 | 5: 'Cinco Estrelas' 41 | }, 42 | starTitles: { 43 | 1: 'Uma Estrela', 44 | 2: 'Duas Estrelas', 45 | 3: 'Três Estrelas', 46 | 4: 'Quatro Estrelas', 47 | 5: 'Cinco Estrelas' 48 | }, 49 | clearButtonTitle: 'Limpar', 50 | clearCaption: 'Não Avaliado' 51 | }; 52 | })); 53 | -------------------------------------------------------------------------------- /js/locales/ro.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Star Rating Romanian Translations 3 | * 4 | * This file must be loaded after 'star-rating.js'. Patterns in braces '{}', or 5 | * any HTML markup tags in the messages must not be converted or translated. 6 | * 7 | * NOTE: this file must be saved in UTF-8 encoding. 8 | * 9 | * bootstrap-star-rating v4.1.3 10 | * http://plugins.krajee.com/star-rating 11 | * 12 | * Copyright: 2013 - 2021, Kartik Visweswaran, Krajee.com 13 | * 14 | * Licensed under the BSD 3-Clause 15 | * https://github.com/kartik-v/bootstrap-star-rating/blob/master/LICENSE.md 16 | */ 17 | (function (factory) { 18 | 'use strict'; 19 | if (typeof define === 'function' && define.amd) { 20 | define(['jquery'], factory); 21 | } else if (typeof module === 'object' && typeof module.exports === 'object') { 22 | factory(require('jquery')); 23 | } else { 24 | factory(window.jQuery); 25 | } 26 | }(function ($) { 27 | "use strict"; 28 | $.fn.ratingLocales['ro'] = { 29 | defaultCaption: '{rating} stele', 30 | starCaptions: { 31 | 0.5: 'Jumatate de stea', 32 | 1: 'O Stea', 33 | 1.5: 'O stea si jumatate', 34 | 2: 'Doua stele', 35 | 2.5: 'Doua stele si jumatate', 36 | 3: 'Trei stele', 37 | 3.5: 'Trei stele si jumatate', 38 | 4: 'Patru stele', 39 | 4.5: 'Patru stele si jumatate', 40 | 5: 'Cinci stele' 41 | }, 42 | clearButtonTitle: 'Sterge', 43 | clearCaption: 'Fara vot' 44 | }; 45 | })); 46 | -------------------------------------------------------------------------------- /js/locales/ru.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Star Rating Russian Translations 3 | * 4 | * This file must be loaded after 'star-rating.js'. Patterns in braces '{}', or 5 | * any HTML markup tags in the messages must not be converted or translated. 6 | * 7 | * NOTE: this file must be saved in UTF-8 encoding. 8 | * 9 | * bootstrap-star-rating v4.1.3 10 | * http://plugins.krajee.com/star-rating 11 | * 12 | * Copyright: 2013 - 2021, Kartik Visweswaran, Krajee.com 13 | * 14 | * Licensed under the BSD 3-Clause 15 | * https://github.com/kartik-v/bootstrap-star-rating/blob/master/LICENSE.md 16 | */ 17 | (function (factory) { 18 | 'use strict'; 19 | if (typeof define === 'function' && define.amd) { 20 | define(['jquery'], factory); 21 | } else if (typeof module === 'object' && typeof module.exports === 'object') { 22 | factory(require('jquery')); 23 | } else { 24 | factory(window.jQuery); 25 | } 26 | }(function ($) { 27 | "use strict"; 28 | $.fn.ratingLocales['ru'] = { 29 | defaultCaption: '{rating} Звёзды', 30 | starCaptions: { 31 | 0.5: 'Половина звезды', 32 | 1: 'Одна звезда', 33 | 1.5: 'Полторы звезды', 34 | 2: 'Две звезды', 35 | 2.5: 'Две с половиной звезды', 36 | 3: 'Три звезды', 37 | 3.5: 'Три с половиной звезды', 38 | 4: 'Четыре звезды', 39 | 4.5: 'Четыре с половиной звезды', 40 | 5: 'Пять звёзд' 41 | }, 42 | clearButtonTitle: 'Очистить', 43 | clearCaption: 'Без рейтинга' 44 | }; 45 | })); 46 | -------------------------------------------------------------------------------- /js/locales/tr.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Star Rating Turkish Translations 3 | * @author Oguz Külcü 4 | * 5 | * This file must be loaded after 'star-rating.js'. Patterns in braces '{}', or 6 | * any HTML markup tags in the messages must not be converted or translated. 7 | * 8 | * NOTE: this file must be saved in UTF-8 encoding. 9 | * 10 | * bootstrap-star-rating v4.1.3 11 | * http://plugins.krajee.com/star-rating 12 | * 13 | * Copyright: 2013 - 2021, Kartik Visweswaran, Krajee.com 14 | * 15 | * Licensed under the BSD 3-Clause 16 | * https://github.com/kartik-v/bootstrap-star-rating/blob/master/LICENSE.md 17 | */ 18 | (function (factory) { 19 | 'use strict'; 20 | if (typeof define === 'function' && define.amd) { 21 | define(['jquery'], factory); 22 | } else if (typeof module === 'object' && typeof module.exports === 'object') { 23 | factory(require('jquery')); 24 | } else { 25 | factory(window.jQuery); 26 | } 27 | }(function ($) { 28 | "use strict"; 29 | $.fn.ratingLocales['tr'] = { 30 | defaultCaption: '{rating} Yıldız', 31 | starCaptions: { 32 | 0.5: 'Yarım Yıldız', 33 | 1: 'Tek Yıldız', 34 | 1.5: 'Bir Buçuk Yıldız', 35 | 2: 'İki Yıldız', 36 | 2.5: 'İki Buçuk Yıldız', 37 | 3: 'Üç Yıldız', 38 | 3.5: 'Üç Buçuk Yıldız', 39 | 4: 'Dört Yıldız', 40 | 4.5: 'Dört Buçuk Yıldız', 41 | 5: 'Beş Yıldız' 42 | }, 43 | clearButtonTitle: 'Temizle', 44 | clearCaption: 'Oylanmamış' 45 | }; 46 | })); 47 | -------------------------------------------------------------------------------- /js/locales/ua.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Star Rating Ukranian Translations 3 | * 4 | * This file must be loaded after 'star-rating.js'. Patterns in braces '{}', or 5 | * any HTML markup tags in the messages must not be converted or translated. 6 | * 7 | * NOTE: this file must be saved in UTF-8 encoding. 8 | * 9 | * bootstrap-star-rating v4.1.3 10 | * http://plugins.krajee.com/star-rating 11 | * 12 | * Copyright: 2013 - 2021, Kartik Visweswaran, Krajee.com 13 | * 14 | * Licensed under the BSD 3-Clause 15 | * https://github.com/kartik-v/bootstrap-star-rating/blob/master/LICENSE.md 16 | */ 17 | (function (factory) { 18 | 'use strict'; 19 | if (typeof define === 'function' && define.amd) { 20 | define(['jquery'], factory); 21 | } else if (typeof module === 'object' && typeof module.exports === 'object') { 22 | factory(require('jquery')); 23 | } else { 24 | factory(window.jQuery); 25 | } 26 | }(function ($) { 27 | "use strict"; 28 | $.fn.ratingLocales['ua'] = { 29 | defaultCaption: '{rating} Зірки', 30 | starCaptions: { 31 | 0.5: 'Пів зірки', 32 | 1: 'Одна зірка', 33 | 1.5: 'Півтори зірки', 34 | 2: 'Дві зірки', 35 | 2.5: 'Дві з половиною зірки', 36 | 3: 'Три зірки', 37 | 3.5: 'Три з половиною зірки', 38 | 4: 'Чотири зірки', 39 | 4.5: 'Чотири з половиною зірки', 40 | 5: 'П\'ять зірок' 41 | }, 42 | clearButtonTitle: 'Очистити', 43 | clearCaption: 'Без рейтингу' 44 | }; 45 | })); 46 | -------------------------------------------------------------------------------- /js/locales/zh.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Star Rating Chinese Translations 3 | * 4 | * This file must be loaded after 'star-rating.js'. Patterns in braces '{}', or 5 | * any HTML markup tags in the messages must not be converted or translated. 6 | * 7 | * NOTE: this file must be saved in UTF-8 encoding. 8 | * 9 | * bootstrap-star-rating v4.1.3 10 | * http://plugins.krajee.com/star-rating 11 | * 12 | * Copyright: 2013 - 2021, Kartik Visweswaran, Krajee.com 13 | * 14 | * Licensed under the BSD 3-Clause 15 | * https://github.com/kartik-v/bootstrap-star-rating/blob/master/LICENSE.md 16 | */ 17 | (function (factory) { 18 | 'use strict'; 19 | if (typeof define === 'function' && define.amd) { 20 | define(['jquery'], factory); 21 | } else if (typeof module === 'object' && typeof module.exports === 'object') { 22 | factory(require('jquery')); 23 | } else { 24 | factory(window.jQuery); 25 | } 26 | }(function ($) { 27 | "use strict"; 28 | $.fn.ratingLocales['zh'] = { 29 | defaultCaption: '{rating} 星', 30 | starCaptions: { 31 | 0.5: '半星', 32 | 1: '一星', 33 | 1.5: '一星半', 34 | 2: '二星', 35 | 2.5: '二星半', 36 | 3: '三星', 37 | 3.5: '三星半', 38 | 4: '四星', 39 | 4.5: '四星半', 40 | 5: '五星' 41 | }, 42 | clearButtonTitle: '清除', 43 | clearCaption: '未评级' 44 | }; 45 | })); 46 | -------------------------------------------------------------------------------- /js/star-rating.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * bootstrap-star-rating v4.1.3 3 | * http://plugins.krajee.com/star-rating 4 | * 5 | * Author: Kartik Visweswaran 6 | * Copyright: 2013 - 2021, Kartik Visweswaran, Krajee.com 7 | * 8 | * Licensed under the BSD 3-Clause 9 | * https://github.com/kartik-v/bootstrap-star-rating/blob/master/LICENSE.md 10 | */ 11 | (function (factory) { 12 | 'use strict'; 13 | if (typeof define === 'function' && define.amd) { 14 | define(['jquery'], factory); 15 | } else if (typeof module === 'object' && typeof module.exports === 'object') { 16 | factory(require('jquery')); 17 | } else { 18 | factory(window.jQuery); 19 | } 20 | }(function ($) { 21 | 'use strict'; 22 | 23 | $.fn.ratingLocales = {}; 24 | $.fn.ratingThemes = {}; 25 | 26 | var $h, Rating; 27 | 28 | // Global helper methods and constants 29 | $h = { 30 | NAMESPACE: '.rating', 31 | DEFAULT_MIN: 0, 32 | DEFAULT_MAX: 5, 33 | DEFAULT_STEP: 0.5, 34 | isEmpty: function (value, trim) { 35 | return value === null || value === undefined || value.length === 0 || (trim && $.trim(value) === ''); 36 | }, 37 | getCss: function (condition, css) { 38 | return condition ? ' ' + css : ''; 39 | }, 40 | addCss: function ($el, css) { 41 | $el.removeClass(css).addClass(css); 42 | }, 43 | getDecimalPlaces: function (num) { 44 | var m = ('' + num).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/); 45 | return !m ? 0 : Math.max(0, (m[1] ? m[1].length : 0) - (m[2] ? +m[2] : 0)); 46 | }, 47 | applyPrecision: function (val, precision) { 48 | return parseFloat(val.toFixed(precision)); 49 | }, 50 | handler: function ($el, event, callback, skipOff, skipNS) { 51 | var ev = skipNS ? event : event.split(' ').join($h.NAMESPACE + ' ') + $h.NAMESPACE; 52 | if (!skipOff) { 53 | $el.off(ev); 54 | } 55 | $el.on(ev, function (e) { 56 | var cb = $.proxy(callback, self); 57 | cb(e); 58 | }); 59 | } 60 | }; 61 | 62 | // Rating constructor 63 | Rating = function (element, options) { 64 | var self = this; 65 | self.$element = $(element); 66 | self._init(options); 67 | }; 68 | 69 | // Rating prototype 70 | Rating.prototype = { 71 | constructor: Rating, 72 | _parseAttr: function (vattr, options) { 73 | var self = this, $el = self.$element, elType = $el.attr('type'), finalVal, val, chk, out; 74 | if (elType === 'range' || elType === 'number') { 75 | val = options[vattr] || $el.data(vattr) || $el.attr(vattr); 76 | switch (vattr) { 77 | case 'min': 78 | chk = $h.DEFAULT_MIN; 79 | break; 80 | case 'max': 81 | chk = $h.DEFAULT_MAX; 82 | break; 83 | default: 84 | chk = $h.DEFAULT_STEP; 85 | } 86 | finalVal = $h.isEmpty(val) ? chk : val; 87 | out = parseFloat(finalVal); 88 | } else { 89 | out = parseFloat(options[vattr]); 90 | } 91 | return isNaN(out) ? chk : out; 92 | }, 93 | _parseValue: function (val) { 94 | var self = this, v = parseFloat(val); 95 | if (isNaN(v)) { 96 | v = self.clearValue; 97 | } 98 | return (self.zeroAsNull && (v === 0 || v === '0') ? null : v); 99 | }, 100 | _setDefault: function (key, val) { 101 | var self = this; 102 | if ($h.isEmpty(self[key])) { 103 | self[key] = val; 104 | } 105 | }, 106 | _initSlider: function (options) { 107 | var self = this, v = self.$element.val(); 108 | self.initialValue = $h.isEmpty(v) ? 0 : v; 109 | self._setDefault('min', self._parseAttr('min', options)); 110 | self._setDefault('max', self._parseAttr('max', options)); 111 | self._setDefault('step', self._parseAttr('step', options)); 112 | if (isNaN(self.min) || $h.isEmpty(self.min)) { 113 | self.min = $h.DEFAULT_MIN; 114 | } 115 | if (isNaN(self.max) || $h.isEmpty(self.max)) { 116 | self.max = $h.DEFAULT_MAX; 117 | } 118 | if (isNaN(self.step) || $h.isEmpty(self.step) || self.step === 0) { 119 | self.step = $h.DEFAULT_STEP; 120 | } 121 | self.diff = self.max - self.min; 122 | self._setDefault('minThreshold', self.min); 123 | if (self.minThreshold < self.min) { 124 | self.minThreshold = self.min; 125 | } 126 | if (self.minThreshold > self.max) { 127 | self.minThreshold = self.max; 128 | } 129 | }, 130 | _initHighlight: function (v) { 131 | var self = this, w, cap = self._getCaption(); 132 | if (!v) { 133 | v = self.$element.val(); 134 | } 135 | w = self.getWidthFromValue(v) + '%'; 136 | self.$filledStars.width(w); 137 | self.cache = {caption: cap, width: w, val: v}; 138 | }, 139 | _getContainerCss: function () { 140 | var self = this; 141 | return 'rating-container' + 142 | $h.getCss(self.theme, 'theme-' + self.theme) + 143 | $h.getCss(self.rtl, 'rating-rtl') + 144 | $h.getCss(self.size, 'rating-' + self.size) + 145 | $h.getCss(self.animate, 'rating-animate') + 146 | $h.getCss(self.disabled || self.readonly, 'rating-disabled') + 147 | $h.getCss(self.containerClass, self.containerClass) + 148 | (self.displayOnly ? ' is-display-only' : ''); 149 | 150 | }, 151 | _checkDisabled: function () { 152 | var self = this, $el = self.$element, opts = self.options; 153 | self.disabled = opts.disabled === undefined ? $el.attr('disabled') || false : opts.disabled; 154 | self.readonly = opts.readonly === undefined ? $el.attr('readonly') || false : opts.readonly; 155 | self.inactive = (self.disabled || self.readonly); 156 | $el.attr({disabled: self.disabled, readonly: self.readonly}); 157 | }, 158 | _addContent: function (type, content) { 159 | var self = this, $container = self.$container, isClear = type === 'clear'; 160 | if (self.rtl) { 161 | return isClear ? $container.append(content) : $container.prepend(content); 162 | } else { 163 | return isClear ? $container.prepend(content) : $container.append(content); 164 | } 165 | }, 166 | _generateRating: function () { 167 | var self = this, $el = self.$element, $rating, $container, w; 168 | $container = self.$container = $(document.createElement('div')).insertBefore($el); 169 | $h.addCss($container, self._getContainerCss()); 170 | self.$rating = $rating = $(document.createElement('div')).attr('class', 'rating-stars').appendTo($container) 171 | .append(self._getStars('empty')).append(self._getStars('filled')); 172 | if (self.keyboardEnabled) { 173 | self.$rating.attr('tabindex', self.tabindex); 174 | } 175 | self.$emptyStars = $rating.find('.empty-stars'); 176 | self.$filledStars = $rating.find('.filled-stars'); 177 | self._renderCaption(); 178 | self._renderClear(); 179 | self._initHighlight(); 180 | self._initStarTitles(); 181 | var i = 1; 182 | if (self.rtl) { 183 | w = Math.max(self.$emptyStars.outerWidth(), self.$filledStars.outerWidth()); 184 | self.$emptyStars.width(w); 185 | } 186 | $container.insertBefore($el); 187 | }, 188 | _getCaption: function () { 189 | var self = this; 190 | return self.$caption && self.$caption.length ? self.$caption.html() : self.defaultCaption; 191 | }, 192 | _setCaption: function (content) { 193 | var self = this; 194 | if (self.$caption && self.$caption.length) { 195 | self.$caption.html(content); 196 | } 197 | }, 198 | _renderCaption: function () { 199 | var self = this, val = self.$element.val(), html, $cap = self.captionElement ? $(self.captionElement) : ''; 200 | if (!self.showCaption) { 201 | return; 202 | } 203 | html = self.fetchCaption(val); 204 | if ($cap && $cap.length) { 205 | $h.addCss($cap, 'caption'); 206 | $cap.html(html); 207 | self.$caption = $cap; 208 | return; 209 | } 210 | self._addContent('caption', '
' + html + '
'); 211 | self.$caption = self.$container.find('.caption'); 212 | }, 213 | _renderClear: function () { 214 | var self = this, css, $clr = self.clearElement ? $(self.clearElement) : ''; 215 | if (!self.showClear) { 216 | return; 217 | } 218 | css = self._getClearClass(); 219 | if ($clr.length) { 220 | $h.addCss($clr, css); 221 | $clr.attr({'title': self.clearButtonTitle}).html(self.clearButton); 222 | self.$clear = $clr; 223 | return; 224 | } 225 | self._addContent('clear', 226 | '
' + self.clearButton + '
'); 227 | self.$clear = self.$container.find('.' + self.clearButtonBaseClass); 228 | }, 229 | _getClearClass: function () { 230 | var self = this; 231 | return self.clearButtonBaseClass + ' ' + (self.inactive ? '' : self.clearButtonActiveClass); 232 | }, 233 | _toggleHover: function (out) { 234 | var self = this, w, width, caption; 235 | if (!out) { 236 | return; 237 | } 238 | if (self.hoverChangeStars) { 239 | w = self.getWidthFromValue(self.clearValue); 240 | width = out.val <= self.clearValue ? w + '%' : out.width; 241 | self.$filledStars.css('width', width); 242 | } 243 | if (self.hoverChangeCaption) { 244 | caption = out.val <= self.clearValue ? self.fetchCaption(self.clearValue) : out.caption; 245 | if (caption) { 246 | self._setCaption(caption + ''); 247 | } 248 | } 249 | }, 250 | _init: function (options) { 251 | var self = this, $el = self.$element.attr('tabindex', -1).addClass('rating-input'), v, 252 | m = self.minThreshold; 253 | self.options = options; 254 | $.each(options, function (key, value) { 255 | self[key] = value; 256 | }); 257 | if (self.rtl || $el.attr('dir') === 'rtl') { 258 | self.rtl = true; 259 | $el.attr('dir', 'rtl'); 260 | } 261 | self.starClicked = false; 262 | self.clearClicked = false; 263 | self._initSlider(options); 264 | self._checkDisabled(); 265 | if (self.displayOnly) { 266 | self.inactive = true; 267 | self.showClear = false; 268 | self.hoverEnabled = false; 269 | self.hoverChangeCaption = false; 270 | self.hoverChangeStars = false; 271 | } 272 | self._generateRating(); 273 | self._initEvents(); 274 | self._listen(); 275 | if (!$h.isEmpty(m) && ($h.isEmpty($el.val()) || $el.val() < m)) { 276 | $el.val(m); 277 | } 278 | v = self._parseValue($el.val()); 279 | $el.val(v); 280 | return $el.removeClass('rating-loading'); 281 | }, 282 | _initCaptionTitle: function () { 283 | var self = this, caption; 284 | caption = self.fetchCaption(self.$element.val()); 285 | self.$rating.attr('title', $(caption).text()); 286 | }, 287 | _trigChange: function (params) { 288 | var self = this; 289 | self._initStarTitles(); 290 | self.$element.trigger('change').trigger('rating:change', params); 291 | }, 292 | _initEvents: function () { 293 | var self = this; 294 | self.events = { 295 | _getTouchPosition: function (e) { 296 | var pageX = $h.isEmpty(e.pageX) ? e.originalEvent.touches[0].pageX : e.pageX; 297 | return pageX - self.$rating.offset().left; 298 | }, 299 | _listenClick: function (e, callback) { 300 | e.stopPropagation(); 301 | e.preventDefault(); 302 | if (e.handled !== true) { 303 | callback(e); 304 | e.handled = true; 305 | } else { 306 | return false; 307 | } 308 | }, 309 | _noMouseAction: function (e) { 310 | return !self.mouseEnabled || !self.hoverEnabled || self.inactive || (e && e.isDefaultPrevented()); 311 | }, 312 | initTouch: function (e) { 313 | //noinspection JSUnresolvedVariable 314 | var ev, touches, pos, out, caption, w, width, params, clrVal = self.clearValue || 0, 315 | isTouchCapable = 'ontouchstart' in window || 316 | (window.DocumentTouch && document instanceof window.DocumentTouch); 317 | if (!isTouchCapable || self.inactive) { 318 | return; 319 | } 320 | ev = e.originalEvent; 321 | //noinspection JSUnresolvedVariable 322 | touches = !$h.isEmpty(ev.touches) ? ev.touches : ev.changedTouches; 323 | pos = self.events._getTouchPosition(touches[0]); 324 | if (e.type === 'touchend') { 325 | self._setStars(pos); 326 | params = [self.$element.val(), self._getCaption()]; 327 | self._trigChange(params); 328 | self.starClicked = true; 329 | } else { 330 | out = self.calculate(pos); 331 | caption = out.val <= clrVal ? self.fetchCaption(clrVal) : out.caption; 332 | w = self.getWidthFromValue(clrVal); 333 | width = out.val <= clrVal ? w + '%' : out.width; 334 | self._setCaption(caption); 335 | self.$filledStars.css('width', width); 336 | } 337 | }, 338 | starClick: function (e) { 339 | var pos, params; 340 | self.events._listenClick(e, function (ev) { 341 | if (self.inactive) { 342 | return false; 343 | } 344 | pos = self.events._getTouchPosition(ev); 345 | self._setStars(pos); 346 | params = [self.$element.val(), self._getCaption()]; 347 | self._trigChange(params); 348 | self.starClicked = true; 349 | }); 350 | }, 351 | clearClick: function (e) { 352 | self.events._listenClick(e, function () { 353 | if (!self.inactive) { 354 | self.clear(); 355 | self.clearClicked = true; 356 | } 357 | }); 358 | }, 359 | starMouseMove: function (e) { 360 | var pos, out; 361 | if (self.events._noMouseAction(e)) { 362 | return; 363 | } 364 | self.starClicked = false; 365 | pos = self.events._getTouchPosition(e); 366 | out = self.calculate(pos); 367 | self._toggleHover(out); 368 | self.$element.trigger('rating:hover', [out.val, out.caption, 'stars']); 369 | }, 370 | starMouseLeave: function (e) { 371 | var out; 372 | if (self.events._noMouseAction(e) || self.starClicked) { 373 | return; 374 | } 375 | out = self.cache; 376 | self._toggleHover(out); 377 | self.$element.trigger('rating:hoverleave', ['stars']); 378 | }, 379 | clearMouseMove: function (e) { 380 | var caption, val, width, out; 381 | if (self.events._noMouseAction(e) || !self.hoverOnClear) { 382 | return; 383 | } 384 | self.clearClicked = false; 385 | caption = '' + self.clearCaption + ''; 386 | val = self.clearValue; 387 | width = self.getWidthFromValue(val) || 0; 388 | out = {caption: caption, width: width, val: val}; 389 | self._toggleHover(out); 390 | self.$element.trigger('rating:hover', [val, caption, 'clear']); 391 | }, 392 | clearMouseLeave: function (e) { 393 | var out; 394 | if (self.events._noMouseAction(e) || self.clearClicked || !self.hoverOnClear) { 395 | return; 396 | } 397 | out = self.cache; 398 | self._toggleHover(out); 399 | self.$element.trigger('rating:hoverleave', ['clear']); 400 | }, 401 | resetForm: function (e) { 402 | if (e && e.isDefaultPrevented()) { 403 | return; 404 | } 405 | if (!self.inactive) { 406 | self.reset(); 407 | } 408 | }, 409 | focus: function (e) { 410 | self.$rating.focus(); 411 | self.$element.trigger('rating:focus'); 412 | }, 413 | blur: function (e) { 414 | self.$element.trigger('rating:blur'); 415 | }, 416 | keydown: function (e) { 417 | if (self.inactive || !self.keyboardEnabled) { 418 | return; 419 | } 420 | var $el = self.$element, v = $el.val(), isUpdated = false, step = parseFloat(self.step), 421 | precision = $h.getDecimalPlaces(step), upKey = self.rtl ? 37 : 39, dnKey = self.rtl ? 39 : 37, 422 | val = v ? parseFloat(v) : 0, key = parseInt(e.which || e.keyCode || 0, 10); 423 | if (key === upKey && val < self.max) { // key right (increase) 424 | val += step; 425 | isUpdated = true; 426 | } 427 | if (key === dnKey && val > self.minThreshold) { // key left (decrease) 428 | val -= step; 429 | isUpdated = true 430 | } 431 | if (isUpdated) { 432 | val = $h.applyPrecision(val, precision); 433 | $el.val(val); 434 | self._trigChange([val, self._getCaption()]) 435 | self.showStars($el.val()); 436 | self.$rating.focus(); 437 | } 438 | if (key === 37 || key === 39) { 439 | $el.trigger('rating:keydown', [val, self._getCaption()]); 440 | } 441 | 442 | } 443 | }; 444 | }, 445 | _listen: function () { 446 | var self = this, $el = self.$element, $form = $el.closest('form'), $rating = self.$rating, 447 | $clear = self.$clear, events = self.events, ns = $h.NAMESPACE, 448 | mouseEvents = 'mouseenter' + ns + ' mouseleave' + ns, $stars = self.$rating.find('.star'); 449 | $h.handler($rating, 'touchstart touchmove touchend', events.initTouch); 450 | $h.handler($rating, 'click touchstart', events.starClick); 451 | $h.handler($rating, 'mousemove', events.starMouseMove); 452 | $h.handler($rating, 'mouseleave', events.starMouseLeave); 453 | $h.handler($rating, 'keydown', events.keydown); 454 | $h.handler($rating, 'blur', events.blur); 455 | if (self.showClear && $clear.length) { 456 | $h.handler($clear, 'click touchstart', events.clearClick); 457 | $h.handler($clear, 'mousemove', events.clearMouseMove); 458 | $h.handler($clear, 'mouseleave', events.clearMouseLeave); 459 | } 460 | if ($form.length) { 461 | $h.handler($form, 'reset', events.resetForm, true); 462 | } 463 | $stars.off(mouseEvents).on(mouseEvents, function (e) { 464 | var $star = $(this), index = $star.index(), status = $star.parent().attr('class').slice(0, -1); 465 | self.$element.trigger('rating:' + e.type, [index + 1, status, $star]); 466 | }); 467 | $h.handler(self.$container, 'click', events.focus); 468 | return $el; 469 | }, 470 | _getStars: function (type) { 471 | var self = this, stars = '', i; 472 | for (i = 1; i <= self.stars; i++) { 473 | stars += '' + self[type + 'Star'] + ''; 474 | } 475 | return stars + ''; 476 | }, 477 | _initStarTitles: function (val) { 478 | var self = this; 479 | if (self.showCaptionAsTitle) { 480 | self._initCaptionTitle(); 481 | return; 482 | } 483 | var starTitles = self.starTitles, setTitles; 484 | setTitles = function ($stars) { 485 | var i = 1, title; 486 | $stars.each(function () { 487 | var $star = $(this), j, title; 488 | if (typeof starTitles === 'function') { 489 | j = i === Math.floor(val) ? val : i; 490 | title = starTitles(j); 491 | } else { 492 | title = starTitles[i]; 493 | } 494 | if (title) { 495 | $star.attr({title: title}); 496 | } 497 | i++; 498 | }); 499 | }; 500 | setTitles(self.$emptyStars.find('.star')); 501 | setTitles(self.$filledStars.find('.star')); 502 | }, 503 | _setStars: function (pos) { 504 | var self = this, out = arguments.length ? self.calculate(pos) : self.calculate(), $el = self.$element, 505 | v = self._parseValue(out.val); 506 | $el.val(v); 507 | self.$filledStars.css('width', out.width); 508 | self._setCaption(out.caption); 509 | self.cache = out; 510 | self._initStarTitles(v); 511 | return $el; 512 | }, 513 | showStars: function (val) { 514 | var self = this, v = self._parseValue(val); 515 | self.$element.val(v); 516 | return self._setStars(); 517 | }, 518 | calculate: function (pos) { 519 | var self = this, defaultVal = $h.isEmpty(self.$element.val()) ? 0 : self.$element.val(), 520 | val = arguments.length ? self.getValueFromPosition(pos) : defaultVal, 521 | caption = self.fetchCaption(val), width = self.getWidthFromValue(val); 522 | width += '%'; 523 | return {caption: caption, width: width, val: val}; 524 | }, 525 | getValueFromPosition: function (pos) { 526 | var self = this, precision = $h.getDecimalPlaces(self.step), val, factor, maxWidth = self.$rating.width(); 527 | factor = (self.diff * pos) / (maxWidth * self.step); 528 | factor = self.rtl ? Math.floor(factor) : Math.ceil(factor); 529 | val = $h.applyPrecision(parseFloat(self.min + factor * self.step), precision); 530 | val = Math.max(Math.min(val, self.max), self.minThreshold); 531 | return self.rtl ? (self.max - val) : val; 532 | }, 533 | getWidthFromValue: function (val) { 534 | var self = this, min = self.min, max = self.max, factor, $r = self.$emptyStars, w; 535 | if (!val || val <= self.min || min === max) { 536 | return 0; 537 | } 538 | val = Math.max(val, self.minThreshold); 539 | w = $r.outerWidth(); 540 | factor = w ? $r.width() / w : 1; 541 | if (val >= max) { 542 | return 100; 543 | } 544 | return (val - min) * factor * 100 / (max - min); 545 | }, 546 | fetchCaption: function (rating) { 547 | var self = this, val = parseFloat(rating) || self.clearValue, css, cap, capVal, cssVal, caption, 548 | vCap = self.starCaptions, vCss = self.starCaptionClasses, width = self.getWidthFromValue(val); 549 | if (val && val !== self.clearValue) { 550 | val = $h.applyPrecision(val, $h.getDecimalPlaces(self.step)); 551 | } 552 | cssVal = typeof vCss === 'function' ? vCss(val, width) : vCss[val]; 553 | capVal = typeof vCap === 'function' ? vCap(val, width) : vCap[val]; 554 | 555 | cap = $h.isEmpty(capVal) ? self.defaultCaption.replace(/\{rating}/g, val) : capVal; 556 | css = $h.isEmpty(cssVal) ? self.clearCaptionClass : cssVal; 557 | caption = (val === self.clearValue) ? self.clearCaption : cap; 558 | return '' + caption + ''; 559 | }, 560 | destroy: function () { 561 | var self = this, $el = self.$element; 562 | if (!$h.isEmpty(self.$container)) { 563 | self.$container.before($el).remove(); 564 | } 565 | $.removeData($el.get(0)); 566 | return $el.off('rating').removeClass('rating rating-input'); 567 | }, 568 | create: function (options) { 569 | var self = this, opts = options || self.options || {}; 570 | return self.destroy().rating(opts); 571 | }, 572 | clear: function () { 573 | var self = this, title = '' + self.clearCaption + ''; 574 | if (!self.inactive) { 575 | self._setCaption(title); 576 | } 577 | return self.showStars(self.clearValue).trigger('change').trigger('rating:clear'); 578 | }, 579 | reset: function () { 580 | var self = this; 581 | return self.showStars(self.initialValue).trigger('rating:reset'); 582 | }, 583 | update: function (val) { 584 | var self = this; 585 | return arguments.length ? self.showStars(val) : self.$element; 586 | }, 587 | refresh: function (options) { 588 | var self = this, $el = self.$element; 589 | if (!options) { 590 | return $el; 591 | } 592 | return self.destroy().rating($.extend(true, self.options, options)).trigger('rating:refresh'); 593 | } 594 | }; 595 | 596 | $.fn.rating = function (option) { 597 | var args = Array.apply(null, arguments), retvals = []; 598 | args.shift(); 599 | this.each(function () { 600 | var self = $(this), data = self.data('rating'), options = typeof option === 'object' && option, 601 | theme = options.theme || self.data('theme'), lang = options.language || self.data('language') || 'en', 602 | thm = {}, loc = {}, opts; 603 | if (!data) { 604 | if (theme) { 605 | thm = $.fn.ratingThemes[theme] || {}; 606 | } 607 | if (lang !== 'en' && !$h.isEmpty($.fn.ratingLocales[lang])) { 608 | loc = $.fn.ratingLocales[lang]; 609 | } 610 | opts = $.extend(true, {}, $.fn.rating.defaults, thm, $.fn.ratingLocales.en, loc, options, self.data()); 611 | data = new Rating(this, opts); 612 | self.data('rating', data); 613 | } 614 | 615 | if (typeof option === 'string') { 616 | retvals.push(data[option].apply(data, args)); 617 | } 618 | }); 619 | switch (retvals.length) { 620 | case 0: 621 | return this; 622 | case 1: 623 | return retvals[0] === undefined ? this : retvals[0]; 624 | default: 625 | return retvals; 626 | } 627 | }; 628 | 629 | $.fn.rating.defaults = { 630 | theme: 'krajee-svg', 631 | language: 'en', 632 | stars: 5, 633 | tabindex: 0, 634 | keyboardEnabled: true, 635 | mouseEnabled: true, 636 | containerClass: '', 637 | size: 'md', 638 | animate: true, 639 | displayOnly: false, 640 | rtl: false, 641 | showClear: true, 642 | showCaption: true, 643 | starCaptionClasses: { 644 | 0.5: 'caption-badge caption-danger', 645 | 1: 'caption-badge caption-danger', 646 | 1.5: 'caption-badge caption-warning', 647 | 2: 'caption-badge caption-warning', 648 | 2.5: 'caption-badge caption-info', 649 | 3: 'caption-badge caption-info', 650 | 3.5: 'caption-badge caption-primary', 651 | 4: 'caption-badge caption-primary', 652 | 4.5: 'caption-badge caption-success', 653 | 5: 'caption-badge caption-success' 654 | }, 655 | filledStar: '', // krajee-svg theme 656 | emptyStar: '', // krajee-svg theme 657 | clearButton: '', // krajee-svg theme 658 | clearButtonBaseClass: 'clear-rating', 659 | clearButtonActiveClass: 'clear-rating-active', 660 | clearCaptionClass: 'caption-badge caption-secondary', 661 | clearValue: null, 662 | captionElement: null, 663 | clearElement: null, 664 | showCaptionAsTitle: false, 665 | hoverEnabled: true, 666 | hoverChangeCaption: true, 667 | hoverChangeStars: true, 668 | hoverOnClear: true, 669 | zeroAsNull: true 670 | }; 671 | 672 | $.fn.ratingLocales.en = { 673 | defaultCaption: '{rating} Stars', 674 | starCaptions: { 675 | 0.5: 'Half Star', 676 | 1: 'One Star', 677 | 1.5: 'One & Half Star', 678 | 2: 'Two Stars', 679 | 2.5: 'Two & Half Stars', 680 | 3: 'Three Stars', 681 | 3.5: 'Three & Half Stars', 682 | 4: 'Four Stars', 683 | 4.5: 'Four & Half Stars', 684 | 5: 'Five Stars' 685 | }, 686 | starTitles: { 687 | 1: 'One Star', 688 | 2: 'Two Stars', 689 | 3: 'Three Stars', 690 | 4: 'Four Stars', 691 | 5: 'Five Stars' 692 | }, 693 | clearButtonTitle: 'Clear', 694 | clearCaption: 'Not Rated' 695 | }; 696 | 697 | $.fn.rating.Constructor = Rating; 698 | 699 | /** 700 | * Convert automatically inputs with class 'rating' into Krajee's star rating control. 701 | */ 702 | $(document).ready(function () { 703 | var $input = $('input.rating'); 704 | if ($input.length) { 705 | $input.removeClass('rating-loading').addClass('rating-loading').rating(); 706 | } 707 | }); 708 | })); 709 | -------------------------------------------------------------------------------- /js/star-rating.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * bootstrap-star-rating v4.1.3 3 | * http://plugins.krajee.com/star-rating 4 | * 5 | * Author: Kartik Visweswaran 6 | * Copyright: 2013 - 2021, Kartik Visweswaran, Krajee.com 7 | * 8 | * Licensed under the BSD 3-Clause 9 | * https://github.com/kartik-v/bootstrap-star-rating/blob/master/LICENSE.md 10 | */ 11 | !function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],t):t("object"==typeof module&&"object"==typeof module.exports?require("jquery"):window.jQuery)}(function(t){"use strict";t.fn.ratingLocales={},t.fn.ratingThemes={};var e,a;e={NAMESPACE:".rating",DEFAULT_MIN:0,DEFAULT_MAX:5,DEFAULT_STEP:.5,isEmpty:function(e,a){return null===e||void 0===e||0===e.length||a&&""===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(a,n,i,r,s){var o=s?n:n.split(" ").join(e.NAMESPACE+" ")+e.NAMESPACE;r||a.off(o),a.on(o,function(e){var a=t.proxy(i,self);a(e)})}},a=function(e,a){var n=this;n.$element=t(e),n._init(a)},a.prototype={constructor:a,_parseAttr:function(t,a){var n,i,r,s,o=this,l=o.$element,c=l.attr("type");if("range"===c||"number"===c){switch(i=a[t]||l.data(t)||l.attr(t),t){case"min":r=e.DEFAULT_MIN;break;case"max":r=e.DEFAULT_MAX;break;default:r=e.DEFAULT_STEP}n=e.isEmpty(i)?r:i,s=parseFloat(n)}else s=parseFloat(a[t]);return isNaN(s)?r:s},_parseValue:function(t){var e=this,a=parseFloat(t);return isNaN(a)&&(a=e.clearValue),!e.zeroAsNull||0!==a&&"0"!==a?a:null},_setDefault:function(t,a){var n=this;e.isEmpty(n[t])&&(n[t]=a)},_initSlider:function(t){var a=this,n=a.$element.val();a.initialValue=e.isEmpty(n)?0:n,a._setDefault("min",a._parseAttr("min",t)),a._setDefault("max",a._parseAttr("max",t)),a._setDefault("step",a._parseAttr("step",t)),(isNaN(a.min)||e.isEmpty(a.min))&&(a.min=e.DEFAULT_MIN),(isNaN(a.max)||e.isEmpty(a.max))&&(a.max=e.DEFAULT_MAX),(isNaN(a.step)||e.isEmpty(a.step)||0===a.step)&&(a.step=e.DEFAULT_STEP),a.diff=a.max-a.min,a._setDefault("minThreshold",a.min),a.minThresholda.max&&(a.minThreshold=a.max)},_initHighlight:function(t){var e,a=this,n=a._getCaption();t||(t=a.$element.val()),e=a.getWidthFromValue(t)+"%",a.$filledStars.width(e),a.cache={caption:n,width:e,val:t}},_getContainerCss:function(){var t=this;return"rating-container"+e.getCss(t.theme,"theme-"+t.theme)+e.getCss(t.rtl,"rating-rtl")+e.getCss(t.size,"rating-"+t.size)+e.getCss(t.animate,"rating-animate")+e.getCss(t.disabled||t.readonly,"rating-disabled")+e.getCss(t.containerClass,t.containerClass)+(t.displayOnly?" is-display-only":"")},_checkDisabled:function(){var t=this,e=t.$element,a=t.options;t.disabled=void 0===a.disabled?e.attr("disabled")||!1:a.disabled,t.readonly=void 0===a.readonly?e.attr("readonly")||!1:a.readonly,t.inactive=t.disabled||t.readonly,e.attr({disabled:t.disabled,readonly:t.readonly})},_addContent:function(t,e){var a=this,n=a.$container,i="clear"===t;return a.rtl?i?n.append(e):n.prepend(e):i?n.prepend(e):n.append(e)},_generateRating:function(){var a,n,i,r=this,s=r.$element;n=r.$container=t(document.createElement("div")).insertBefore(s),e.addCss(n,r._getContainerCss()),r.$rating=a=t(document.createElement("div")).attr("class","rating-stars").appendTo(n).append(r._getStars("empty")).append(r._getStars("filled")),r.keyboardEnabled&&r.$rating.attr("tabindex",r.tabindex),r.$emptyStars=a.find(".empty-stars"),r.$filledStars=a.find(".filled-stars"),r._renderCaption(),r._renderClear(),r._initHighlight(),r._initStarTitles();r.rtl&&(i=Math.max(r.$emptyStars.outerWidth(),r.$filledStars.outerWidth()),r.$emptyStars.width(i)),n.insertBefore(s)},_getCaption:function(){var t=this;return t.$caption&&t.$caption.length?t.$caption.html():t.defaultCaption},_setCaption:function(t){var e=this;e.$caption&&e.$caption.length&&e.$caption.html(t)},_renderCaption:function(){var a,n=this,i=n.$element.val(),r=n.captionElement?t(n.captionElement):"";if(n.showCaption){if(a=n.fetchCaption(i),r&&r.length)return e.addCss(r,"caption"),r.html(a),void(n.$caption=r);n._addContent("caption",'
'+a+"
"),n.$caption=n.$container.find(".caption")}},_renderClear:function(){var a,n=this,i=n.clearElement?t(n.clearElement):"";if(n.showClear){if(a=n._getClearClass(),i.length)return e.addCss(i,a),i.attr({title:n.clearButtonTitle}).html(n.clearButton),void(n.$clear=i);n._addContent("clear",'
'+n.clearButton+"
"),n.$clear=n.$container.find("."+n.clearButtonBaseClass)}},_getClearClass:function(){var t=this;return t.clearButtonBaseClass+" "+(t.inactive?"":t.clearButtonActiveClass)},_toggleHover:function(t){var e,a,n,i=this;t&&(i.hoverChangeStars&&(e=i.getWidthFromValue(i.clearValue),a=t.val<=i.clearValue?e+"%":t.width,i.$filledStars.css("width",a)),i.hoverChangeCaption&&(n=t.val<=i.clearValue?i.fetchCaption(i.clearValue):t.caption,n&&i._setCaption(n+"")))},_init:function(a){var n,i=this,r=i.$element.attr("tabindex",-1).addClass("rating-input"),s=i.minThreshold;return i.options=a,t.each(a,function(t,e){i[t]=e}),(i.rtl||"rtl"===r.attr("dir"))&&(i.rtl=!0,r.attr("dir","rtl")),i.starClicked=!1,i.clearClicked=!1,i._initSlider(a),i._checkDisabled(),i.displayOnly&&(i.inactive=!0,i.showClear=!1,i.hoverEnabled=!1,i.hoverChangeCaption=!1,i.hoverChangeStars=!1),i._generateRating(),i._initEvents(),i._listen(),!e.isEmpty(s)&&(e.isEmpty(r.val())||r.val()'+t.clearCaption+"",n=t.clearValue,i=t.getWidthFromValue(n)||0,r={caption:a,width:i,val:n},t._toggleHover(r),t.$element.trigger("rating:hover",[n,a,"clear"]))},clearMouseLeave:function(e){var a;t.events._noMouseAction(e)||t.clearClicked||!t.hoverOnClear||(a=t.cache,t._toggleHover(a),t.$element.trigger("rating:hoverleave",["clear"]))},resetForm:function(e){e&&e.isDefaultPrevented()||t.inactive||t.reset()},focus:function(){t.$rating.focus(),t.$element.trigger("rating:focus")},blur:function(){t.$element.trigger("rating:blur")},keydown:function(a){if(!t.inactive&&t.keyboardEnabled){var n=t.$element,i=n.val(),r=!1,s=parseFloat(t.step),o=e.getDecimalPlaces(s),l=t.rtl?37:39,c=t.rtl?39:37,u=i?parseFloat(i):0,d=parseInt(a.which||a.keyCode||0,10);d===l&&ut.minThreshold&&(u-=s,r=!0),r&&(u=e.applyPrecision(u,o),n.val(u),t._trigChange([u,t._getCaption()]),t.showStars(n.val()),t.$rating.focus()),37!==d&&39!==d||n.trigger("rating:keydown",[u,t._getCaption()])}}}},_listen:function(){var a=this,n=a.$element,i=n.closest("form"),r=a.$rating,s=a.$clear,o=a.events,l=e.NAMESPACE,c="mouseenter"+l+" mouseleave"+l,u=a.$rating.find(".star");return e.handler(r,"touchstart touchmove touchend",o.initTouch),e.handler(r,"click touchstart",o.starClick),e.handler(r,"mousemove",o.starMouseMove),e.handler(r,"mouseleave",o.starMouseLeave),e.handler(r,"keydown",o.keydown),e.handler(r,"blur",o.blur),a.showClear&&s.length&&(e.handler(s,"click touchstart",o.clearClick),e.handler(s,"mousemove",o.clearMouseMove),e.handler(s,"mouseleave",o.clearMouseLeave)),i.length&&e.handler(i,"reset",o.resetForm,!0),u.off(c).on(c,function(e){var n=t(this),i=n.index(),r=n.parent().attr("class").slice(0,-1);a.$element.trigger("rating:"+e.type,[i+1,r,n])}),e.handler(a.$container,"click",o.focus),n},_getStars:function(t){var e,a=this,n='';for(e=1;e<=a.stars;e++)n+=''+a[t+"Star"]+"";return n+""},_initStarTitles:function(e){var a=this;if(a.showCaptionAsTitle)return void a._initCaptionTitle();var n,i=a.starTitles;n=function(a){var n=1;a.each(function(){var a,r,s=t(this);"function"==typeof i?(a=n===Math.floor(e)?e:n,r=i(a)):r=i[n],r&&s.attr({title:r}),n++})},n(a.$emptyStars.find(".star")),n(a.$filledStars.find(".star"))},_setStars:function(t){var e=this,a=arguments.length?e.calculate(t):e.calculate(),n=e.$element,i=e._parseValue(a.val);return n.val(i),e.$filledStars.css("width",a.width),e._setCaption(a.caption),e.cache=a,e._initStarTitles(i),n},showStars:function(t){var e=this,a=e._parseValue(t);return e.$element.val(a),e._setStars()},calculate:function(t){var a=this,n=e.isEmpty(a.$element.val())?0:a.$element.val(),i=arguments.length?a.getValueFromPosition(t):n,r=a.fetchCaption(i),s=a.getWidthFromValue(i);return s+="%",{caption:r,width:s,val:i}},getValueFromPosition:function(t){var a,n,i=this,r=e.getDecimalPlaces(i.step),s=i.$rating.width();return n=i.diff*t/(s*i.step),n=i.rtl?Math.floor(n):Math.ceil(n),a=e.applyPrecision(parseFloat(i.min+n*i.step),r),a=Math.max(Math.min(a,i.max),i.minThreshold),i.rtl?i.max-a:a},getWidthFromValue:function(t){var e,a,n=this,i=n.min,r=n.max,s=n.$emptyStars;return!t||t<=n.min||i===r?0:(t=Math.max(t,n.minThreshold),a=s.outerWidth(),e=a?s.width()/a:1,t>=r?100:(t-i)*e*100/(r-i))},fetchCaption:function(t){var a,n,i,r,s,o=this,l=parseFloat(t)||o.clearValue,c=o.starCaptions,u=o.starCaptionClasses,d=o.getWidthFromValue(l);return l&&l!==o.clearValue&&(l=e.applyPrecision(l,e.getDecimalPlaces(o.step))),r="function"==typeof u?u(l,d):u[l],i="function"==typeof c?c(l,d):c[l],n=e.isEmpty(i)?o.defaultCaption.replace(/\{rating}/g,l):i,a=e.isEmpty(r)?o.clearCaptionClass:r,s=l===o.clearValue?o.clearCaption:n,''+s+""},destroy:function(){var a=this,n=a.$element;return e.isEmpty(a.$container)||a.$container.before(n).remove(),t.removeData(n.get(0)),n.off("rating").removeClass("rating rating-input")},create:function(t){var e=this,a=t||e.options||{};return e.destroy().rating(a)},clear:function(){var t=this,e=''+t.clearCaption+"";return t.inactive||t._setCaption(e),t.showStars(t.clearValue).trigger("change").trigger("rating:clear")},reset:function(){var t=this;return t.showStars(t.initialValue).trigger("rating:reset")},update:function(t){var e=this;return arguments.length?e.showStars(t):e.$element},refresh:function(e){var a=this,n=a.$element;return e?a.destroy().rating(t.extend(!0,a.options,e)).trigger("rating:refresh"):n}},t.fn.rating=function(n){var i=Array.apply(null,arguments),r=[];switch(i.shift(),this.each(function(){var s,o=t(this),l=o.data("rating"),c="object"==typeof n&&n,u=c.theme||o.data("theme"),d=c.language||o.data("language")||"en",h={},p={};l||(u&&(h=t.fn.ratingThemes[u]||{}),"en"===d||e.isEmpty(t.fn.ratingLocales[d])||(p=t.fn.ratingLocales[d]),s=t.extend(!0,{},t.fn.rating.defaults,h,t.fn.ratingLocales.en,p,c,o.data()),l=new a(this,s),o.data("rating",l)),"string"==typeof n&&r.push(l[n].apply(l,i))}),r.length){case 0:return this;case 1:return void 0===r[0]?this:r[0];default:return r}},t.fn.rating.defaults={theme:"krajee-svg",language:"en",stars:5,tabindex:0,keyboardEnabled:!0,mouseEnabled:!0,containerClass:"",size:"md",animate:!0,displayOnly:!1,rtl:!1,showClear:!0,showCaption:!0,starCaptionClasses:{.5:"caption-badge caption-danger",1:"caption-badge caption-danger",1.5:"caption-badge caption-warning",2:"caption-badge caption-warning",2.5:"caption-badge caption-info",3:"caption-badge caption-info",3.5:"caption-badge caption-primary",4:"caption-badge caption-primary",4.5:"caption-badge caption-success",5:"caption-badge caption-success"},filledStar:'',emptyStar:'',clearButton:'',clearButtonBaseClass:"clear-rating",clearButtonActiveClass:"clear-rating-active",clearCaptionClass:"caption-badge caption-secondary",clearValue:null,captionElement:null,clearElement:null,showCaptionAsTitle:!1,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"},starTitles:{1:"One Star",2:"Two Stars",3:"Three Stars",4:"Four Stars",5:"Five Stars"},clearButtonTitle:"Clear",clearCaption:"Not Rated"},t.fn.rating.Constructor=a,t(document).ready(function(){var e=t("input.rating");e.length&&e.removeClass("rating-loading").addClass("rating-loading").rating()})}); -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bootstrap-star-rating", 3 | "version": "4.1.3", 4 | "homepage": "https://github.com/kartik-v/bootstrap-star-rating", 5 | "author": "Kartik Visweswaran ", 6 | "description": "A simple yet powerful JQuery star rating plugin for Bootstrap.", 7 | "bugs": { 8 | "url": "https://github.com/kartik-v/bootstrap-star-rating/issues" 9 | }, 10 | "repository": { 11 | "type": "git", 12 | "url": "https://github.com/kartik-v/bootstrap-star-rating.git" 13 | }, 14 | "keywords": [ 15 | "bootstrap", 16 | "star", 17 | "rating", 18 | "font", 19 | "awesome", 20 | "glyphicon", 21 | "svg" 22 | ], 23 | "main": "./js/star-rating.min.js", 24 | "style": "./css/star-rating.min.css", 25 | "peerDependencies": { 26 | "jquery": ">= 1.9.0", 27 | "bootstrap": ">= 3.0.0" 28 | }, 29 | "license": "BSD-3-Clause", 30 | "dependencies": { 31 | "opencollective-postinstall": "^2.0.2" 32 | }, 33 | "collective": { 34 | "type": "opencollective", 35 | "url": "https://opencollective.com/bootstrap-star-rating" 36 | }, 37 | "scripts": { 38 | "postinstall": "opencollective-postinstall || true" 39 | } 40 | } -------------------------------------------------------------------------------- /themes/krajee-fa/theme.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Krajee Font Awesome 4.x Theme styling for bootstrap-star-rating. 3 | * This file must be loaded after 'star-rating.css'. 4 | * 5 | * bootstrap-star-rating v4.1.3 6 | * http://plugins.krajee.com/star-rating 7 | * 8 | * Author: Kartik Visweswaran 9 | * Copyright: 2013 - 2021, Kartik Visweswaran, Krajee.com 10 | * 11 | * Licensed under the BSD 3-Clause 12 | * https://github.com/kartik-v/bootstrap-star-rating/blob/master/LICENSE.md 13 | */ 14 | .theme-krajee-fa .star { 15 | font-size: 1.1em; 16 | } -------------------------------------------------------------------------------- /themes/krajee-fa/theme.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Krajee Font Awesome 4.x Theme configuration for bootstrap-star-rating. 3 | * This file must be loaded after 'star-rating.js'. 4 | * 5 | * bootstrap-star-rating v4.1.3 6 | * http://plugins.krajee.com/star-rating 7 | * 8 | * Author: Kartik Visweswaran 9 | * Copyright: 2013 - 2021, Kartik Visweswaran, Krajee.com 10 | * 11 | * Licensed under the BSD 3-Clause 12 | * https://github.com/kartik-v/bootstrap-star-rating/blob/master/LICENSE.md 13 | */ 14 | (function (factory) { 15 | 'use strict'; 16 | if (typeof define === 'function' && define.amd) { 17 | define(['jquery'], factory); 18 | } else if (typeof module === 'object' && typeof module.exports === 'object') { 19 | factory(require('jquery')); 20 | } else { 21 | factory(window.jQuery); 22 | } 23 | }(function ($) { 24 | "use strict"; 25 | $.fn.ratingThemes['krajee-fa'] = { 26 | filledStar: '', 27 | emptyStar: '', 28 | clearButton: '' 29 | }; 30 | })); 31 | -------------------------------------------------------------------------------- /themes/krajee-fa/theme.min.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Krajee Font Awesome 4.x Theme styling for bootstrap-star-rating. 3 | * This file must be loaded after 'star-rating.css'. 4 | * 5 | * bootstrap-star-rating v4.1.3 6 | * http://plugins.krajee.com/star-rating 7 | * 8 | * Author: Kartik Visweswaran 9 | * Copyright: 2013 - 2021, Kartik Visweswaran, Krajee.com 10 | * 11 | * Licensed under the BSD 3-Clause 12 | * https://github.com/kartik-v/bootstrap-star-rating/blob/master/LICENSE.md 13 | */ 14 | .theme-krajee-fa .star{font-size:1.1em} -------------------------------------------------------------------------------- /themes/krajee-fa/theme.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Krajee Font Awesome 4.x Theme configuration for bootstrap-star-rating. 3 | * This file must be loaded after 'star-rating.js'. 4 | * 5 | * bootstrap-star-rating v4.1.3 6 | * http://plugins.krajee.com/star-rating 7 | * 8 | * Author: Kartik Visweswaran 9 | * Copyright: 2013 - 2021, Kartik Visweswaran, Krajee.com 10 | * 11 | * Licensed under the BSD 3-Clause 12 | * https://github.com/kartik-v/bootstrap-star-rating/blob/master/LICENSE.md 13 | */!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):e("object"==typeof module&&"object"==typeof module.exports?require("jquery"):window.jQuery)}(function(e){"use strict";e.fn.ratingThemes["krajee-fa"]={filledStar:'',emptyStar:'',clearButton:''}}); -------------------------------------------------------------------------------- /themes/krajee-fas/theme.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Krajee Font Awesome 5.x Theme styling for bootstrap-star-rating. 3 | * This file must be loaded after 'star-rating.css'. 4 | * 5 | * bootstrap-star-rating v4.1.3 6 | * http://plugins.krajee.com/star-rating 7 | * 8 | * Author: Kartik Visweswaran 9 | * Copyright: 2013 - 2021, Kartik Visweswaran, Krajee.com 10 | * 11 | * Licensed under the BSD 3-Clause 12 | * https://github.com/kartik-v/bootstrap-star-rating/blob/master/LICENSE.md 13 | */ 14 | .theme-krajee-fas.rating-rtl.is-star .filled-stars { 15 | right: 0; 16 | } -------------------------------------------------------------------------------- /themes/krajee-fas/theme.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Krajee Font Awesome 5.x Theme configuration for bootstrap-star-rating. 3 | * This file must be loaded after 'star-rating.css'. 4 | * 5 | * bootstrap-star-rating v4.1.3 6 | * http://plugins.krajee.com/star-rating 7 | * 8 | * Author: Kartik Visweswaran 9 | * Copyright: 2013 - 2021, Kartik Visweswaran, Krajee.com 10 | * 11 | * Licensed under the BSD 3-Clause 12 | * https://github.com/kartik-v/bootstrap-star-rating/blob/master/LICENSE.md 13 | */ 14 | (function (factory) { 15 | 'use strict'; 16 | if (typeof define === 'function' && define.amd) { 17 | define(['jquery'], factory); 18 | } else if (typeof module === 'object' && typeof module.exports === 'object') { 19 | factory(require('jquery')); 20 | } else { 21 | factory(window.jQuery); 22 | } 23 | }(function ($) { 24 | "use strict"; 25 | $.fn.ratingThemes['krajee-fas'] = { 26 | filledStar: '', 27 | emptyStar: '', 28 | clearButton: '' 29 | }; 30 | })); 31 | -------------------------------------------------------------------------------- /themes/krajee-fas/theme.min.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Krajee Font Awesome 5.x Theme styling for bootstrap-star-rating. 3 | * This file must be loaded after 'star-rating.css'. 4 | * 5 | * bootstrap-star-rating v4.1.3 6 | * http://plugins.krajee.com/star-rating 7 | * 8 | * Author: Kartik Visweswaran 9 | * Copyright: 2013 - 2021, Kartik Visweswaran, Krajee.com 10 | * 11 | * Licensed under the BSD 3-Clause 12 | * https://github.com/kartik-v/bootstrap-star-rating/blob/master/LICENSE.md 13 | */ 14 | .theme-krajee-fas.rating-rtl.is-star .filled-stars{right:0} -------------------------------------------------------------------------------- /themes/krajee-fas/theme.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Krajee Font Awesome 5.x Theme configuration for bootstrap-star-rating. 3 | * This file must be loaded after 'star-rating.css'. 4 | * 5 | * bootstrap-star-rating v4.1.3 6 | * http://plugins.krajee.com/star-rating 7 | * 8 | * Author: Kartik Visweswaran 9 | * Copyright: 2013 - 2021, Kartik Visweswaran, Krajee.com 10 | * 11 | * Licensed under the BSD 3-Clause 12 | * https://github.com/kartik-v/bootstrap-star-rating/blob/master/LICENSE.md 13 | */ 14 | !function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):e("object"==typeof module&&"object"==typeof module.exports?require("jquery"):window.jQuery)}(function(e){"use strict";e.fn.ratingThemes["krajee-fas"]={filledStar:'',emptyStar:'',clearButton:''}}); -------------------------------------------------------------------------------- /themes/krajee-gly/theme.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Krajee Glyphicon Theme configuration for bootstrap-star-rating. 3 | * This file must be loaded after 'star-rating.js'. 4 | * 5 | * bootstrap-star-rating v4.1.3 6 | * http://plugins.krajee.com/star-rating 7 | * 8 | * Author: Kartik Visweswaran 9 | * Copyright: 2013 - 2021, Kartik Visweswaran, Krajee.com 10 | * 11 | * Licensed under the BSD 3-Clause 12 | * https://github.com/kartik-v/bootstrap-star-rating/blob/master/LICENSE.md 13 | */ 14 | (function (factory) { 15 | 'use strict'; 16 | if (typeof define === 'function' && define.amd) { 17 | define(['jquery'], factory); 18 | } else if (typeof module === 'object' && typeof module.exports === 'object') { 19 | factory(require('jquery')); 20 | } else { 21 | factory(window.jQuery); 22 | } 23 | }(function ($) { 24 | "use strict"; 25 | $.fn.ratingThemes['krajee-gly'] = { 26 | filledStar: '', 27 | emptyStar: '', 28 | clearButton: '', 29 | }; 30 | })); 31 | -------------------------------------------------------------------------------- /themes/krajee-gly/theme.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Krajee Glyphicon Theme configuration for bootstrap-star-rating. 3 | * This file must be loaded after 'star-rating.js'. 4 | * 5 | * bootstrap-star-rating v4.1.3 6 | * http://plugins.krajee.com/star-rating 7 | * 8 | * Author: Kartik Visweswaran 9 | * Copyright: 2013 - 2021, Kartik Visweswaran, Krajee.com 10 | * 11 | * Licensed under the BSD 3-Clause 12 | * https://github.com/kartik-v/bootstrap-star-rating/blob/master/LICENSE.md 13 | */ 14 | !function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):e("object"==typeof module&&"object"==typeof module.exports?require("jquery"):window.jQuery)}(function(e){"use strict";e.fn.ratingThemes["krajee-gly"]={filledStar:'',emptyStar:'',clearButton:''}}); -------------------------------------------------------------------------------- /themes/krajee-svg/theme.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Krajee SVG Theme styling for bootstrap-star-rating. 3 | * This file must be loaded after 'star-rating.css'. 4 | * 5 | * bootstrap-star-rating v4.1.3 6 | * http://plugins.krajee.com/star-rating 7 | * 8 | * Author: Kartik Visweswaran 9 | * Copyright: 2013 - 2021, Kartik Visweswaran, Krajee.com 10 | * 11 | * Licensed under the BSD 3-Clause 12 | * https://github.com/kartik-v/bootstrap-star-rating/blob/master/LICENSE.md 13 | */ 14 | .theme-krajee-svg .krajee-icon, 15 | .theme-krajee-svg .krajee-icon-clear { 16 | display: inline-block; 17 | width: 2rem; 18 | height: 2rem; 19 | -webkit-background-size: cover; 20 | -moz-background-size: cover; 21 | -o-background-size: cover; 22 | background-size: cover; 23 | } 24 | 25 | .theme-krajee-svg .clear-rating, 26 | .theme-krajee-svg .rating-stars { 27 | font-size: 5px; 28 | } 29 | 30 | .theme-krajee-svg .krajee-icon-clear { 31 | 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'); 32 | } 33 | 34 | .theme-krajee-svg .filled-stars .krajee-icon-star { 35 | 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'); 36 | } 37 | 38 | .theme-krajee-svg.rating-xl .krajee-icon, 39 | .theme-krajee-svg.rating-xl .krajee-icon-clear { 40 | width: 3rem; 41 | height: 3rem; 42 | } 43 | 44 | .theme-krajee-svg.rating-lg .krajee-icon, 45 | .theme-krajee-svg.rating-lg .krajee-icon-clear { 46 | width: 2.5rem; 47 | height: 2.5rem; 48 | } 49 | 50 | .theme-krajee-svg.rating-md .krajee-icon, 51 | .theme-krajee-svg.rating-md .krajee-icon-clear { 52 | width: 2rem; 53 | height: 2rem; 54 | } 55 | 56 | .theme-krajee-svg.rating-sm .krajee-icon, 57 | .theme-krajee-svg.rating-sm .krajee-icon-clear { 58 | width: 1.5rem; 59 | height: 1.5rem; 60 | } 61 | 62 | .theme-krajee-svg.rating-xs .krajee-icon, 63 | .theme-krajee-svg.rating-xs .krajee-icon-clear { 64 | width: 1rem; 65 | height: 1rem; 66 | } 67 | 68 | .theme-krajee-svg .krajee-icon-clear:hover { 69 | 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'); 70 | } 71 | 72 | .theme-krajee-svg .empty-stars .krajee-icon-star { 73 | 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'); 74 | } 75 | 76 | .theme-krajee-svg .filled-stars .krajee-icon-heart { 77 | 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'); 78 | } 79 | 80 | .theme-krajee-svg .empty-stars .krajee-icon-heart { 81 | 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'); 82 | } 83 | 84 | .theme-krajee-svg.rating-rtl.is-heart .filled-stars { 85 | right: 0.02em; 86 | } 87 | 88 | .theme-krajee-svg.rating-rtl.is-heart .empty-stars { 89 | margin-right: 0.01em; 90 | } -------------------------------------------------------------------------------- /themes/krajee-svg/theme.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Krajee SVG Theme Configuration for bootstrap-star-rating. 3 | * This file must be loaded after 'star-rating.js'. 4 | * 5 | * bootstrap-star-rating v4.1.3 6 | * http://plugins.krajee.com/star-rating 7 | * 8 | * Author: Kartik Visweswaran 9 | * Copyright: 2013 - 2021, Kartik Visweswaran, Krajee.com 10 | * 11 | * Licensed under the BSD 3-Clause 12 | * https://github.com/kartik-v/bootstrap-star-rating/blob/master/LICENSE.md 13 | */ 14 | (function (factory) { 15 | 'use strict'; 16 | if (typeof define === 'function' && define.amd) { 17 | define(['jquery'], factory); 18 | } else if (typeof module === 'object' && typeof module.exports === 'object') { 19 | factory(require('jquery')); 20 | } else { 21 | factory(window.jQuery); 22 | } 23 | }(function ($) { 24 | "use strict"; 25 | $.fn.ratingThemes['krajee-svg'] = { 26 | filledStar: '', 27 | emptyStar: '', 28 | clearButton: '' 29 | }; 30 | })); 31 | -------------------------------------------------------------------------------- /themes/krajee-svg/theme.min.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Krajee SVG Theme styling for bootstrap-star-rating. 3 | * This file must be loaded after 'star-rating.css'. 4 | * 5 | * bootstrap-star-rating v4.1.3 6 | * http://plugins.krajee.com/star-rating 7 | * 8 | * Author: Kartik Visweswaran 9 | * Copyright: 2013 - 2021, Kartik Visweswaran, Krajee.com 10 | * 11 | * Licensed under the BSD 3-Clause 12 | * https://github.com/kartik-v/bootstrap-star-rating/blob/master/LICENSE.md 13 | */ 14 | .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} -------------------------------------------------------------------------------- /themes/krajee-svg/theme.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Krajee SVG Theme Configuration for bootstrap-star-rating. 3 | * This file must be loaded after 'star-rating.js'. 4 | * 5 | * bootstrap-star-rating v4.1.3 6 | * http://plugins.krajee.com/star-rating 7 | * 8 | * Author: Kartik Visweswaran 9 | * Copyright: 2013 - 2021, Kartik Visweswaran, Krajee.com 10 | * 11 | * Licensed under the BSD 3-Clause 12 | * https://github.com/kartik-v/bootstrap-star-rating/blob/master/LICENSE.md 13 | */ 14 | !function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):e("object"==typeof module&&"object"==typeof module.exports?require("jquery"):window.jQuery)}(function(e){"use strict";e.fn.ratingThemes["krajee-svg"]={filledStar:'',emptyStar:'',clearButton:''}}); -------------------------------------------------------------------------------- /themes/krajee-uni/theme.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Krajee Unicode Theme styling for bootstrap-star-rating. 3 | * This file must be loaded after 'star-rating.css'. 4 | * 5 | * bootstrap-star-rating v4.1.3 6 | * http://plugins.krajee.com/star-rating 7 | * 8 | * Author: Kartik Visweswaran 9 | * Copyright: 2013 - 2021, Kartik Visweswaran, Krajee.com 10 | * 11 | * Licensed under the BSD 3-Clause 12 | * https://github.com/kartik-v/bootstrap-star-rating/blob/master/LICENSE.md 13 | */ 14 | .theme-krajee-uni .star { 15 | font-size: 1.2em; 16 | line-height: 1; 17 | margin: 0; 18 | } 19 | 20 | .theme-krajee-uni .clear-rating { 21 | font-size: 1em; 22 | line-height: 1; 23 | } -------------------------------------------------------------------------------- /themes/krajee-uni/theme.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Krajee Unicode Theme Configuration for bootstrap-star-rating. 3 | * This file must be loaded after 'star-rating.js'. 4 | * 5 | * bootstrap-star-rating v4.1.3 6 | * http://plugins.krajee.com/star-rating 7 | * 8 | * Author: Kartik Visweswaran 9 | * Copyright: 2013 - 2021, Kartik Visweswaran, Krajee.com 10 | * 11 | * Licensed under the BSD 3-Clause 12 | * https://github.com/kartik-v/bootstrap-star-rating/blob/master/LICENSE.md 13 | */ 14 | (function (factory) { 15 | 'use strict'; 16 | if (typeof define === 'function' && define.amd) { 17 | define(['jquery'], factory); 18 | } else if (typeof module === 'object' && typeof module.exports === 'object') { 19 | factory(require('jquery')); 20 | } else { 21 | factory(window.jQuery); 22 | } 23 | }(function ($) { 24 | "use strict"; 25 | $.fn.ratingThemes['krajee-uni'] = { 26 | filledStar: '★', 27 | emptyStar: '☆', 28 | clearButton: '⊝' 29 | }; 30 | })); 31 | -------------------------------------------------------------------------------- /themes/krajee-uni/theme.min.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Krajee Unicode Theme styling for bootstrap-star-rating. 3 | * This file must be loaded after 'star-rating.css'. 4 | * 5 | * bootstrap-star-rating v4.1.3 6 | * http://plugins.krajee.com/star-rating 7 | * 8 | * Author: Kartik Visweswaran 9 | * Copyright: 2013 - 2021, Kartik Visweswaran, Krajee.com 10 | * 11 | * Licensed under the BSD 3-Clause 12 | * https://github.com/kartik-v/bootstrap-star-rating/blob/master/LICENSE.md 13 | */ 14 | .theme-krajee-uni .star{font-size:1.2em;line-height:1;margin:0}.theme-krajee-uni .clear-rating{font-size:1em;line-height:1} -------------------------------------------------------------------------------- /themes/krajee-uni/theme.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Krajee Unicode Theme Configuration for bootstrap-star-rating. 3 | * This file must be loaded after 'star-rating.js'. 4 | * 5 | * bootstrap-star-rating v4.1.3 6 | * http://plugins.krajee.com/star-rating 7 | * 8 | * Author: Kartik Visweswaran 9 | * Copyright: 2013 - 2021, Kartik Visweswaran, Krajee.com 10 | * 11 | * Licensed under the BSD 3-Clause 12 | * https://github.com/kartik-v/bootstrap-star-rating/blob/master/LICENSE.md 13 | */ 14 | !function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):e("object"==typeof module&&"object"==typeof module.exports?require("jquery"):window.jQuery)}(function(e){"use strict";e.fn.ratingThemes["krajee-uni"]={filledStar:"★",emptyStar:"☆",clearButton:"⊝"}}); --------------------------------------------------------------------------------