feat: inject stylesheet into DOM

This commit is contained in:
EnixCoda 2020-02-16 00:13:00 +08:00
parent bb069c9964
commit 2971a1d53b
No known key found for this signature in database
GPG key ID: 0C1A07377913A1DD
2 changed files with 15 additions and 20 deletions

View file

@ -18,3 +18,13 @@ if (document.readyState === 'loading') {
} else {
init()
}
// injects a copy of stylesheets so that other extensions(e.g. dark reader) could read
function injectStyles(url: string) {
var linkElement = document.createElement('link')
linkElement.rel = 'stylesheet'
linkElement.setAttribute('href', url)
document.head.appendChild(linkElement)
}
injectStyles(browser.extension.getURL('content.css'))

View file

@ -8,27 +8,12 @@
"128": "icons/Gitako-128x128.png"
},
"homepage_url": "https://github.com/EnixCoda/Gitako",
"permissions": [
"storage",
"*://*.github.com/*",
"*://*.sentry.io/*"
],
"web_accessible_resources": [
"icons/vscode/*"
],
"permissions": ["storage", "*://*.github.com/*", "*://*.sentry.io/*"],
"web_accessible_resources": ["icons/vscode/*", "content.css"],
"content_scripts": [
{
"matches": [
"https://github.com/*"
],
"css": [
"content.css"
],
"js": [
"firefox-shim.js",
"browser-polyfill.js",
"content.js"
]
"matches": ["https://github.com/*"],
"js": ["firefox-shim.js", "browser-polyfill.js", "content.js"]
}
]
}
}