{"_id":"star-rating-svg","_rev":"3-e3e7b38512e8fca8981c778733a2667f","name":"star-rating-svg","description":"A star rating plugin based on svg","dist-tags":{"latest":"3.5.0"},"versions":{"3.5.0":{"name":"star-rating-svg","version":"3.5.0","description":"A star rating plugin based on svg","keywords":["star","rating","star rating","jquery"],"repository":{"type":"git","url":"git+https://github.com/nashio/star-rating-svg.git"},"bugs":{"url":"https://github.com/nashio/star-rating-svg/issues"},"author":{"name":"Ignacio Chavez","url":"https://github.com/nashio"},"homepage":"http://nashio.github.com/star-rating-svg","license":"MIT","devDependencies":{"grunt":"~0.4.5","grunt-cli":"~0.1.13","grunt-contrib-concat":"^0.5.1","grunt-contrib-jshint":"^0.11.0","grunt-contrib-uglify":"^0.8.0","grunt-contrib-watch":"^0.6.1"},"scripts":{"test":"grunt travis --verbose"},"gitHead":"0a84e678fc809fa25218f9923bec51412123262d","_id":"star-rating-svg@3.5.0","_shasum":"72b147015a433da63153fb607af6d51c7c1ea364","_from":".","_npmVersion":"3.9.3","_nodeVersion":"4.4.5","_npmUser":{"name":"bruce-mitchell","email":"bruce@codescience.co.za"},"dist":{"shasum":"72b147015a433da63153fb607af6d51c7c1ea364","tarball":"https://registry.npmjs.org/star-rating-svg/-/star-rating-svg-3.5.0.tgz","integrity":"sha512-ItfRzGQxDuf4IMR9VV7nfbbcfZ2pAkQ2xfiq/kLzeGUxnyZXttbJrI1erRM2CZedQ+Qu6+yS4u+hUGybkDGYEA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDPHAZ/0t00621J/pjY2qaRUI2GVOuiYd8wLdBLeem4BQIgLd8VJ/ChM9dJpa2arpUKRi0x8t6oXpQnNDTZw3cQrKA="}]},"maintainers":[{"name":"bruce-mitchell","email":"bruce@codescience.co.za"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/star-rating-svg-3.5.0.tgz_1467672686581_0.1439988031052053"}}},"readme":"\r\n![](http://nashio.github.io/star-rating-svg/demo/img/star-rating-svg-logo.png)\r\n\r\n###### A basic, yet flexible star rate jQuery plugin, using SVG.\r\n\r\n###Features:\r\n* Doesn't use images\r\n* Customize size\r\n* Customize colors\r\n* Use half or full stars\r\n* Choose the number of stars to be displayed\r\n* Define gradient color of selected stars\r\n* Specify a border/stroke thickness and color\r\n* Specify initial rating via options or markup data attribute\r\n* Execute callback after rating (ex. to notify a server)\r\n* onHover and onLeave events\r\n* Locked / Read-only mode\r\n* Unload option\r\n\r\n\r\n<br/>![](http://ignaciochavez.com/files/star-rating/stars-rating-demo.jpg)\r\n\r\n## demo\r\n\r\nFor a working **demo**, see:\r\nhttp://nashio.github.io/star-rating-svg/demo\r\n\r\n## Usage\r\n\r\n1. Include jQuery:\r\n\r\n\t```html\r\n\t<script src=\"http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js\"></script>\r\n\t```\r\n\r\n2. Include plugin's code:\r\n\r\n\t```html\r\n\t<script src=\"jquery.star-rating-svg.js\"></script>\r\n\t```\r\n\r\n2. Include plugin's css:\r\n\r\n\t```html\r\n    <link rel=\"stylesheet\" type=\"text/css\" href=\"star-rating-svg.css\">\r\n\t```\r\n\r\n3. Add the markup\r\n\r\n    ```html\r\n    <div class=\"my-rating\"></div>\r\n    ```\r\n\r\n4. Call the plugin:\r\n\r\n    ```javascript\r\n    $(\".my-rating\").starRating({\r\n        starSize: 25,\r\n        callback: function(currentRating, $el){\r\n            // make a server call here\r\n        }\r\n    });\r\n    ```\r\n\r\n## Options\r\n\r\n| option  | default  | description  |\r\n|---|---|---|\r\n| totalStars  | 5  | Amount of stars to show  |\r\n| initialRating | 0 | Initial rating applied on load |\r\n| starSize | 40 | width in pixels of each star |\r\n| useFullStars | false | rate using whole stars, if enabled, it doesn't use half-steps |\r\n| emptyColor | lightgray | Color assigned to an empty star |\r\n| hoverColor | orange | Color assigned to hovered star |\r\n| activeColor | gold | Color assigned to active rated star |\r\n| useGradient | true | Active stars will use gradient coloring |\r\n| | | To use this option you need to populate the object [starGradient] |\r\n| starGradient | {start: '#FEF7CD', end: '#FF9511'} | Define the star and end colors for the gradient |\r\n| readOnly | false | If false any interaction is disabled |\r\n| disableAfterRate | true | Removes further events once a rate is selected |\r\n| strokeWidth | 0 | Defines the thickness of the border, 0 is disabled |\r\n| strokeColor | black | Defines the color for the border |\r\n\r\n## Methods\r\n\r\n| method | arguments | description  |\r\n|---|---|---|\r\n| unload    |  &nbsp; | Destroys the instance and removes events attached to it |\r\n| setRating | 0 to max stars (int), round (Boolean) | Manually sets the rating  |\r\n| getRating | &nbsp; | Gets the current rating from instance |\r\n\r\n```javascript\r\n// unload example\r\n$('your-selector').starRating('unload')\r\n// set rating example\r\n$('your-selector').starRating('setRating', 2.5)\r\n// set rating and round\r\n$('your-selector').starRating('setRating', 2.8, true) // 3.0\r\n// get rating example\r\n$('your-selector').starRating('getRating')\r\n```\r\n\r\n## Callbacks\r\n\r\n| name | arguments | description |\r\n|---|---|---|\r\n| callback | rating, DOM element | Executes when selecting a rate |\r\n```javascript\r\n$('your-selector').starRating({\r\n    callback: function(currentRating, $el){\r\n    \t// do something after rating\r\n    }\r\n});\r\n```\r\n\r\n## Events\r\n\r\n| method | description  |\r\n|---|---|\r\n| onHover | executes a callback on mouseover |\r\n| onLeave | executes a callback on mouseout |\r\n```javascript\r\n$('your-selector').starRating({\r\n    onHover: function(currentIndex, currentRating, $el){\r\n\t\t\t// do something on mouseover\r\n    },\r\n    onLeave: function(currentIndex, currentRating, $el){\r\n\t\t\t// do something after mouseout\r\n    }\r\n});\r\n```\r\n\r\n\r\n### Files\r\n\r\nCode example\r\n\r\n#### [demo/index.html/](https://github.com/nashio/star-rating-svg/blob/master/demo/index.html \"code examples\")\r\n\r\nSource file\r\n\r\n#### [src/](https://github.com/nashio/star-rating-svg/tree/master/src \"source file\")\r\n\r\nMinified version\r\n\r\n#### [dist/](https://github.com/nashio/star-rating-svg/tree/master/dist \"build files\")\r\n\r\n### Changelog\r\n\r\n#### 1.0.1\r\n- Fixes Firefox hover issues\r\n\r\n#### 1.0.0\r\n- Adds set rating, and get rating\r\n- Adds onHover event\r\n- Adds onLeave event\r\n\r\n#### 0.9.4\r\n- Fixes support for enabling full stars\r\n\r\n#### 0.9.3\r\n- Returns element on callback\r\n- Fixed typos\r\n\r\n#### 0.8.2\r\n- Fixed bugs related to rendering in retina\r\n\r\n#### 0.8.0\r\n- Added readonly mode\r\n\r\n\r\n\r\nLicense\r\n------------\r\nThe MIT License (MIT)\r\n","maintainers":[{"name":"bruce-mitchell","email":"bruce@codescience.co.za"}],"time":{"modified":"2022-06-26T23:46:34.602Z","created":"2016-07-04T22:51:28.879Z","3.5.0":"2016-07-04T22:51:28.879Z"},"homepage":"http://nashio.github.com/star-rating-svg","keywords":["star","rating","star rating","jquery"],"repository":{"type":"git","url":"git+https://github.com/nashio/star-rating-svg.git"},"author":{"name":"Ignacio Chavez","url":"https://github.com/nashio"},"bugs":{"url":"https://github.com/nashio/star-rating-svg/issues"},"license":"MIT","readmeFilename":"README.md"}