-
-
Notifications
You must be signed in to change notification settings - Fork 172
Open
Description
Not sure if this is still being maintained but toggle commit comments no longer works.
The html structure has changed, the the expanded section is dynamically added from an embeded react thingy:
<script type="application/json" data-target="react-app.embeddedData">{"payload":{"commitGroups":[{"title":"Jun 29, 2024","commits":
I made a quick and dirty fix for myself if anyone wants it.
Only for the day expand on commits. But you can easily modify that to your needs.
I just find the buttons and call their click() method
Here's the mess:
(() => {
/* global $ $$ on */
"use strict";
// Commit history toggle
// https://github.com/torvalds/linux/commits/master
function toggleButton(el, caller) {
const parentNode = el.closest(".list-view-items");
if (parentNode) {
const containers = parentNode.querySelectorAll('[data-testid=commit-row-show-description-button]');
[...containers].forEach(node => {
if ((node != caller) && (node.matches('[data-testid=commit-row-show-description-button]'))) {
node.click();
}
});
}
}
on($("body"), "click", event => {
const target = event.target;
const mod = event.ctrlKey ||
event.metaKey ||
window.location.pathname.includes("/compare/");
if (target && event.getModifierState("Shift")) {
// give GitHub time to update the elements
setTimeout(() => {
// target is path inside svg inside button
var realTarget = target;
for (let i = 0; i < 5; i++) {
if (realTarget.nodeName != 'BUTTON')
realTarget = realTarget.parentElement;
else
break;
}
if (realTarget.matches("[aria-pressed=false]")) {
//console.log("detail target")
toggleButton(realTarget, target);
} else if (
realTarget.matches("[aria-pressed=true]")) {
//console.log("detail closed")
toggleButton(realTarget, target);
}
//console.log(realTarget)
}, 100);
}
});
})();
Metadata
Metadata
Assignees
Labels
No labels