[PCCompat] Rewrite plugin.loadStylesheet

This commit is contained in:
Ducko 2021-04-22 20:45:28 +01:00 committed by Lexi Sother
parent eb9bfa949b
commit 27847ca0b6
No known key found for this signature in database
GPG key ID: 355968D14144B739
2 changed files with 21 additions and 6 deletions

View file

@ -5,12 +5,10 @@ export class Plugin {
this.stylesheets = [];
}
loadStylesheet(path) {
const url = `https://raw.githubusercontent.com/${this.github.repo}/HEAD/${path}`; // HEAD essentially means default branch
loadStylesheet(css) {
const el = document.createElement('style');
el.appendChild(document.createTextNode(`@import url(${url})`)); // Load the stylesheet via style element w/ CSS @import
el.appendChild(document.createTextNode(css)); // Load the stylesheet via style element w/ CSS text
document.head.appendChild(el);