1(function( $ ) { 2 'use strict'; 3 4 $(function() { 5 $( "a[cml]" ).each(function( index ) { 6 $( this ).click(function(event) { 7 8 var link = $( this ).attr( 'cml' ); 9 var target = $( this ).attr( 'cmt' ); 10 11 countClick(link); 12 13 if (event.ctrlKey || target == '_blank') { 14 window.open( decode(link), '_blank').focus(); 15 }else { 16 document.location.href = decode(link); 17 } 18 }); 19 20 }); 21 }); 22 23})( jQuery ); 24 25/** 26 * https://stackoverflow.com/questions/30106476/using-javascripts-atob-to-decode-base64-doesnt-properly-decode-utf-8-strings 27 **/ 28function decode( str ) { 29 //decodeURIComponent( window.atob(link) ); 30 // Going backwards: from bytestream, to percent-encoding, to original string. 31 return decodeURIComponent(atob(str).split('').map(function(c) { 32 return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2); 33 }).join('')); 34} 35 36function countClick(identifier){ 37 var data = { 38 'action': 'count_click', 39 'link': identifier, 40 'nonce': ajax_object.nonce 41 }; 42 43 // We can also pass the url value separately from ajaxurl for front end AJAX implementations 44 jQuery.ajax({ 45 type: "POST", 46 url: ajax_object.ajax_url, 47 data: data, 48 async: false, 49 success: function(response){ 50 console.log('Got this from the server: ' + response); 51 return true; 52 } 53 }); 54}
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.