Skip to content

Commit

Permalink
Splash Screen
Browse files Browse the repository at this point in the history
  • Loading branch information
Artur Skowronski committed Feb 24, 2017
1 parent adfb237 commit 741cca5
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 28 deletions.
4 changes: 4 additions & 0 deletions css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
Binary file added res/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 9 additions & 14 deletions src/autostart.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
};
12 changes: 0 additions & 12 deletions src/webview/injectKeep.js
Original file line number Diff line number Diff line change
@@ -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');
};
9 changes: 8 additions & 1 deletion src/webview/webview.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
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:') {
shell.openExternal(e.url);
}
};

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);
18 changes: 18 additions & 0 deletions test/.eslintrc.yaml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 741cca5

Please sign in to comment.