diff --git a/.eslintrc.json b/.eslintrc.json index ff58ea3..7425573 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -2,6 +2,7 @@ "env": { "browser": true }, + "parser": "babel-eslint", "extends": "eslint:recommended", "rules": { "accessor-pairs": "error", @@ -77,9 +78,9 @@ "newline-after-var": "off", "newline-before-return": "off", "newline-per-chained-call": "error", - "no-alert": "error", + "no-alert": "off", "no-array-constructor": "error", - "no-bitwise": "error", + "no-bitwise": "off", "no-caller": "error", "no-console": "off", "no-catch-shadow": "error", @@ -96,7 +97,7 @@ "no-extra-label": "error", "no-extra-parens": "off", "no-floating-decimal": "error", - "no-implicit-coercion": "error", + "no-implicit-coercion": "off", "no-implicit-globals": "off", "no-implied-eval": "error", "no-inline-comments": "off", @@ -164,7 +165,7 @@ "no-unneeded-ternary": "error", "no-unsafe-finally": "error", "no-unused-expressions": "error", - "no-use-before-define": "error", + "no-use-before-define": "off", "no-useless-call": "error", "no-useless-computed-key": "error", "no-useless-concat": "off", @@ -173,7 +174,7 @@ "no-useless-rename": "error", "no-var": "off", "no-void": "error", - "no-warning-comments": "error", + "no-warning-comments": "off", "no-whitespace-before-property": "error", "no-with": "error", "object-curly-spacing": [ @@ -259,6 +260,10 @@ "marked": true, "jade": true, "loadJS": true, - "Promise": true + "esprima": true, + "escodegen": true, + "utils": true, + "Promise": true, + "Inlet": true } -} \ No newline at end of file +} diff --git a/.travis.yml b/.travis.yml index ad20d55..56b4205 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,8 @@ language: node_js node_js: - - '4.0' + - '6.0' install: - npm install -g eslint + - npm install -g babel-eslint script: - eslint src/*.js \ No newline at end of file diff --git a/src/analytics.js b/src/analytics.js index 3d7b029..d1c3a12 100644 --- a/src/analytics.js +++ b/src/analytics.js @@ -1,16 +1,20 @@ /* global ga */ // eslint-disable-next-line max-params window.trackEvent = function (category, action, label, value) { + if (window.DEBUG) { + utils.log('trackevent', category, action, label, value) + return; + } if (window.ga) { ga('send', 'event', category, action, label, value); } } -// if online, load after sometime -if (navigator.onLine) { - setTimeout(function() { +// if online, load after 2 seconds +if (navigator.onLine && !window.DEBUG) { + /* eslint-disable */ - /* eslint-disable */ + setTimeout(function() { (function(i,s,o,g,r,a,m){ i['GoogleAnalyticsObject']=r; i[r]=i[r]||function(){ @@ -22,8 +26,7 @@ if (navigator.onLine) { // required for chrome extension protocol ga('set', 'checkProtocolTask', function(){ /* nothing */ }); ga('send', 'pageview'); - - /* eslint-enable */ - }, 0); + + /* eslint-enable */ } \ No newline at end of file diff --git a/src/eventPage.js b/src/eventPage.js index 8ffeb3f..6e40f37 100644 --- a/src/eventPage.js +++ b/src/eventPage.js @@ -1,8 +1,12 @@ -chrome.browserAction.onClicked.addListener(function(){ +function openApp() { chrome.tabs.create({ url: chrome.extension.getURL('index.html'), selected: true }); +} + +chrome.browserAction.onClicked.addListener(function(){ + openApp(); }); // Listen for tabs getting created. @@ -22,4 +26,15 @@ chrome.tabs.onCreated.addListener(function (tab) { } }); } +}); + +chrome.runtime.onInstalled.addListener(function callback (details) { + if (details.reason === 'install') { + openApp(); + } + if (details.reason === 'update') { + if ((details.previousVersion + '').indexOf('1.') === 0) { + openApp(); + } + } }); \ No newline at end of file diff --git a/src/index.html b/src/index.html index 1a3f10c..34165a9 100644 --- a/src/index.html +++ b/src/index.html @@ -5,396 +5,83 @@ - + + - +
+
+ + +
-
-
+
+
- HTML + HTML
+
+ + +
-
-
+
+
- CSS + CSS
+
+ + +
-
-
+
+
+
+ + +
@@ -404,7 +91,7 @@
-