Skip to content
This repository has been archived by the owner on Feb 19, 2022. It is now read-only.

Commit

Permalink
load css seperately
Browse files Browse the repository at this point in the history
  • Loading branch information
trs committed Apr 6, 2019
1 parent 3b903cc commit a37b4eb
Show file tree
Hide file tree
Showing 3 changed files with 189 additions and 195 deletions.
12 changes: 5 additions & 7 deletions manifest.json
Expand Up @@ -4,17 +4,15 @@
"description": "The most popular dark theme extension for github",
"manifest_version": 2,
"icons": {
"16": "assets/icon.png",
"48": "assets/icon.png",
"128": "assets/icon.png"
"16": "assets/icon3.png",
"48": "assets/icon2.png",
"128": "assets/icon1.png"
},
"content_scripts" : [
{
"matches": ["https://github.com/*"],
"js": [
"jquery.js",
"content.js"
]
"css": ["src/style.css"],
"js": ["src/content.js"]
}
]
}
36 changes: 36 additions & 0 deletions src/content.js
@@ -0,0 +1,36 @@
function ready(eventHandler) {
if (document.readyState !== 'loading') {
eventHandler();
} else {
document.addEventListener('DOMContentLoaded', eventHandler);
}
}

ready(function() {
const dayElements = document.getElementsByClassName('day');
if (dayElements.length == 0) return;

for (const dayEl of dayElements) {
if (dayEl.getAttribute("fill") == "#ebedf0") {
dayEl.setAttribute("fill", "#272c32");
}
if (dayEl.getAttribute("fill") == "#c6e48b"){
dayEl.setAttribute("fill", "#1d2125")
}
if (dayEl.getAttribute("fill") == "#7bc96f"){
dayEl.setAttribute("fill", "#131619")
}
if (dayEl.getAttribute("fill") == "#239a3b"){
dayEl.setAttribute("fill", "#090b0c")
}
if (dayEl.getAttribute("fill") == "#196127"){
dayEl.setAttribute("fill", "#000")
}
}

document.querySelector(".legend > li:nth-child(1)").setAttribute("style", "background-color:#272c32");
document.querySelector(".legend > li:nth-child(2)").setAttribute("style", "background-color:#1d2125");
document.querySelector(".legend > li:nth-child(3)").setAttribute("style", "background-color:#131619");
document.querySelector(".legend > li:nth-child(4)").setAttribute("style", "background-color:#090b0c");
document.querySelector(".legend > li:nth-child(5)").setAttribute("style", "background-color:#000");
});

0 comments on commit a37b4eb

Please sign in to comment.