diff options
| author | Teddy Wing | 2019-05-01 15:14:37 +0200 |
|---|---|---|
| committer | Teddy Wing | 2019-05-01 15:14:37 +0200 |
| commit | 33f83a17badb4586c0eb0e3b78aef9c8debe371f (patch) | |
| tree | 1c7cd2c9605301ff38df1842ac1e5fd51ad81fb4 /index.ts | |
| parent | 10fa99186f46435c179ec6cfdbe2407f5a04f7a4 (diff) | |
| download | muttagen-33f83a17badb4586c0eb0e3b78aef9c8debe371f.tar.bz2 | |
Move code to "style.ts"
* Create a separate module for the CSS style-related code.
* Use `commonjs` module format instead of `amd` so that the resulting
output file can be used (hopefully) without modification directly in
the browser.
Diffstat (limited to 'index.ts')
| -rw-r--r-- | index.ts | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/index.ts b/index.ts deleted file mode 100644 index eb34825..0000000 --- a/index.ts +++ /dev/null @@ -1,42 +0,0 @@ -// ==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 = 'AO'; - - -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) -); |
