PageSourceSearch

https://snackgator.com/wp-content/plugins/wp-review/assets/js/main.js?ver=4.0.17

js snackgator.com collected 2026-10-02 19:52:29 UTC 3,413 bytes, 101 lines download raw bytes

1/*
2* Plugin Name: WP Review
3* Plugin URI: https://wordpress.org/plugins/wp-review/
4* Description: Create reviews! Choose from Stars, Percentages or Points for review scores. Supports Retina Display, WPMU & Unlimited Color Schemes.
5* Author: MyThemesShop
6* Author URI: http://mythemeshop.com/
7*/
8jQuery(document).ready(function($) {
9	
10	$('.wp-review-comment-field.allowed-to-rate a').on('click', function() {
11		var $this = $(this),
12			$elem = $this.closest('.wp-review-comment-field');
13		if ($elem.hasClass('allowed-to-rate')) {
14			$elem.removeClass('has-not-rated-yet');
15			$elem.find('.review-result').css('width', parseInt($this.data('input-value'))*20+'%');
16			$elem.find('.wp_review_comment_rating').val($this.data('input-value'));
17		}
18	});
19	
20	var $commentFeedback = $('.wp-review-feedback');
21	$commentFeedback.on('click', 'a', function(e){
22		var $this = $(this);
23
24		e.preventDefault();
25
26		if ( $this.hasClass('voted') || $this.siblings().hasClass('voted') || $commentFeedback.hasClass('processing') ) return;
27
28		$.ajax({
29			type: 'POST',
30			url: wpreview.ajaxurl,
31			beforeSend: function(){
32				$commentFeedback.addClass('processing');
33			},
34			data: { action: 'mts_review_feedback', isHelpful: $this.data('value'), commentId: $this.data('comment-id') },
35			success: function(data){
36				$this.closest('.wp-review-feedback').find('a').removeClass('voted');
37				$this.addClass('voted').find('.feedback-count').text('('+data+')');
38			},
39			error: function(jqXHR){
40				alert(jqXHR.responseText);
41			},
42			complete: function() {
43				$commentFeedback.removeClass('processing');
44			}
45		});
46	});
47	
48
49	/* 
50		Add class to comment form
51	 */
52	if ($('#wp-review-comment-title-field').length) {
53		$('#wp-review-comment-title-field').closest('form').addClass('wp-review-comment-form');
54	}
55
56});
57
58function wp_review_rate( $elem ) {// rating, postid, nonce ) {
59	var is_comment_rating = ($elem.is('.wp-review-comment-rating-star') || !!$elem.closest('.wp-review-comment-rating-star').length);
60	if ( is_comment_rating ) {
61		return ''; // don't do anything if it's a comment rating element
62	}
63	var rating = $elem.find('.wp-review-user-rating-val').val();
64	var postid = $elem.find('.wp-review-user-rating-postid').val();
65	var token = $elem.find('.wp-review-user-rating-nonce').val();
66	var $target = $elem;
67	
68	if ( ! $target.is('.wp-review-user-rating') )
69		$target = $elem.closest('.wp-review-user-rating');
70
71	if (rating == 0) {
72		return '';
73	}
74
75	jQuery.ajax ({
76		beforeSend: function() {
77			$target.addClass('wp-review-loading');
78		},
79		data: { action: 'wp_review_rate', post_id: postid, nonce: token, review: rating },
80		type: 'post',
81		dataType: 'json',
82		url: wpreview.ajaxurl,
83		success: function( response ){
84			$target.removeClass('wp-review-loading');
85			if (typeof response.html !== 'undefined' && response.html != '') {
86				$target.empty().append(response.html).addClass('has-rated');
87			}
88				
89			// update text total
90			if (typeof response.rating_total !== 'undefined' && response.rating_total != '') {
91				$target.parent().find('.wp-review-user-rating-total').text(response.rating_total);	
92			}
93			// update rating count
94			if (typeof response.rating_count !== 'undefined' && response.rating_count != '') {
95				$target.parent().find('.wp-review-user-rating-counter').text(response.rating_count);				
96			}
97		}
98	});
99
100	
101}

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.