Skip to content
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 Commit Diff doesn't work in new UI #167

Open
rybak opened this issue Aug 20, 2023 · 1 comment
Open

Github Commit Diff doesn't work in new UI #167

rybak opened this issue Aug 20, 2023 · 1 comment

Comments

@rybak
Copy link

rybak commented Aug 20, 2023

Originally reported on Greasy Fork.


Doesn't seem to work in the new GitHub UI. Here's how the buttons "Splut/Unified" look like in the new UI:

image

A stacktrace appears in the console:

 Uncaught (in promise) TypeError: b is null
    addButton moz-extension://047311dd-ae1f-4370-b50a-d5d819e266b9/userscripts/Github-Commit-Diff.user.js?id=ef4782ed-174b-4e3c-acd5-007e4c3685bd:58
    window["__f__lk4jg1u3.dgq"]/</< moz-extension://047311dd-ae1f-4370-b50a-d5d819e266b9/userscripts/Github-Commit-Diff.user.js?id=ef4782ed-174b-4e3c-acd5-007e4c3685bd:127
    window["__f__lk4jg1u3.dgq"]/< moz-extension://047311dd-ae1f-4370-b50a-d5d819e266b9/userscripts/Github-Commit-Diff.user.js?id=ef4782ed-174b-4e3c-acd5-007e4c3685bd:132
    St https://github.com/rybak/github-pr-avatars-tab-icons/commit/72aa79e66edfc002bb241428b3c5d4246758ff1b:9
    window["__f__lk4jg1u3.dgq"]/< moz-extension://047311dd-ae1f-4370-b50a-d5d819e266b9/userscripts/Github-Commit-Diff.user.js?id=ef4782ed-174b-4e3c-acd5-007e4c3685bd:1
    "__f__lk4jg1u3.dgq" moz-extension://047311dd-ae1f-4370-b50a-d5d819e266b9/userscripts/Github-Commit-Diff.user.js?id=ef4782ed-174b-4e3c-acd5-007e4c3685bd:1
    St https://github.com/rybak/github-pr-avatars-tab-icons/commit/72aa79e66edfc002bb241428b3c5d4246758ff1b:9
    s https://github.com/rybak/github-pr-avatars-tab-icons/commit/72aa79e66edfc002bb241428b3c5d4246758ff1b:72
    <anonymous> https://github.com/rybak/github-pr-avatars-tab-icons/commit/72aa79e66edfc002bb241428b3c5d4246758ff1b:75
    g https://github.com/rybak/github-pr-avatars-tab-icons/commit/72aa79e66edfc002bb241428b3c5d4246758ff1b:69

Where b comes from:

            var b = e.querySelector('.toc-diff-stats')

CSS class toc-diff-stats isn't used anymore, but there is similar document.getElementById('toc'). Replacing the broken code like so:

            var b = document.getElementById('toc')

... puts the button on the left hand side of the page:

image

Tested on page rybak/github-pr-avatars-tab-icons@72aa79e

Firefox 114, Tampermonkey v4.19.0

@jerone
Copy link
Owner

jerone commented Aug 24, 2023

On most places both the diff & patch are available. For the missing places I accept an PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants