Skip to content

Commit

Permalink
Cleaned code.
Browse files Browse the repository at this point in the history
- Fixed minor issue with Playing Sounds.
- Beautify HTML/JS.
- Reorganized CSS.
  • Loading branch information
FANMixco committed May 10, 2019
1 parent db4ae53 commit 05bf43e
Show file tree
Hide file tree
Showing 12 changed files with 508 additions and 473 deletions.
40 changes: 13 additions & 27 deletions browserSpecific/js/actions.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
let audioBeepElement, audioElementClapping;
let os = getMobileOperatingSystem();
let nMobile = (os === "iOS" || os === "Android");

function browserStartBeep() {
if (isBeepEnabled === "true" && !(os === "iOS" || os === "Android")) {
if (!nMobile) {
if (green === 1 || yellow === 1 || red === 1) {
audioBeepElement.play();
setTimeout(function() {
Expand All @@ -15,14 +16,13 @@ function browserStartBeep() {
}

function browserStartVibrate() {
if (isVibrateEnabled === "true")
if (green === 1 || yellow === 1 || red === 1)
if (hasVibrator)
navigator.vibrate(1000);
if (green === 1 || yellow === 1 || red === 1)
if (hasVibrator)
navigator.vibrate(1000);
}

function browserStartClapping() {
if (isClappingEnabled === "true" && !(os == "iOS" || os == "Android")) {
if (!nMobile) {
audioElementClapping.play();
setTimeout(function() {
audioElementClapping.pause();
Expand All @@ -31,33 +31,19 @@ function browserStartClapping() {
}

function browserStopClapping() {
if (!(os === "iOS" || os === "Android"))
if (!nMobile)
audioElementClapping.pause();
}

if (!(os === "iOS" || os === "Android")) {
if (!nMobile) {
audioBeepElement = document.createElement('audio');
audioBeepElement.setAttribute('src', './browserSpecific/sounds/beep.mp3');

audioBeepElement.addEventListener('ended', function() {
this.play();
}, false);

audioBeepElement.addEventListener("canplay", function() {});

audioBeepElement.addEventListener("timeupdate", function() {});
audioBeepElement.src = './browserSpecific/sounds/beep.mp3';
audioBeepElement.load();

audioElementClapping = document.createElement('audio');
audioElementClapping.setAttribute('src', './browserSpecific/sounds/clapping.mp3');
audioElementClapping.src = './browserSpecific/sounds/clapping.mp3';
audioElementClapping.load();

audioElementClapping.addEventListener('ended', function() {
this.play();
}, false);

audioElementClapping.addEventListener("canplay", function() {});

audioElementClapping.addEventListener("timeupdate", function() {});

btnVibrate.style.display = 'none';
btnShare.style.display = 'none';
btnEmail.style.display = 'none';
Expand All @@ -79,4 +65,4 @@ function browserExport() {
});
doc.save();
}, 250);
}
}
2 changes: 1 addition & 1 deletion browserSpecific/js/actions.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified browserSpecific/sounds/beep.mp3
Binary file not shown.
Binary file modified browserSpecific/sounds/clapping.mp3
Binary file not shown.
Loading

0 comments on commit 05bf43e

Please sign in to comment.