diff options
author | Teddy Wing | 2017-12-07 20:57:51 +0100 |
---|---|---|
committer | Teddy Wing | 2017-12-07 20:57:51 +0100 |
commit | fe09ad0dbd6faa6abeb8d0df81f9f45c16bb0d4d (patch) | |
tree | cb7f61def34935c460356dd08619604dead1454b /github-open-all-outdated-comments.user.js | |
download | GitHub-Open-All-Outdated-Comments-fe09ad0dbd6faa6abeb8d0df81f9f45c16bb0d4d.tar.bz2 |
Initial commit. Expands all hidden outdated comments on GitHub PRs.
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.
Diffstat (limited to 'github-open-all-outdated-comments.user.js')
-rw-r--r-- | github-open-all-outdated-comments.user.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/github-open-all-outdated-comments.user.js b/github-open-all-outdated-comments.user.js new file mode 100644 index 0000000..603dda5 --- /dev/null +++ b/github-open-all-outdated-comments.user.js @@ -0,0 +1,16 @@ +// ==UserScript== +// @name GitHub Open All Outdated Comments +// @namespace com.teddywing +// @description Opens all outdated pull request comments +// @match https://*.github.com/*/*/pull/* +// @version 0.0.1 +// @grant none +// ==/UserScript== + +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(); +} |