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})( jQuery ); 28 29function wp_review_rate( $elem ) {// rating, postId, nonce ) { 30 var rating = $elem.find('.wp-review-user-rating-val').val(); 31 var postId = $elem.find('.wp-review-user-rating-postid').val(); 32 var token = $elem.find('.wp-review-user-rating-nonce').val(); 33 var $target = $elem; 34 35 if ( ! $target.is('.wp-review-user-rating') ) 36 $target = $elem.closest('.wp-review-user-rating'); 37 38 if ( rating == 0 ) { 39 return ''; 40 } 41 42 jQuery.ajax ({ 43 beforeSend: function() { 44 $target.addClass('wp-review-loading'); 45 }, 46 data: { action: 'wp_review_rate', post_id: postId, nonce: token, review: rating }, 47 type: 'post', 48 dataType: 'json', 49 url: wpreview.ajaxurl, 50 success: function( response ){ 51 $target.removeClass('wp-review-loading'); 52 if (typeof response.html !== 'undefined' && response.html != '') { 53 $target.empty().append(response.html).addClass('has-rated').removeClass('wp-review-user-rating'); 54 } 55 56 // update text total 57 if (typeof response.rating_total !== 'undefined' && response.rating_total != '') { 58 $target.parent().find('.wp-review-user-rating-total').text(response.rating_total); 59 } 60 // update rating count 61 if (typeof response.rating_count !== 'undefined' && response.rating_count != '') { 62 $target.parent().find('.wp-review-user-rating-counter').text(response.rating_count); 63 } 64 if ( response.awaiting_moderation != undefined ) { 65 $target.parent().find('.user-total-wrapper .awaiting-response-wrapper').text(response.awaiting_moderation); 66 } 67 68 // Update cookie. 69 Cookies.set( 'wpr_visitor_has_reviewed_post_' + postId, 1, { 70 expires: 315360000000 // 10 years. 71 }); 72 } 73 }); 74}
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.