-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
content.js
75 lines (62 loc) · 2.09 KB
/
content.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
try {
console.log("%cThe HopHub extension has been loaded successfully.", "color:#ffa31a");
function replaceLogo() {
const logo = document.querySelector(".octicon-mark-github");
if (logo) {
logo.remove();
}
const existingLogo = document.querySelector(".new-github-logo");
if (!existingLogo) {
const logohref = document.querySelector('[aria-label="Homepage "]');
const newlogo = document.createElement("img");
newlogo.src = chrome.runtime.getURL("images/icon32.png");
newlogo.alt = "New Github Logo";
newlogo.classList.add("new-github-logo");
logohref.appendChild(newlogo);
}
}
const observer = new MutationObserver(function (mutations) {
mutations.forEach(function (mutation) {
if (mutation.type === "childList") {
replaceLogo();
}
});
});
observer.observe(document.body, {
childList: true,
subtree: true
});
window.onload = function () {
replaceLogo();
};
const favicon1 = document.querySelector('link[rel="alternate icon"]');
favicon1.href = chrome.runtime.getURL("images/favicon.png");
const favicon2 = document.querySelector('link[rel="icon"]');
favicon2.href = chrome.runtime.getURL("images/favicon.png");
const style = document.createElement('style');
style.innerHTML = `
.btn-large {
background-color: rgb(255, 163, 26) !important;
color: rgb(0, 0, 0) !important;
}
.color-bg-default, .color-bg-subtle, .MarketplaceBackground-buffer {
background-color: rgb(0, 0, 0) !important;
}
.color-border-muted {
border: none !important;
}
.border-bottom {
border: none !important;
}
.reponame-suggestion, .color-fg-success {
color: rgb(255, 163, 26) !important;
}
.Label--secondary {
color: rgb(255, 163, 26) !important;
border-color: rgb(255, 163, 26) !important;
}
`;
document.head.appendChild(style);
} catch (e) {
console.log(`%cThere was an error while loading HopHub Addon:\n${e.message}`, "color:red");
}