PageSourceSearch

https://www.langolodeilibri.it/wp-content/plugins/wp-review/public/js/main.js

js langolodeilibri.it collected 2026-10-02 12:38:56 UTC 3,035 bytes, 91 lines download raw bytes

1/*
2* Plugin Name: WP Review
3* Plugin URI: http://mythemeshop.com/plugins/wp-review/
4* Description: Create reviews! Choose from Stars, Percentages, Circles or Points for review scores. Supports Retina Display, WPMU & Unlimited Color Schemes.
5* Author: MyThemesShop
6* Author URI: http://mythemeshop.com/
7*/
8( function( $ ) {
9	"use strict";
10
11	$( document ).ready( function() {
12		$( '[data-wp-review-tabs] .tab-title:first-child' ).addClass( 'active' );
13		$( '[data-wp-review-tabs] .tab-content:first-of-type' ).fadeIn();
14
15		$( '[data-wp-review-tabs] .tab-title button' ).on( 'click', function( ev ) {
16			ev.preventDefault();
17			var $btn, $tabs, href;
18			$btn = $( this );
19			$tabs = $btn.closest( '[data-wp-review-tabs]' );
20			href = $btn.attr( 'data-href' );
21			$tabs.find( '.tab-title' ).removeClass( 'active' );
22			$btn.closest( '.tab-title' ).addClass( 'active' );
23			$tabs.find( '.tab-content' ).hide();
24			$tabs.find( href ).fadeIn();
25		});
26
27		// Show login required message.
28		$( document ).on( 'click', '.wpr-login-required', function( ev ) {
29			ev.preventDefault();
30
31			var $this = $( this ),
32				$message = $this.children( '.wpr-login-required-message' );
33
34			if ( ! $message.length ) {
35				$message = $( '<div class="wpr-login-required-message">' + wpreview.loginRequiredMessage + '</div>' );
36				$this.append( $message );
37			}
38
39			$message.show();
40
41			return false;
42		});
43	});
44})( jQuery );
45
46function wp_review_rate( $elem ) {// rating, postId, nonce ) {
47	var rating = $elem.find('.wp-review-user-rating-val').val();
48	var postId = $elem.find('.wp-review-user-rating-postid').val();
49	var token = $elem.find('.wp-review-user-rating-nonce').val();
50	var $target = $elem;
51
52	if ( ! $target.is('.wp-review-user-rating') )
53		$target = $elem.closest('.wp-review-user-rating');
54
55	if ( rating == 0 ) {
56		return '';
57	}
58
59	jQuery.ajax ({
60		beforeSend: function() {
61			$target.addClass('wp-review-loading');
62		},
63		data: { action: 'wp_review_rate', post_id: postId, nonce: token, review: rating },
64		type: 'post',
65		dataType: 'json',
66		url: wpreview.ajaxurl,
67		success: function( response ){
68			$target.removeClass('wp-review-loading');
69			if (typeof response.html !== 'undefined' && response.html != '') {
70				$target.empty().append(response.html).addClass('has-rated').removeClass('wp-review-user-rating');
71			}
72
73			// update text total
74			if (typeof response.rating_total !== 'undefined' && response.rating_total != '') {
75				$target.parent().find('.wp-review-user-rating-total').text(response.rating_total);
76			}
77			// update rating count
78			if (typeof response.rating_count !== 'undefined' && response.rating_count != '') {
79				$target.parent().find('.wp-review-user-rating-counter').text(response.rating_count);
80			}
81			if ( response.awaiting_moderation != undefined ) {
82				$target.parent().find('.user-total-wrapper .awaiting-response-wrapper').text(response.awaiting_moderation);
83  			}
84
85  			// Update cookie.
86			Cookies.set( 'wpr_visitor_has_reviewed_post_' + postId, 1, {
87				expires: 315360000000 // 10 years.
88			});
89		}
90	});
91}

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.