Skip to content

Commit

Permalink
Config to set custom global CSS
Browse files Browse the repository at this point in the history
  • Loading branch information
tombh committed Jun 18, 2019
1 parent c7ddd91 commit 31def7c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions interfacer/src/browsh/config_sample.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ websocket-port = 3334
# then this experimental feature should help. It can also be toggled in-browser with F6.
use_experimental_text_visibility = false
# Custom CSS to apply to all loaded tabs, eg;
# custom_css = """
# body {
# background-colour: black;
# }
# """
custom_css = ""
[firefox]
# The path to your Firefox binary
path = "firefox"
Expand Down
7 changes: 7 additions & 0 deletions webext/src/dom/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ export default class extends utils.mixins(CommonMixin, CommandsMixin) {
this.is_dom_loaded = true;
this.log("DOM LOADED");
this._fixStickyElements();
this._injectCustomCSS();
this._willHideText();
});
window.addEventListener("load", () => {
Expand Down Expand Up @@ -251,4 +252,10 @@ export default class extends utils.mixins(CommonMixin, CommandsMixin) {
}
}
}

_injectCustomCSS() {
var node = document.createElement("style");
node.innerHTML = this.config.browsh.custom_css;
document.body.appendChild(node);
}
}

0 comments on commit 31def7c

Please sign in to comment.