Skip to Content

JavaScript File

URL: https://www.lifestylefoodies.com/wp-content/plugins/penci-recipe/js/rating_recipe.js
HTTP Status: 200 OK
MIME Type: application/x-javascript
Last Modified: Fri, 26 Aug 2022 05:52:27 GMT
Download Time: Less than a second
Cookies: None
Size: 2 KB
HTTP Headers:  11 headers
Links In:  1 pages
Links Out:  0 links
Images:  0 images
CSS:  0 files
JavaScript:  0 files
OK Issues: No issues found

1if ( jQuery(".penci_rateyo").length ) {

2 jQuery(".penci_rateyo").each( function(){

3 var $this = jQuery(this),

4 rate = parseFloat( $this.data('rate') ),

5 allow = $this.data('allow'),

6 total = $this.data('total'),

7 people_numb = parseInt( $this.data('people') );

8

9 $this.rateYo({

10 rating: rate,

11 fullStar: true,

12 starWidth: "13px",

13 spacing: "3px",

14 onSet: function ( rating, rateYoInstance ) {

15 jQuery(this).rateYo("option", "readOnly", true);

16 var postid = jQuery(this).data('postid');

17

18 jQuery.ajax({

19 type: "POST",

20 url: PENCI.ajaxUrl,

21 dataType: 'html',

22 data: { action: 'penci_rateyo', nonce: PENCI.nonce, postid: postid, rating: rating },

23 success: function( data ) {

24 var parent = jQuery(this).parent(),

25 new_rate = ( total + rating ) / ( people_numb + 1 );

26 jQuery('.penci-rate-number', parent).html(new_rate);

27 $this.rateYo("rating", new_rate);

28 $this.parent().find('.penci-rate-number').html( new_rate.toPrecision(2) );

29 $this.parent().find('.penci-number-people').html( people_numb + 1 );

30 }

31 });

32 }

33 });

34

35 if ( allow == '0' ) {

36 $this.rateYo("option", "readOnly", true);

37 }

38 } );

39}