-
-
Notifications
You must be signed in to change notification settings - Fork 167
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
GitHub remove diff signs: not all files get their signs removed #15
Comments
Hi @duianto! Thanks for letting me know! I've been trying to fix this issue... give me a little more time to get it working properly in all cases. |
Ok, I think I got it all fixed... I've noticed that sometimes, when navigating from another page or tab to the "Files changed" tab, the dynamically loaded content doesn't always get processed. I added a 500ms delay which may, or may not process the new content; and attempts to get it to alway work have come up short. Reloading the page should always work. |
And using |
@jerone I was not originally using You probably already know most of the information below, but I'm sharing all of my findings so that other developers may benefit from my research in this topic. I'm sure there are better solutions, but I was going cross-eyed from looking at GitHub's minified javascript.
|
I updated the script in Tampermonkey and now it says:
Unfortunately there doesn't seem to have been any change in the first two example links above, the same number of files have their signs removed and the rest are still showing signs. The third example also look the same when the page first loads, the last two visible files show signs. But when one clicks on "Load diff ..." on one of the two hidden files to show the code, then the revealed code shows the signs for half a second (as expected with the added 500ms delay), then the signs for all three visible files get removed. And when the "Load diff ..." is clicked to show the code for the last hidden file, then it also shows the signs for half a second before they are removed.
Nothing changes in any of the 3 examples when the pages are reloaded. I took a screenshot of the Network tab in Chromes Developer Tools when the first example link loads: The |
Odd, I've been testing the userscript on all 3 of those pages... |
I can see it working 3 out of 4 times with above example page loading. |
It's working every time for me. Internally there is a loop that removes the +/- signs at intervals to allow continued user interaction with the page. |
This page is consistently not working: https://github.com/Mottie/Keyboard/pull/363/files Edit: only at load time, after opening one of the hidden diffs it works. |
Which blocks? |
@Mottie commented on 25 mrt. 2017 16:31 CET:
All blocks, but only at load time. After force opening one of the hidden diffs, all signs are removed. |
I disabled all but one chrome extension tampermonkey, closed all but this tab, restarted chrome, turned off all other applications, including the once that were running in the system tray, i even restarted the computer and tested the examples between each step. The first two examples always work as described in the initial report. But the third example sometimes open with the 2 visible files having their signs removed. But every time i refresh the third examples tab, then the signs are shown again with or without |
I'm on GreaseMonkey in Firefox. Also tested with and without cache. Calling |
Derp... ok I think I see the problem LOL. Odd that it was working fine in Chrome, but not in Firefox. |
I added these logs before and after the if query selector line: console.log("pre .highlight");
if (document.querySelector(".highlight")) {
console.log("in .highlight"); and when the page: loads then only the "pre .highlight" message appears in the developer tools console, but when i click on "Load diff" to show the code for one of the two files, then both the |
Try the update I just pushed. |
Yep now it seems to be working 😄 👍 |
All examples on this page are working for me too now 🎉 |
I just added a How to wiki page with my current take on how I deal with GitHub and progressively loaded content. Let me know what you guys think. |
Hello, I just found the "GitHub remove diff signs" userscript, thanks for making it.
But it seems to have a bug, the
+
and-
signs doesn't get removed from all files in the "Files changed" tab of some pull requests.Here's an example with 6 files:
https://github.com/Mottie/tablesorter/pull/195/files
the signs have been removed from the first 5 files, but they are still shown in the last file:
js/jquery.tablesorter.js
.And here's another example with 17 files:
https://github.com/Mottie/tablesorter/pull/1293/files
the signs have been removed from the first 3 files, but they are still there from the 4th file:
js/widgets/widget-filter-formatter-html5.js
down.Here's an example with 4 files. The first two files are hidden until one clicks on them:
https://github.com/Mottie/Keyboard/pull/363/files
the first one says:
and the second file says:
The signs on the last 2 files are shown. When one clicks on the first 2 files to show their diffs, then the signs are still visible on them as well.
The script seems to work fine on the pull requests I've seen with only 1 or 2 files.
System info
Windows 10 1607 (OS Build 14393.953)
Google Chrome 56.0.2924.87 (Official Build) (32-bit)
Tampermonkey v4.2.7
GitHub Remove Diff Signs 1.0.2
The text was updated successfully, but these errors were encountered: