|
1 | 1 | // ==UserScript== |
2 | 2 | // @name GitHub Diff Filename |
3 | | -// @version 1.1.4 |
| 3 | +// @version 1.1.5 |
4 | 4 | // @description A userscript that highlights filename & permission alterations |
5 | 5 | // @license MIT |
6 | 6 | // @author Rob Garrison |
|
24 | 24 | const regex = new RegExp(`\\s${arrow}\\s`); |
25 | 25 |
|
26 | 26 | function processFileInfo(el) { |
27 | | -let node; |
28 | 27 | if (!$(".ghdfn", el)) { |
29 | 28 | // A file can be moved AND include permission changes |
30 | 29 | // e.g. main.js → scripts/main.js 100755 → 100644 |
|
37 | 36 | } |
38 | 37 | // permission changes in a text node as a direct child of the wrapper |
39 | 38 | // process permission change (if it exists) |
40 | | -node = findTextNode(el)[0]; |
| 39 | +const node = findTextNode(el)[0]; |
41 | 40 | processNode(node); |
42 | 41 | } |
43 | 42 | } |
|
46 | 45 | if (link) { |
47 | 46 | const [oldFile, newFile] = (link.title || "").split(regex); |
48 | 47 | 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>`; |
51 | 50 | } |
52 | 51 | } |
53 | 52 |
|
|
60 | 59 | wrapParts({ |
61 | 60 | start: middle + 2, |
62 | 61 | end: txt.length, |
63 | | -name: "ghdfn color-text-success", |
| 62 | +name: "ghdfn color-fg-success", |
64 | 63 | node |
65 | 64 | }); |
66 | 65 | } |
|
69 | 68 | wrapParts({ |
70 | 69 | start: 0, |
71 | 70 | end: middle - 1, |
72 | | -name: "ghdfn color-text-danger", |
| 71 | +name: "ghdfn color-fg-danger", |
73 | 72 | node |
74 | 73 | }); |
75 | 74 | } |
|
101 | 100 | } |
102 | 101 | } |
103 | 102 |
|
104 | | -on(document, "ghmo:container", init); |
105 | | -on(document, "ghmo:diff", init); |
| 103 | +on(document, "ghmo:container ghmo:diff", init); |
106 | 104 | init(); |
107 | 105 |
|
108 | 106 | })(); |
0 commit comments