aboutsummaryrefslogtreecommitdiffstats
path: root/src/index.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/index.ts')
-rw-r--r--src/index.ts16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/index.ts b/src/index.ts
index 8ab0071..dbb3b8a 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -5,9 +5,17 @@
// @match https://mail.google.com/*
// ==/UserScript==
-import './style';
+import style from './style';
import sidebar from './sidebar';
-window.setTimeout(function() {
- sidebar();
-}, 3000);
+var loading_view = document.getElementById('loading');
+
+// Wait until loading view disappears before initialising
+var initialize = window.setInterval(function() {
+ if (loading_view.offsetParent === null) {
+ window.clearInterval(initialize);
+
+ style();
+ sidebar();
+ }
+}, 500);