1var cruminaPostReaction = { 2 busy: false, 3 init: function () { 4 this.addEventListeners(); 5 }, 6 7 addEventListeners: function () { 8 var _this = this; 9 10 jQuery( 'body' ).on( 'click', 'a.reaction-toggle-icon', function ( event ) { 11 event.preventDefault(); 12 var $self = jQuery( this ); 13 14 console.log($self); 15 16 if ( !$self.hasClass( 'disabled' ) ) { 17 _this.toggleReaction( $self ); 18 $self.attr('data-balloon','Voted!') 19 } 20 21 } ); 22 }, 23 24 toggleReaction: function ( $self ) { 25 var _this = this; 26 var $parent = $self.closest( '.reaction-toggle-parent' ); 27 var postID = $parent.data( 'post' ); 28 29 if ( _this.busy ) { 30 return false; 31 } 32 33 _this.busy = true; 34 jQuery.ajax( { 35 url: crumina_reaction.ajax, 36 dataType: 'json', 37 type: 'POST', 38 data: { 39 action: 'crumina_reaction_toggle', 40 post: postID, 41 nonce: $parent.data( 'nonce' ), 42 type: $self.data( 'type' ) 43 }, 44 success: function ( data ) { 45 if ( data.success ) { 46 // Replace reactions 47 jQuery( '.reactions-btns-' + postID ).replaceWith( data.data.reactions ); 48 jQuery( '.reactions-count-all-' + postID ).replaceWith( data.data['count-all'] ); 49 jQuery( '.reactions-count-compact-' + postID ).replaceWith( data.data['count-compact'] ); 50 jQuery( '.reactions-count-used-' + postID ).replaceWith( data.data['count-used'] ); 51 52 } else { 53 swal( 'Oops...', data.data.message, 'error' ); 54 } 55 }, 56 complete: function () { 57 _this.busy = false; 58 } 59 } ); 60 61 } 62}; 63 64jQuery( document ).ready( function () { 65 cruminaPostReaction.init(); 66} );
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.