diff --git a/css/styles.css b/css/styles.css index d7d2b1a..8c938b4 100644 --- a/css/styles.css +++ b/css/styles.css @@ -7,6 +7,10 @@ body { margin: 0; padding: 0; overflow: hidden; + background-image: url('../res/splash.png'); + background-color: #F4B400; + background-size: cover; + } #keep-webview { diff --git a/package.json b/package.json index 86bfe30..aa1e2d9 100644 --- a/package.json +++ b/package.json @@ -36,15 +36,19 @@ "mocha": "3.2.0" }, "dependencies": { - "electron": "^1.3.4", "auto-launch": "5.0.1", "babel-eslint": "7.1.1", + "chai": "3.5.0", + "electron": "^1.3.4", "electron-debug": "1.0.1", "electron-is-dev": "0.1.2", "electron-localshortcut": "1.0.0", "electron-open-link-in-browser": "1.0.2", "electron-packager": "8.5.1", "menubar": "5.1.0", + "mocha": "3.2.0", + "proxyquire": "1.7.11", + "sinon": "1.17.7", "winston": "2.3.1" } } diff --git a/res/splash.png b/res/splash.png new file mode 100644 index 0000000..3cdb356 Binary files /dev/null and b/res/splash.png differ diff --git a/src/autostart.js b/src/autostart.js index 5dcda6a..6eb9b16 100644 --- a/src/autostart.js +++ b/src/autostart.js @@ -10,20 +10,15 @@ exports.init = function (mb) { path: appPath, }); - keeptronAutostart.enable().then((isEnabled) => { - winston.info(isEnabled); - }); - keeptronAutostart.isEnabled() - .then((isEnabled) => { - winston.info(isEnabled); - if (isEnabled) { - return; - } - keeptronAutostart.enable(); - }) - .catch((err) => { - winston.err(err); - }); + .then((isEnabled) => { + if (isEnabled) { + return; + } + keeptronAutostart.enable(); + }) + .catch((err) => { + winston.err(err); + }); }); }; diff --git a/src/webview/injectKeep.js b/src/webview/injectKeep.js index 7fa61f8..e69de29 100644 --- a/src/webview/injectKeep.js +++ b/src/webview/injectKeep.js @@ -1,12 +0,0 @@ -const hideIfExists = function (clazz) { - const element = document.getElementsByClassName(clazz)[0]; - if (element) { - element.style.display = 'none'; - } -}; - -window.onload = function () { - hideIfExists('gb_gc'); - hideIfExists('gb_Qb'); - hideIfExists('gb_5b'); -}; diff --git a/src/webview/webview.js b/src/webview/webview.js index 4fefa7b..a3a436c 100644 --- a/src/webview/webview.js +++ b/src/webview/webview.js @@ -1,6 +1,8 @@ const shell = require('electron').shell; const url = require('url'); +const webview = document.getElementById('keep-webview'); + const openLinkInNewWindow = (e) => { const protocol = url.parse(e.url).protocol; if (protocol === 'http:' || protocol === 'https:') { @@ -8,5 +10,10 @@ const openLinkInNewWindow = (e) => { } }; -const webview = document.getElementById('keep-webview'); +const hideElements = () => { + webview.insertCSS('.gb_7b{display:none!important}'); +}; + +// Event Handlers webview.addEventListener('new-window', openLinkInNewWindow); +webview.addEventListener('dom-ready', hideElements); diff --git a/test/.eslintrc.yaml b/test/.eslintrc.yaml new file mode 100644 index 0000000..a64c1f6 --- /dev/null +++ b/test/.eslintrc.yaml @@ -0,0 +1,18 @@ +extends: airbnb +env: + es6: true + node: true + mocha: true +rules: + arrow-spacing: error + no-var: error + strict: error + prefer-const: error + prefer-template: error + template-curly-spacing: error + func-names: + - error + - never +ecmaFeatures: + blockBindings: true +