Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

27 changes: 27 additions & 0 deletions app/about.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Sound Machine Help</title>
<link href="css/bootstrap.css" rel="stylesheet" type="text/css"/>
<link href="css/settings.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div class="close">Close</div>
<div id="settings-screen" class="container-fluid">
<div class="row">
<div class="col-xs-12">
<h2>Help</h2>

<p>Press <strong>Ctrl + Shift + 1, 2, 3, 4, 5, 6, 7, 8</strong> on the keyboard to play sounds.</p>

<p>Modifier keys for shortcuts can be changed in the settings.</p>

<p class="copyright" align="center">© 2017</p>
</div>
</div>
</div>

<script src="js/about.js"></script>
</body>
</html>
48 changes: 48 additions & 0 deletions app/css/about.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
html,
body {
background: #044D7F;
overflow: hidden;
-webkit-app-region: drag;
-webkit-user-select: none;
}

#settings-screen {
color: #fff;
}

h2 {
margin-top: 8px;
}

input,
label {
-webkit-app-region: no-drag;
}

input {
padding: 10px;
}

.copyright {
position: relative;
float: left;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}

.close {
background: transparent url('../img/close.png') no-repeat 4px 4px;
background-size: 24px 24px;
cursor: pointer;
display: inline-block;
height: 32px;
position: absolute;
right: 6px;
text-indent: -10000px;
top: 6px;
width: 32px;
z-index: 1;

-webkit-app-region: no-drag;
}
22 changes: 17 additions & 5 deletions app/css/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ body {

#main {
background: #1DCCEB;
border-bottom: 1px solid #73E2F7;
height: 700px;
border-bottom: 3px solid #044D7F;
height: 540px;
}

