diff options
| author | Teddy Wing | 2019-05-01 13:20:36 +0200 |
|---|---|---|
| committer | Teddy Wing | 2019-05-01 13:20:36 +0200 |
| commit | 1daa01861d55999e6afa9ba06071351deca2e0f9 (patch) | |
| tree | ca0d510f8d0ebcb1a11181496b123e6e6103616b /index.ts | |
| parent | c63725c726f0f8acdaffb507ba89c30bfe898288 (diff) | |
| download | muttagen-1daa01861d55999e6afa9ba06071351deca2e0f9.tar.bz2 | |
Add some test styles
* Remove the right "tools" sidebar
* Invert colours in the main message viewer. Doesn't appear to be
working correctly at the moment. Looks like I need to add some
specificity to the selector.
Change the name of the output file to make it a user script.
Add the UserScript header metadata.
Diffstat (limited to 'index.ts')
| -rw-r--r-- | index.ts | 37 |
1 files changed, 37 insertions, 0 deletions
@@ -1,5 +1,42 @@ +// ==UserScript== +// @name Muttagen +// @description Gmail user script providing Mutt features +// @namespace com.teddywing +// @match https://mail.google.com/* +// ==/UserScript== + type GmailCSSClass = string; const TOOLS_PANEL: GmailCSSClass = 'bAw'; const SIDEBAR: GmailCSSClass = 'aeN'; const MESSAGE_PAGER: GmailCSSClass = 'nH'; + + +type GmailCSSDefinitions = { [selector in GmailCSSClass]: string }; + +var css: GmailCSSDefinitions = {}; +css[TOOLS_PANEL] = 'display: none;'; +css[MESSAGE_PAGER] = 'filter: invert(100%);'; + +function construct_css(css: GmailCSSDefinitions): string { + var joined = ''; + + for (var selector in css) { + joined += `.${selector} { ${css[selector]} }`; + } + + return joined; +} + +function append_css(css: string): void { + var s = document.createElement('style'); + var t = document.createTextNode(css); + + s.appendChild(t); + + document.head.appendChild(s); +} + +append_css( + construct_css(css) +); |
