1const userName = "haoyuma2002814"; 2const desiredRepo = "haoyuma2002814.github.io"; 3const gitHubPersonalAccessToken = "placeholder"; 4const dateTagClass = ".date"; 5const months = ["Jan.", "Feb.", "Mar.", "Apr.", "May", "Jun.", "Jul.", "Aug.", "Sep.", "Oct.", "Nov.", "Dec."]; 6 7var xhttp = new XMLHttpRequest(); 8xhttp.onreadystatechange = function() 9{ 10 if (this.readyState == 4 && this.status == 200) 11 { 12 let repo = JSON.parse(this.responseText); 13 14 var lastUpdated = new Date(repo.pushed_at); 15 var day = lastUpdated.getUTCDate(); 16 var month = lastUpdated.getUTCMonth(); 17 var year = lastUpdated.getUTCFullYear(); 18 $(dateTagClass).text(`Updated ${months[month]} ${day}, ${year}`); 19 } 20 else if (this.readyState == 4 && this.status == 401) 21 { 22 $(dateTagClass).text(`Token Expired!`); 23 } 24}; 25 26xhttp.open("GET", `https://api.github.com/repos/${userName}/${desiredRepo}`, true); 27xhttp.setRequestHeader('Authorization', `Bearer ${gitHubPersonalAccessToken}`); 28 29xhttp.send();
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.