aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2019-05-01 13:20:36 +0200
committerTeddy Wing2019-05-01 13:20:36 +0200
commit1daa01861d55999e6afa9ba06071351deca2e0f9 (patch)
treeca0d510f8d0ebcb1a11181496b123e6e6103616b
parentc63725c726f0f8acdaffb507ba89c30bfe898288 (diff)
downloadmuttagen-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.
-rw-r--r--index.ts37
-rw-r--r--tsconfig.json2
2 files changed, 38 insertions, 1 deletions
diff --git a/index.ts b/index.ts
index 1edc591..d6d99f6 100644
--- a/index.ts
+++ b/index.ts
@@ -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)
+);
diff --git a/tsconfig.json b/tsconfig.json
index 453a1dc..f6b7f29 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -2,7 +2,7 @@
"compilerOptions": {
"module": "amd",
"target": "ES5",
- "outFile": "./build/index.js",
+ "outFile": "./build/muttagen.user.js",
"sourceMap": true
},
"files": [