Added some patterns
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Pünkösd Marcell 2021-06-14 23:58:40 +02:00
parent c8907e23ac
commit 4a5ac1978f
3 changed files with 78 additions and 8 deletions

39
package-lock.json generated
View File

@ -2587,6 +2587,16 @@
"dev": true,
"optional": true
},
"bindings": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz",
"integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==",
"dev": true,
"optional": true,
"requires": {
"file-uri-to-path": "1.0.0"
}
},
"bluebird": {
"version": "3.7.2",
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz",
@ -5354,6 +5364,13 @@
"schema-utils": "^2.5.0"
}
},
"file-uri-to-path": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
"integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==",
"dev": true,
"optional": true
},
"filesize": {
"version": "3.6.1",
"resolved": "https://registry.npmjs.org/filesize/-/filesize-3.6.1.tgz",
@ -7059,8 +7076,7 @@
"lodash": {
"version": "4.17.21",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
"dev": true
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
},
"lodash.debounce": {
"version": "4.0.8",
@ -7480,6 +7496,13 @@
"thenify-all": "^1.0.0"
}
},
"nan": {
"version": "2.14.2",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.14.2.tgz",
"integrity": "sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ==",
"dev": true,
"optional": true
},
"nanomatch": {
"version": "1.2.13",
"resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz",
@ -11286,7 +11309,11 @@
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz",
"integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==",
"dev": true,
"optional": true
"optional": true,
"requires": {
"bindings": "^1.5.0",
"nan": "^2.12.1"
}
},
"glob-parent": {
"version": "3.1.0",
@ -11597,7 +11624,11 @@
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz",
"integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==",
"dev": true,
"optional": true
"optional": true,
"requires": {
"bindings": "^1.5.0",
"nan": "^2.12.1"
}
},
"glob-parent": {
"version": "3.1.0",

View File

@ -13,6 +13,7 @@
"bootstrap-vue": "^2.21.2",
"core-js": "^3.6.5",
"howler": "^2.2.1",
"lodash": "^4.17.21",
"vue": "^2.6.11",
"vue-router": "^3.2.0"
},

View File

@ -19,6 +19,7 @@
<script>
import {Howl} from 'howler'
import axios from 'axios'
import _ from 'lodash'
export default {
name: 'Home',
@ -30,7 +31,8 @@ export default {
soundsLoaded: 0,
errorText: null,
columnWidth: 6,
fullscreenRequested: false
sequence: [],
sequenceCleanerTimeout: null
}
},
computed: {
@ -39,9 +41,14 @@ export default {
}
},
methods: {
play(sampleId) {
patternMagic(sampleId) {
this.sequence.push(sampleId)
if (!this.fullscreenRequested) {
if (this.sequence.length > 4) {
this.sequence.shift() // removes the first element from an array
}
if (_.isEqual(this.sequence, [0, 1, 3, 2])) {
const elem = document.documentElement
if (elem.requestFullscreen) {
@ -52,7 +59,38 @@ export default {
elem.msRequestFullscreen();
}
this.fullscreenRequested = true
this.sequence = []
}
if (_.isEqual(this.sequence, [0, 3, 3, 0])) {
location.reload()
this.sequence = []
}
if (_.isEqual(this.sequence, [0, 3, 1, 1])) {
this.bgSound.stop()
this.availableSounds[this.nowPlaying].howl.stop()
this.nowPlaying = -1
this.sequence = []
return true;
}
// Set timer to clear sequence
if (this.sequenceCleanerTimeout !== null) {
clearTimeout(this.sequenceCleanerTimeout)
}
this.sequenceCleanerTimeout = setTimeout(() => {
this.sequence = []
this.sequenceCleanerTimeout = null
},3000)
return false;
},
play(sampleId) {
const prevent = this.patternMagic(sampleId)
if (prevent) {
return;
}
const sample = this.availableSounds[sampleId].howl