{"id":13447620,"url":"https://github.com/fredolss/rater-js","last_synced_at":"2025-05-08T00:11:25.822Z","repository":{"id":20658668,"uuid":"90534804","full_name":"fredolss/rater-js","owner":"fredolss","description":"Star rating widget for the browser. Unlimited number of stars. No dependencies. No Jquery required.","archived":false,"fork":false,"pushed_at":"2025-04-19T11:57:45.000Z","size":1040,"stargazers_count":79,"open_issues_count":17,"forks_count":14,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-19T17:04:09.456Z","etag":null,"topics":["javascript","js","rater","rater-js","rating","star","star-rater","star-rating","star-rating-component","star-rating-widget","star-ratings","vote","voting","widget"],"latest_commit_sha":null,"homepage":"https://fredolss.github.io/rater-js/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fredolss.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-07T13:33:27.000Z","updated_at":"2025-04-19T11:57:48.000Z","dependencies_parsed_at":"2024-06-18T16:45:35.093Z","dependency_job_id":"caa16be8-0ba0-4bd2-91b0-55c965ea40e7","html_url":"https://github.com/fredolss/rater-js","commit_stats":{"total_commits":106,"total_committers":4,"mean_commits":26.5,"dds":"0.17924528301886788","last_synced_commit":"c5e8230ff6762b26c409d819747ff2da06f61294"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fredolss%2Frater-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fredolss%2Frater-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fredolss%2Frater-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fredolss%2Frater-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fredolss","download_url":"https://codeload.github.com/fredolss/rater-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252973692,"owners_count":21834108,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","js","rater","rater-js","rating","star","star-rater","star-rating","star-rating-component","star-rating-widget","star-ratings","vote","voting","widget"],"created_at":"2024-07-31T05:01:22.562Z","updated_at":"2025-05-08T00:11:25.801Z","avatar_url":"https://github.com/fredolss.png","language":"JavaScript","funding_links":["https://paypal.me/folssondev"],"categories":["JavaScript"],"sub_categories":[],"readme":"Rater Js\n========\n\n![rater-js Logo](ratings.png)\n[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://paypal.me/folssondev)\n[![NPM version][npm-image]][npm-url]\n[![License][license-image]][license-url]\n[![Downloads][downloads-image]][downloads-url]\n[![Node.js CI](https://github.com/fredolss/rater-js/actions/workflows/node.js.yml/badge.svg?branch=master)](https://github.com/fredolss/rater-js/actions/workflows/node.js.yml)\n\n**rater-js** is a star rating widget for the browser.\n\n### Main features:\n\n* Unlimited number of stars.\n* Svg as background image makes it look good in any size.\n* Custom css. Use your own image as star.\n* RTL support.\n* Touch support.\n\n[**Try Rater JS  Demo →**][RaterJS]\n\n## Installation\n\n```\nnpm install rater-js --save\n```\n\n## Usage\n\n**rater-js** can be used with amd, commonjs or without any module loader using global scope.\n\nIn your html create an element that acts as the placeholder for the widget.\n\n```html\n\u003cdiv id=\"rater\"\u003e\u003c/div\u003e\n```\n\n### Global scope\nDirectly reference the js from the module\n\n```html\n\u003c!--Add js before end body tag--\u003e\n\u003cscript src=\"node-modules/rater-js/index.js\"\u003e\u003c/script\u003e\n```\n\nThe widget will be available globally as \"raterJs\" on the window object.\n\n### Node/Browserify\nJust require the module.\n```js\nvar rater = require(\"rater-js\");\n```\n\nLastly we can use the widget like this:\n```js\n var myRater = rater({element: document.querySelector(\"#rater\"), rateCallback: function rateCallback(rating, done) {\n                //make async call to server however you want\n                //in this example we have a 'service' that rate and returns the average rating\n                myDataService.rate(rate).then(function(avgRating) {\n                    //update the avarage rating with the one we get from the server\n                    myRater.setRating(avgRating);\n                     //we could disable the rater to prevent another rating\n                     //if we dont want the user to be able to change their mind\n                    myRater.disable();\n                    //dont forget to call done\n                    done();\n                }, function(error) {\n                        //handle the error\n                        //dont forget to call done\n                        done();\n                });\n\t}});\n```\n\nCss will be injected at runtime, but you can override the css to get the look you want.\n\n```css\n//change the whole image used as the star. Make sure to set starSize in options if not 16px.\n//first image is for the 'off' mode\n.star-rating {\n        background: url(\"myStar_off.svg\") !important;\n}\n\n//add style for 'on' mode\n.star-rating .star-value{\n        background: url(\"myStar_on.svg\") !important;\n}\n```\n\n## Configuration\n\n| Property      | Description            |\n| ------------- |:----------------------:|\n| element       | HtmlElement. Required.   |\n| rateCallback  | Function. Triggered when star i clicked.               | \n| max           | Number. Number of stars to show.      |\n| showToolTip   | true/false. If set to true, show tooltip when hover the stars.            |\n| starSize      | Number. Width and height of the star image.      |\n| disableText   | Text to show when disabled.   |\n| ratingText    | Text to show when hover over stars. Text {rating} {maxRating}.   |\n| isBusyText    | Displayed while user is rating but done not called yet.  |\n| readOnly      | true/false. If set to true, will disable the rater.  |\n| step          | Number. Set a precision between 0 and 1 for the rating.  |\n| reverse       | true/false. If set to true, the ratings will be reversed. |\n\n## Methods/Properties\n\n```js\ndisable(): //Disable the widget\nenable(): //Enable the widget\nsetRating(rating:number): //Set the rating\ngetRating(): //Get the average rating\ndispose(); //Removes event handlers\nclear(); //Clears the rating\nelement; //Get the element used by rater js\n```\n\n\n[RaterJs]:https://fredolss.github.io/rater-js/example/  \"RaterJs\"\n[npm-image]: https://img.shields.io/npm/v/rater-js.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/rater-js\n[license-url]: LICENSE.md\n[license-image]: https://img.shields.io/:license-mit-blue.svg?style=flat-square\n[downloads-image]: http://img.shields.io/npm/dm/rater-js.svg?style=flat-square\n[downloads-url]: https://npmjs.org/package/rater-js\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffredolss%2Frater-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffredolss%2Frater-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffredolss%2Frater-js/lists"}