-
-
Save peterflynn/5980273 to your computer and use it in GitHub Desktop.
| // DEPRECATED: See "Expand All Comments" at https://gist.github.com/peterflynn/ace5dd3d7a8ec645cd42 for | |
| // a more up to date, maintained version of this. | |
| // Original bookmarklet from this gist (does not work anymore): | |
| // javascript:(function() { $(".outdated-diff-comment-container").addClass("open"); }()); | |
| // Newer, working version (from link above as of Jan 2017): | |
| // javascript:(function() { document.querySelectorAll(".outdated-diff-comment-container").forEach(function(n) {n.classList.add("open")}) }()); |
I think this stopped working. Doesn't look like github loads jQuery anymore, or at least $ isn't bound to it. I rewrote this in pure javascript and it works:
javascript:(function() {
elements = document.getElementsByClassName("outdated-diff-comment-container");
for (var i=0; i<elements.length; i++) { elements[i].className += " open"; }
}());Not sure if there's a better way (I'm not a JS guy).
@jessejoe worked for me, thanks!
The class name for the container has since changed to outdated-comment.
Updated version:
javascript:Array.from(document.getElementsByClassName('outdated-comment')).forEach(l => l.classList.add('open'));Thanks to yuichiro-yoshida's comment at https://coderwall.com/p/akdgoq/expand-all-outdated-diff-comments-in-a-github-pull-request
Updated version:
javascript: Array.from(document.getElementsByClassName('outdated-diff-comment-container'))
.concat(Array.from(document.getElementsByClassName('outdated-comment')))
.forEach(l => l.classList.add('open'));Detail:
https://coderwall.com/p/akdgoq/expand-all-outdated-diff-comments-in-a-github-pull-request
In case you are interested: This was recently implemented in the browser extension sindresorhus/refined-github
Updated JS bookmark for recent Github redesign:
javascript:Array.from(document.getElementsByClassName('outdated-comment')).forEach(l => l.setAttribute('open',true));
And as a bookmarklet: