PageSourceSearch

https://www.obcasnik.eu/wp-content/plugins/wp-review/public/js/main.js?ver=5.1.6

js obcasnik.eu collected 2026-10-02 19:09:57 UTC 3,376 bytes, 104 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( $, wpreview, Cookies ) {
9	"use strict";
10
11	wpreview.getAnimateDuration = function( animation ) {
12		if ( ! animation ) {
13			return 0;
14		}
15		switch ( animation ) {
16			case 'flipOutX':
17			case 'flipOutY':
18			case 'bounceIn':
19			case 'bounceOut':
20				return 750;
21
22			case 'hinge':
23				return 2000;
24		}
25
26		return 1000;
27	};
28
29	$( document ).ready( function() {
30		$( '.wp_review_comment.verified cite, .wp_review_comment.verified .fn' ).after( '<em> ' + wpreview.verifiedPurchase + '</em>' );
31
32		// $( '[data-ui-tabs]' ).tabs();
33
34		$( '[data-wp-review-tabs] .tab-title:first-child' ).addClass( 'active' );
35		$( '[data-wp-review-tabs] .tab-content:first-of-type' ).fadeIn();
36
37		$( '[data-wp-review-tabs] .tab-title button' ).on( 'click', function( ev ) {
38			ev.preventDefault();
39			var $btn, $tabs, href;
40			$btn = $( this );
41			$tabs = $btn.closest( '[data-wp-review-tabs]' );
42			href = $btn.attr( 'data-href' );
43			$tabs.find( '.tab-title' ).removeClass( 'active' );
44			$btn.closest( '.tab-title' ).addClass( 'active' );
45			$tabs.find( '.tab-content' ).hide();
46			$tabs.find( href ).fadeIn();
47		});
48
49		$( '#commentform' ).on( 'submit', function( ev ) {
50			$( this ).find( '.wpr-error' ).remove();
51			if ( $( this ).hasClass( 'wpr-uncompleted-rating' ) ) {
52				$( this ).append( '<div class="wpr-error">' + wpreview.rateAllFeatures + '</div>' );
53				ev.preventDefault();
54			}
55		});
56	});
57})( jQuery, window.wpreview || {}, Cookies );
58
59function wp_review_rate( $elem ) {// rating, postId, nonce ) {
60	var rating = $elem.find('.wp-review-user-rating-val').val();
61	var postId = $elem.find('.wp-review-user-rating-postid').val();
62	var token = $elem.find('.wp-review-user-rating-nonce').val();
63	var $target = $elem;
64
65	if ( ! $target.is('.wp-review-user-rating') )
66		$target = $elem.closest('.wp-review-user-rating');
67
68	if ( rating == 0 ) {
69		return '';
70	}
71
72	jQuery.ajax ({
73		beforeSend: function() {
74			$target.addClass('wp-review-loading');
75		},
76		data: { action: 'wp_review_rate', post_id: postId, nonce: token, review: rating },
77		type: 'post',
78		dataType: 'json',
79		url: wpreview.ajaxurl,
80		success: function( response ){
81			$target.removeClass('wp-review-loading');
82			if (typeof response.html !== 'undefined' && response.html != '') {
83				$target.empty().append(response.html).addClass('has-rated').removeClass('wp-review-user-rating');
84			}
85
86			// update text total
87			if (typeof response.rating_total !== 'undefined' && response.rating_total != '') {
88				$target.parent().find('.wp-review-user-rating-total').text(response.rating_total);
89			}
90			// update rating count
91			if (typeof response.rating_count !== 'undefined' && response.rating_count != '') {
92				$target.parent().find('.wp-review-user-rating-counter').text(response.rating_count);
93			}
94			if ( response.awaiting_moderation != undefined ) {
95				$target.parent().find('.user-total-wrapper .awaiting-response-wrapper').text(response.awaiting_moderation);
96  			}
97
98  			// Update cookie.
99			Cookies.set( 'wpr_visitor_has_reviewed_post_' + postId, 1, {
100				expires: 315360000000 // 10 years.
101			});
102		}
103	});
104}

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.