.speaker {
Expand All @@ -26,10 +26,16 @@ body {

#main h1 {
color: #fff;
/*
text-indent: -10000px;
padding-right: 6px;
*/
padding-top: 5px;
text-align: right;
text-indent: -10000px;
padding-bottom: 8px;
text-align: center;

border-bottom: 2px solid #73E2F7;
border-top: 2px solid #73E2F7;
}

#main h1 img {
Expand Down Expand Up @@ -88,6 +94,7 @@ body {
-webkit-app-region: no-drag;
}

.about,
.settings,
.close {
cursor: pointer;
Expand All @@ -102,6 +109,12 @@ body {
-webkit-app-region: no-drag;
}

.about {
background: transparent url('../img/about.png') no-repeat 4px 4px;
background-size: 24px 24px;
right: 70px;
}

.settings {
background: transparent url('../img/settings.png') no-repeat 4px 4px;
background-size: 24px 24px;
Expand All @@ -113,4 +126,3 @@ body {
background-size: 24px 24px;
right: 6px;
}

Binary file added app/img/about.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed app/img/app-icon.icns
Binary file not shown.
Binary file removed app/img/app-icon.ico
Binary file not shown.
Binary file modified app/img/app-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/img/icons/ba-dum-tsss.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/img/icons/crowd-laughing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/img/icons/fart.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/img/icons/gun.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/img/icons/money.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/img/icons/sad-trombone.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/img/icons/wow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/img/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed app/img/tray-icon-alt.png
Binary file not shown.
Binary file removed app/img/[email protected]
Binary file not shown.
Binary file removed app/img/tray-iconTemplate.png
Binary file not shown.
Binary file removed app/img/[email protected]
Binary file not shown.
15 changes: 9 additions & 6 deletions app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<link href="css/index.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div class="about">About</div>
<div class="settings">Settings</div>
<div class="close">Close</div>
<div id="main" class="container-fluid">
Expand All @@ -32,38 +33,39 @@ <h1>
</div>
</div>
<div class="col-xs-3">
<div class="button-sound" data-sound="ba-dum-tsss">
<div class="button-sound" data-sound="applause">
<span class="button-icon"></span>
</div>
</div>
<div class="col-xs-3">
<div class="button-sound" data-sound="money">
<div class="button-sound" data-sound="crowd-laughing">
<span class="button-icon"></span>
</div>
</div>
</div>
<div class="row buttons">
<div class="col-xs-3">
<div class="button-sound" data-sound="ba-dum-tsss">
<div class="button-sound" data-sound="sad-trombone">
<span class="button-icon"></span>
</div>
</div>
<div class="col-xs-3">
<div class="button-sound" data-sound="money">
<div class="button-sound" data-sound="fart">
<span class="button-icon"></span>
</div>
</div>
<div class="col-xs-3">
<div class="button-sound" data-sound="ba-dum-tsss">
<div class="button-sound" data-sound="gun">
<span class="button-icon"></span>
</div>
</div>
<div class="col-xs-3">
<div class="button-sound" data-sound="money">
<div class="button-sound" data-sound="wow">
<span class="button-icon"></span>
</div>
</div>
</div>
<!--
<div class="row buttons">
<div class="col-xs-3">
<div class="button-sound" data-sound="ba-dum-tsss">
Expand Down Expand Up @@ -108,6 +110,7 @@ <h1>
</div>
</div>
</div>
-->
</div>

<script src="js/index.js"></script>
Expand Down
8 changes: 8 additions & 0 deletions app/js/about.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
'use strict';

var ipc = require('electron').ipcRenderer;

var closeEl = document.querySelector('.close');
closeEl.addEventListener('click', function (e) {
ipc.send('close-about-window');
});
65 changes: 24 additions & 41 deletions app/js/index.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
'use strict';

var ipc = require('ipc');
var remote = require('remote');
var Tray = remote.require('tray');
var Menu = remote.require('menu');
var path = require('path');

var soundButtons = document.querySelectorAll('.button-sound');
var closeEl = document.querySelector('.close');
var settingsEl = document.querySelector('.settings');
var path = require('path');

var trayIcon = null;
var trayMenu = null;
var notifier = require('node-notifier');

for (var i = 0; i < soundButtons.length; i++) {
var soundButton = soundButtons[i];
Expand All @@ -20,53 +12,44 @@ for (var i = 0; i < soundButtons.length; i++) {
prepareButton(soundButton, soundName);
}

String.prototype.capitalizeFirstLetter = function() {
return this.charAt(0).toUpperCase() + this.slice(1);
}

function prepareButton(buttonEl, soundName) {
buttonEl.querySelector('span').style.backgroundImage = 'url("img/icons/' + soundName + '.png")';

var audio = new Audio(__dirname + '/wav/' + soundName + '.wav');
buttonEl.addEventListener('click', function () {
audio.currentTime = 0;
audio.play();
notifier.notify({
'title': 'Sound playing:',
'message': soundName.capitalizeFirstLetter().replace(/-/g, ' '),
'sound' : false,
'icon': __dirname + '/img/icons/' + soundName + '.png'
});
});
}

closeEl.addEventListener('click', function () {
ipc.send('close-main-window');
var ipc = require('electron').ipcRenderer;

var aboutEl = document.querySelector('.about');
aboutEl.addEventListener('click', function () {
ipc.send('open-about-window');
});

var settingsEl = document.querySelector('.settings');
settingsEl.addEventListener('click', function () {
ipc.send('open-settings-window');
});

ipc.on('global-shortcut', function (arg) {
var closeEl = document.querySelector('.close');
closeEl.addEventListener('click', function () {
ipc.send('close-main-window');
});

ipc.on('global-shortcut', function(event, arg) {
var event = new MouseEvent('click');
soundButtons[arg].dispatchEvent(event);
});

if (process.platform === 'darwin') {
trayIcon = new Tray(path.join(__dirname, 'img/tray-iconTemplate.png'));
}
else {
trayIcon = new Tray(path.join(__dirname, 'img/tray-icon-alt.png'));
}

var trayMenuTemplate = [
{
label: 'Sound machine',
enabled: false
},
{
label: 'Settings',
click: function () {
ipc.send('open-settings-window');
}
},
{
label: 'Quit',
click: function () {
ipc.send('close-main-window');
}
}
];
trayMenu = Menu.buildFromTemplate(trayMenuTemplate);
trayIcon.setContextMenu(trayMenu);
19 changes: 10 additions & 9 deletions app/js/settings.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
'use strict';

var ipc = require('ipc');
var configuration = require('../configuration');
var ipc = require('electron').ipcRenderer;

var modifierCheckboxes = document.querySelectorAll('.global-shortcut');
var closeEl = document.querySelector('.close');
var configuration = require('../configuration.js');

closeEl.addEventListener('click', function (e) {
ipc.send('close-settings-window');
});
var modifierCheckboxes = document.querySelectorAll('.global-shortcut');

for (var i = 0; i < modifierCheckboxes.length; i++) {
var shortcutKeys = configuration.readSettings('shortcutKeys');
var modifierKey = modifierCheckboxes[i].attributes['data-modifier-key'].value;
modifierCheckboxes[i].checked = shortcutKeys.indexOf(modifierKey) !== -1;

modifierCheckboxes[i].addEventListener('click', function (e) {
bindModifierCheckboxes(e);
});
Expand All @@ -34,4 +30,9 @@ function bindModifierCheckboxes(e) {

configuration.saveSettings('shortcutKeys', shortcutKeys);
ipc.send('set-global-shortcuts');
}
}

var closeEl = document.querySelector('.close');
closeEl.addEventListener('click', function (e) {
ipc.send('close-settings-window');
});
2 changes: 1 addition & 1 deletion app/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<div class="col-xs-12">
<h2>Settings</h2>

<p>Modifier keys for global shortcuts</p>
<p>Modifier keys for global shortcuts (e.g. Ctrl+1 if Ctrl is checked)</p>
<p>
<input type="checkbox" class="global-shortcut" id="global-shortcut-ctrl"
data-modifier-key="ctrl"/>
Expand Down
Binary file removed app/wav/burp.wav
Binary file not shown.
Binary file added app/wav/gun.wav
Binary file not shown.
Binary file added app/wav/wow.wav
Binary file not shown.
Loading