1$.getJSON( "https://webcore.unm.edu/stats.json") 2 .done(function( json ) { 3 showStats(json); 4 }) 5 .fail(function( jqxhr, textStatus, error ) { 6 var err = textStatus + ", " + error; 7 //console.log( "Request Failed: " + err ); 8}); 9 10function showStats(json) { 11 //console.log( "JSON Data: " + json.stats.stat[0].datastat ); 12 //console.log( "JSON Count: " + json.stats.stat.length ); 13 var maxstat = json.stats.stat.length; 14 //console.log('Random: ' + randomRange(1, maxstat-1, 5)) 15 var statlist = randomRange(0, maxstat, 4); 16 for (var i in statlist) { 17 //console.log(json.stats.stat[statlist[i]].datastat); 18 outputStat(json.stats.stat[statlist[i]]); 19 } 20} 21 22function outputStat(stat) { 23 thestat = '<div class="stat"><span class="datastat">' + stat.datastat + '</span>'; 24 thestat += '<span class="datatext">' + stat.datatext +'</span>'; 25// if (typeof stat.dataicon !== 'undefined') { 26// thestat += '<span class="dataicon"> <span class="'+ stat.dataicon +'"> </span></span></div>'; 27// } 28 thestat += '</div>'; 29 $("#thenumbers").append(thestat); 30} 31 32function randomRange(from, to, leng){ 33 var tem, A= [], L= 0, i= 0; 34 randomRangeLoop: 35 while(L< leng){ 36 tem= Math.floor(Math.random()*to)+from; 37 i= 0; 38 while(i<L){ 39 if(A[i++]=== tem) continue randomRangeLoop; 40 } 41 A[L++]= tem; 42 } 43 return A; 44}
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.