Created
July 17, 2019 21:40
-
-
Save spkellydev/43ecf0456e5f4e576dcbedace91f3be2 to your computer and use it in GitHub Desktop.
Function to get to the first commit PAGE of any github repo.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// copy and paste into devtools, press enter. voila | |
function githubFirstCommitsPage() { | |
let el = document.querySelector('.repository-content'); | |
let base = el.querySelector('a[data-pjax]').href; | |
let count = el.querySelector('.commits .num') | |
.textContent | |
.trim() | |
.replace(/[^\d\.\-]/g, ""); | |
count = count-36; | |
let sha = el.querySelector('.commit-tease-sha') | |
.href | |
.split('/'); | |
sha = sha[sha.length-1]; | |
window.location = `${base}?after=${sha}+${count}`; | |
} | |
githubFirstCommitsPage(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment