Skip to content

Commit 06141a7

Browse files
authored
Fix #35 (#36)
1 parent 43c730a commit 06141a7

File tree

4 files changed

+73
-78
lines changed

4 files changed

+73
-78
lines changed

package-lock.json

Lines changed: 37 additions & 78 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Copyright (C) 2022 Katsute <https://github.com/Katsute>
2+
3+
"use strict";
4+
5+
const whenElementAdded = (selector, f) => {
6+
const init = setInterval(() => {
7+
const e = document.querySelector(selector);
8+
if(e != null){
9+
f(e);
10+
clearInterval(init);
11+
}
12+
}, 1000 * 1);
13+
}
14+
15+
if(window.location.pathname.toLowerCase().includes("/projects/"))
16+
whenElementAdded(`#__primerPortalRoot__`, (e) => {
17+
e.addEventListener("DOMNodeInserted", (i) => {
18+
if(i.target.tagName && i.target.tagName.toLowerCase() == "svg") // find svg
19+
for(const child of i.target.children) // check svg content
20+
if(child.getAttribute("d") == "M11.28 6.78a.75.75 0 00-1.06-1.06L7.25 8.69 5.78 7.22a.75.75 0 00-1.06 1.06l2 2a.75.75 0 001.06 0l3.5-3.5z") // checkmark
21+
return setTimeout(() => {
22+
i.target.parentElement.classList.add("rissue-closed-bg"); // apply css
23+
}, 100); // doesn't work unless we delay
24+
});
25+
});

src/manifest.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
"permissions": [],
1616
"content_scripts": [{
17+
"js": ["index.js"],
1718
"css": ["style.css"],
1819
"matches": ["https://github.com/*"]
1920
}]

src/style.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,14 @@ div[data-hovercard-subject-tag^="issue:"] path[d="M16 8A8 8 0 110 8a8 8 0 0116 0
3333
/* pull timeline closed mention label override */
3434
.pull-discussion-timeline .TimelineItem > .TimelineItem-body div[id^="ref-pullrequest-"] ~ div span.State.State--merged {
3535
background-color: var(--rissue-pull-merged) !important;
36+
}
37+
38+
/* js overrides */
39+
40+
.rissue-closed-fg {
41+
color: var(--rissue-issue-closed-fg) !important;
42+
}
43+
44+
.rissue-closed-bg {
45+
background-color: var(--rissue-issue-closed) !important;
3646
}

0 commit comments

Comments
 (0)