Skip to content

Commit 41e7caf

Browse files
committed
Diff-filename: Fix colors again
1 parent c583f79 commit 41e7caf

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

github-diff-filename.user.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// ==UserScript==
22
// @name GitHub Diff Filename
3-
// @version 1.1.4
3+
// @version 1.1.5
44
// @description A userscript that highlights filename & permission alterations
55
// @license MIT
66
// @author Rob Garrison
@@ -24,7 +24,6 @@
2424
const regex = new RegExp(`\\s${arrow}\\s`);
2525

2626
function processFileInfo(el) {
27-
let node;
2827
if (!$(".ghdfn", el)) {
2928
// A file can be moved AND include permission changes
3029
// e.g. main.js → scripts/main.js 100755 → 100644
@@ -37,7 +36,7 @@
3736
}
3837
// permission changes in a text node as a direct child of the wrapper
3938
// process permission change (if it exists)
40-
node = findTextNode(el)[0];
39+
const node = findTextNode(el)[0];
4140
processNode(node);
4241
}
4342
}
@@ -46,8 +45,8 @@
4645
if (link) {
4746
const [oldFile, newFile] = (link.title || "").split(regex);
4847
link.innerHTML = `
49-
<span class="ghdfn color-text-danger">${oldFile}</span> ${arrow}
50-
<span class="ghdfn color-text-success">${newFile}</span>`;
48+
<span class="ghdfn color-fg-danger">${oldFile}</span> ${arrow}
49+
<span class="ghdfn color-fg-success">${newFile}</span>`;
5150
}
5251
}
5352

@@ -60,7 +59,7 @@
6059
wrapParts({
6160
start: middle + 2,
6261
end: txt.length,
63-
name: "ghdfn color-text-success",
62+
name: "ghdfn color-fg-success",
6463
node
6564
});
6665
}
@@ -69,7 +68,7 @@
6968
wrapParts({
7069
start: 0,
7170
end: middle - 1,
72-
name: "ghdfn color-text-danger",
71+
name: "ghdfn color-fg-danger",
7372
node
7473
});
7574
}
@@ -101,8 +100,7 @@
101100
}
102101
}
103102

104-
on(document, "ghmo:container", init);
105-
on(document, "ghmo:diff", init);
103+
on(document, "ghmo:container ghmo:diff", init);
106104
init();
107105

108106
})();

0 commit comments

Comments
 (0)