-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add way to load *all* comments when some are hidden due to number of comments #1892
Comments
This kinda makes sense because if I'm looking for something in those comments, chances are I want to check them all out. However we still need to limit this to, maybe 3 loads at a time, or else on the rare super-long discussion it might load too many pages nobody needs. |
Here’s maybe a simpler request: could we add a “load more ...” button that is always in the same (hopefully easily accessible) location, eg right below the description, and just grated out when all are loaded, so that the work flow for loading all comments doesn’t involve repeatedly searching for the link after each load, and instead one can just sit and hit the button in one place until it’s all done? |
I don’t think that can integrate nicely with the design. |
This can just be added with alt+click, it will probably look a lot like |
Funnily enough, I came searching for this feature request for the exact same reason (searching for a string in Rust RFCs, and not finding them because the comments are collapsed). What makes this even more awkward is that searching for that string in the repo itself does return issues containing that string as a result, but then opening that issue, the string can no longer be found, because it is collapsed. Personally, I'd like to have a "load all" button, or even better yet "always load all", but I can see how that might be detremental to page loading times (although the current workflow described by @pnkfelix of having to grep for "load more" clicking it, and repeating that several times takes way more time than an initial load all would cost). |
I would really appreciate this feature. For now, here's a recursive user script that works for me: function loadAllComments() {
let needRescheduling = false;
const buttons = Array.from(document.querySelectorAll('button'));
buttons.forEach((button) => {
if (button.classList.contains('ajax-pagination-btn')) {
if(!button.hasAttribute('disabled') && button.innerText === 'Load more…') {
console.log("found", button);
needRescheduling = true;
button.dispatchEvent(new MouseEvent('click', {
bubbles: true,
cancelable: true
}));
}
else if(button.hasAttribute('disabled') && button.innerText === 'Loading…') {
console.log("waiting", button);
needRescheduling = true;
}
else {
console.log("unrecognized 'Load more' button", button);
}
}
});
if (needRescheduling) {
setTimeout(loadAllComments, 200)
}
else {
console.log("all comments loaded");
}
}
loadAllComments(); Here's a version that also expands "Show resolved" comments: function loadAllCommentsAndShowResolved() {
let needRescheduling = false;
const elems = Array.from(document.querySelectorAll('button, .btn-link.Details-content--closed'));
elems.forEach((elem) => {
if (elem.classList.contains('ajax-pagination-btn')) {
if (!elem.hasAttribute('disabled') && elem.innerText === 'Load more…') {
console.log("found", elem);
needRescheduling = true;
elem.dispatchEvent(new MouseEvent('click', {
bubbles: true,
cancelable: true
}));
}
else if (elem.hasAttribute('disabled') && elem.innerText === 'Loading…') {
console.log("waiting", elem);
needRescheduling = true;
}
else {
console.log("unrecognized 'Load more' button", elem);
}
}
else if (elem.classList.contains('Details-content--closed') && elem.innerText === 'Show resolved') {
elem.dispatchEvent(new MouseEvent('click', {
bubbles: true,
cancelable: true
}));
}
});
if (needRescheduling) {
setTimeout(loadAllCommentsAndShowResolved, 200)
}
else {
console.log("all comments loaded");
}
}
loadAllCommentsAndShowResolved(); |
Fixes refined-github#1892 Github has a "feature" that hides a large fraction of the comments in long issue/PR threads, requiring the user to click a "Show hidden button" to see them. Not only can this cut off important parts of a discussion, clicking the button only reveals *some* of the hidden comments. To show the entire thread, a user must: 1. Search on the page for "show hidden" 2. Click the button 3. Wait several seconds for an AJAX request to complete and the page to update 4. Go back to step 1 if there are more hidden comments This must be done every time the user nagivates to an issue/PR page. This PR adds a new feature called 'load-hidden-comments', which performs this process automatically on page load. It dramatically speeds up the process by modifiying the undocumented API request (github.com/_render_node/...) used by the "Show hidden button". By increasing the "variables[first]" query parameter from "60" to the total number of hidden requests, we can load all hidden comments with a single HTTP request. Since the URL being modified is undocumented, this trick could break at any time. However, the alternative is to repeatedly click the (newly generated) button after each partial comment fetch completes. This takes *significantly* longer, and results in janky scrollbar behavior due to comments being added one chunk at a time.
Fixes refined-github#1892 Github has a "feature" that hides a large fraction of the comments in long issue/PR threads, requiring the user to click a "Show hidden button" to see them. Not only can this cut off important parts of a discussion, clicking the button only reveals *some* of the hidden comments. To show the entire thread, a user must: 1. Search on the page for "show hidden" 2. Click the button 3. Wait several seconds for an AJAX request to complete and the page to update 4. Go back to step 1 if there are more hidden comments This must be done every time the user nagivates to an issue/PR page. This PR adds a new feature called 'load-hidden-comments', which performs this process automatically on page load. It dramatically speeds up the process by modifiying the undocumented API request (github.com/_render_node/...) used by the "Show hidden button". By increasing the "variables[first]" query parameter from "60" to the total number of hidden requests, we can load all hidden comments with a single HTTP request. Since the URL being modified is undocumented, this trick could break at any time. However, the alternative is to repeatedly click the (newly generated) button after each partial comment fetch completes. This takes *significantly* longer, and results in janky scrollbar behavior due to comments being added one chunk at a time.
The above recursive script is outdated. Here's a script that will load all hidden comments, including resolved.
|
Look at rust-lang/rfcs#2544
Scroll down the the "Load more ..." (below "NNN hidden items" for some NNN).
The link there only loads some of the comments. It would be great to have a way to load all of them (e.g. it would help for people who then use search to find text in the page).
(I did try Alt-click; it did not work for me in this context.)
The text was updated successfully, but these errors were encountered: