1var $document = jQuery(document); 2 3$document.ready(function() { 4 5 'use strict'; 6 7 /* MOUSEMOVE HANDLER 8 -------------------------------------------------- */ 9 $document.on( 'mousemove', '.taq-user-rate-active', function(e){ 10 var $rated = jQuery(this); 11 if( $rated.hasClass('rated-done') ){ 12 return false; 13 } 14 15 if( !e.offsetX ){ 16 e.offsetX = e.clientX - jQuery(e.target).offset().left; 17 } 18 19 var offset = e.offsetX + 4; 20 if( offset > 100 ){ 21 offset = 100; 22 } 23 24 $rated.find( '.user-rate-image span' ).css( 'width', offset + '%' ); 25 var score = Math.floor(((offset / 10) * 5)) / 10; 26 if( score > 5 ){ 27 score = 5; 28 } 29 }); 30 31 32 /* MOUSEMOVE HANDLER 33 -------------------------------------------------- */ 34 $document.on( 'click', '.taq-user-rate-active', function(){ 35 36 var $rated = jQuery(this), 37 $ratedParent = $rated.parent(), 38 $ratedCount = $ratedParent.find('.taq-count'), 39 post_id = $rated.attr( 'data-id' ), 40 numVotes = $ratedCount.text(); 41 42 if( $rated.hasClass('rated-done') || $rated.hasClass('rated-in-progress') ){ 43 return false; 44 } 45 46 $rated.addClass('rated-in-progress'); 47 48 var userRatedValue = $rated.find('.user-rate-image span').width(); 49 $rated.find( '.user-rate-image' ).hide(); 50 $rated.append('<span class="taq-load"></span>'); 51 52 if (userRatedValue >= 95) { 53 userRatedValue = 100; 54 } 55 56 var userRatedValueCalc = (userRatedValue*5)/100; 57 58 // Ajax Call ---------- 59 jQuery.post( 60 taqyeem.ajaxurl, 61 { 62 action: 'taqyeem_rate_post', 63 post : post_id, 64 value : userRatedValueCalc 65 }, 66 function( data ) { 67 $rated.addClass('rated-done').attr('data-rate',userRatedValue); 68 $rated.find('.user-rate-image span').width(userRatedValue+'%'); 69 70 jQuery('.taq-load').fadeOut(function () { 71 $ratedParent.find('.taq-score').html( userRatedValueCalc ); 72 73 if( $ratedCount.length > 0 ){ 74 numVotes = parseInt(numVotes)+1; 75 $ratedCount.html(numVotes); 76 } 77 else{ 78 $ratedParent.find('small').hide(); 79 } 80 81 $ratedParent.find('strong').html(taqyeem.your_rating); 82 $rated.find('.user-rate-image').fadeIn(); 83 }); 84 }, 'html'); 85 86 return false; 87 }); 88 89 90 /* MOUSELEAVE HANDLER 91 -------------------------------------------------- */ 92 $document.on( 'mouseleave', '.taq-user-rate-active' , function(){ 93 var $rated = jQuery(this); 94 if( $rated.hasClass('rated-done') ){ 95 return false; 96 } 97 var post_rate = $rated.attr('data-rate'); 98 $rated.find('.user-rate-image span').css('width', post_rate + '%'); 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.