Re:Show HN: Quickly browse the history of any GitHub file
by buremba on Friday February 08, 2019 @08:20AM
(#19113847)
Could you please make a bookmarklet as an alternative to Chrome extension?
[ Parent
| on HN ]
Re:Show HN: Quickly browse the history of any GitHub file
by pedroborges on Friday February 08, 2019 @08:46AM
(#19114021)
I just built a simple bookmarklet for myself. I hope you like it!
javascript:(function(l){l.host.match('github.com') && (l.href = l.origin.replace('.com', '') + '.githistory.xyz' + l.pathname)})(window.location);
Re:Show HN: Quickly browse the history of any GitHub file
by mhw on Friday February 08, 2019 @10:45AM
(#19115229)
Not quite as pretty, but here's a bookmarklet that allows you to go back by one commit in the github.com blame view (e.g. https://github.com/babel/babel/blame/master/packages/babel-c...). It basically finds the most recent 'View blame prior to this commit' link and follows it.
javascript:(function(l){l.host.match('github.com') && (l.href = Array.prototype.slice.apply(document.querySelectorAll('.blame-hunk')).map((d) => [new Date(d.querySelector(".blame-commit-date time-ago").getAttribute('datetime')), d.querySelector(".blob-reblame a") && d.querySelector(".blob-reblame a").getAttribute('href')]).sort((a,b) => a[0] < b[0])[0][1])})(window.location);