1(function ($) { 2 "use strict"; 3 4 var PENCI_RECIPE = PENCI_RECIPE || {}; 5 6 PENCI_RECIPE.penci_rating_recipe = function () { 7 if ($(".penci_rateyo").length) { 8 $(".penci_rateyo").each(function () { 9 var $this = $(this), 10 rate = parseFloat($this.data("rate")), 11 allow = $this.data("allow"), 12 total = $this.data("total"), 13 postidsub = $this.data("postidsub"), 14 people_numb = parseInt($this.data("people")); 15 16 $this.rateYo({ 17 rating: rate, 18 fullStar: true, 19 starWidth: "13px", 20 spacing: "3px", 21 onSet: function (rating) { 22 $this.rateYo("option", "readOnly", true); 23 var postid = $this.data("postid"); 24 25 $.ajax({ 26 type: "POST", 27 url: PENCI.ajaxUrl, 28 dataType: "html", 29 data: { 30 action: "penci_rateyo", 31 nonce: PENCI.nonce, 32 postid: postid, 33 postidsub: postidsub, 34 rating: rating, 35 }, 36 success: function (data) { 37 var parent = $this.parent(), 38 new_rate = 39 (total + rating) / (people_numb + 1); 40 parent.find(".penci-rate-number").html(new_rate.toPrecision(2)); 41 parent.find(".penci-number-people").html(people_numb + 1); 42 $this.rateYo("rating", new_rate); 43 }, 44 error: function () { 45 console.error("AJAX request failed."); 46 }, 47 }); 48 }, 49 }); 50 51 if (allow == "0") { 52 $this.rateYo("option", "readOnly", true); 53 } 54 }); 55 } 56 }; 57 58 PENCI_RECIPE.penci_rating_recipe_review = function () { 59 60 if ( ! PENCI.ajax_review ) { 61 return; 62 } 63 64 $(".penci-recipe-review").each(function () { 65 var $this = $(this), 66 recipe_id = $this.data("recipe-id"); 67 68 if ($this.hasClass("penci-recipe-review-loaded")) { 69 return; 70 } 71 72 $.ajax({ 73 type: "POST", 74 url: PENCI.ajaxUrl, 75 dataType: "html", 76 data: { 77 action: "penci_get_recipe_rating", 78 nonce: PENCI.nonce, 79 recipe_id: recipe_id, 80 }, 81 success: function (data) { 82 $this.html(data); 83 $this.addClass("penci-recipe-review-loaded"); 84 PENCI_RECIPE.penci_rating_recipe(); 85 }, 86 error: function () { 87 console.error("AJAX request failed."); 88 }, 89 }); 90 }); 91 } 92 93 $(document).ready(function () { 94 PENCI_RECIPE.penci_rating_recipe(); 95 PENCI_RECIPE.penci_rating_recipe_review(); 96 }); 97 98 $(window).on("elementor/frontend/init", function () { 99 if (window.elementorFrontend && elementorFrontend.isEditMode()) { 100 elementorFrontend.hooks.addAction( 101 "frontend/element_ready/penci-recipe.default", 102 function () { 103 PENCI_RECIPE.penci_rating_recipe(); 104 } 105 ); 106 } 107 }); 108})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.