|
When visiting a GitHub pull request page, this script will expand all
collapsed outdated comments. This facilitates seeing comment responses
that may have been hidden by more recent changes.
Originally this code was supposed to be a bookmarklet. Invoking it would
toggle all the comments to be expanded or collapsed. I tried this, but
it didn't work:
javascript:(function() { var outdated_buttons = document.querySelectorAll('.js-comment-container.outdated-comment:not(.open) .show-outdated-button'); for (var i = 0; i < outdated_buttons.length; i++) { outdated_buttons[i].click(); } })()
(Also tried with the characters converted to HTML entities.)
The reason why it didn't work is that GitHub apparently has a Content
Security Policy (CSP) in place that prevents the execution of
bookmarklets. Yes, it's for anti-XSS security, but what kind of internet
is this where bookmarlets don't work any more? Not the kind of internet
I want. That makes one less fun thing about the web, how disappointing.
Since a bookmarlet won't work, make it a Greasemonkey user script
instead. And instead of toggling comments, just expand them by default
all the time.
|