123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173 |
- $(function() {
- function ratingEnable() {
- $('#example-1to10').barrating('show', {
- theme: 'bars-1to10'
- });
- $('#example-movie').barrating('show', {
- theme: 'bars-movie'
- });
- $('#example-movie').barrating('set', 'Mediocre');
- $('#example-square').barrating('show', {
- theme: 'bars-square',
- showValues: true,
- showSelectedRating: false
- });
- $('#example-pill').barrating('show', {
- theme: 'bars-pill',
- initialRating: 'A',
- showValues: true,
- showSelectedRating: false,
- allowEmpty: true,
- emptyValue: '-- no rating selected --',
- onSelect: function(value, text) {
- alert('Selected rating: ' + value);
- }
- });
- $('#example-reversed').barrating('show', {
- theme: 'bars-reversed',
- showSelectedRating: true,
- reverse: true
- });
- $('#example-horizontal').barrating('show', {
- theme: 'bars-horizontal',
- reverse: true,
- hoverState: false
- });
- $('#example-fontawesome').barrating({
- theme: 'fontawesome-stars',
- showSelectedRating: false
- });
- $('#fontawesome').barrating({
- theme: 'fontawesome-stars',
- showSelectedRating: false
- });
- $('#fontawesome1').barrating({
- theme: 'fontawesome-stars',
- showSelectedRating: false
- });
- $('#fontawesome2').barrating({
- theme: 'fontawesome-stars',
- showSelectedRating: false
- });
- $('#fontawesome3').barrating({
- theme: 'fontawesome-stars',
- showSelectedRating: false
- });
- $('#fontawesome4').barrating({
- theme: 'fontawesome-stars',
- showSelectedRating: false
- });
- $('#fontawesome5').barrating({
- theme: 'fontawesome-stars',
- showSelectedRating: false
- });
- $('#fontawesome6').barrating({
- theme: 'fontawesome-stars',
- showSelectedRating: false
- });
- $('#fontawesome7').barrating({
- theme: 'fontawesome-stars',
- showSelectedRating: false
- });
- $('#fontawesome8').barrating({
- theme: 'fontawesome-stars',
- showSelectedRating: false
- });
- $('#fontawesome9').barrating({
- theme: 'fontawesome-stars',
- showSelectedRating: false
- });
- $('#example-css').barrating({
- theme: 'css-stars',
- showSelectedRating: false
- });
- $('#example-bootstrap').barrating({
- theme: 'bootstrap-stars',
- showSelectedRating: false
- });
- var currentRating = $('#example-fontawesome-o').data('current-rating');
- $('.stars-example-fontawesome-o .current-rating')
- .find('span')
- .html(currentRating);
- $('.stars-example-fontawesome-o .clear-rating').on('click', function(event) {
- event.preventDefault();
- $('#example-fontawesome-o')
- .barrating('clear');
- });
- $('#example-fontawesome-o').barrating({
- theme: 'fontawesome-stars-o',
- showSelectedRating: false,
- initialRating: currentRating,
- onSelect: function(value, text) {
- if (!value) {
- $('#example-fontawesome-o')
- .barrating('clear');
- } else {
- $('.stars-example-fontawesome-o .current-rating')
- .addClass('hidden');
- $('.stars-example-fontawesome-o .your-rating')
- .removeClass('hidden')
- .find('span')
- .html(value);
- }
- },
- onClear: function(value, text) {
- $('.stars-example-fontawesome-o')
- .find('.current-rating')
- .removeClass('hidden')
- .end()
- .find('.your-rating')
- .addClass('hidden');
- }
- });
- }
- function ratingDisable() {
- $('select').barrating('destroy');
- }
- $('.rating-enable').click(function(event) {
- event.preventDefault();
- ratingEnable();
- $(this).addClass('deactivated');
- $('.rating-disable').removeClass('deactivated');
- });
- $('.rating-disable').click(function(event) {
- event.preventDefault();
- ratingDisable();
- $(this).addClass('deactivated');
- $('.rating-enable').removeClass('deactivated');
- });
- ratingEnable();
- });
|