Skip to content

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

@rybak

Description

@rybak

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions