1var onLock = function(pubId, artId) { 2 // clear the paygated content 3 $('#pdfDownloadLink').html('PDF link loading...'); 4}; 5 6var onUnlock = function(pubId, artId) { 7 console.log(pubId,artId, "cointent"); 8 var tk = cointent.getAuthToken(); 9 var params = tk || {}; 10 params.publisher = pubId; 11 params.article = artId; 12 13 $.ajax({ 14 type : 'get', 15 url : '/getcontent.php', 16 data : params, 17 dataType : 'json', 18 success : function (response) { 19 if (!response) { 20 $('#pdfDownloadLink').html("No response content from server."); 21 return; 22 } 23 if (!response || !response.file || !response.expire) { 24 $('#pdfDownloadLink').html("Response from server is not valid JSON or does not contain file URL."); 25 if (response.error) { 26 console.error(response.error); 27 } 28 return; 29 } 30 var strLink = '<a href="' + response.file + '">Download PDF Version</a> <br/> '; 31 if(response.fileClean) 32 { 33 strLink += '<a href="'+ response.fileClean + '">Download G-Rated PDF Version</a> <br/> ' 34 } 35 strLink += '(Links expires in <span id="linkExpire">' + response.expire + '</span> sec)'; 36 37 $('#pdfDownloadLink').html(strLink); 38 setupCounter(response.expire); // set up number of seconds to count down 39 }, 40 error : function (response) { 41 $('#pdfDownloadLink').html('Network error.'); 42 console.error(response); 43 } 44 }); 45}; 46 47if (window.cointent) { 48 cointent.ready(function() { 49 cointent.addLockCallback(onLock); 50 cointent.addUnlockCallback(onUnlock); 51 }); 52} 53 54var interv; 55var setupCounter = function(sec) { 56 interv = setInterval(function() { 57 var current = parseInt($('#linkExpire').text()); 58 if (current > 1) { 59 $('#linkExpire').html( (current-1) ); 60 } else { 61 $('#linkExpire').html( 'Expired!' ); 62 clearInterval(interv); 63 } 64 }, 1000); 65};
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.