Skip to content

Commit

Permalink
frontend functional
Browse files Browse the repository at this point in the history
  • Loading branch information
lvreynoso committed Jan 10, 2019
1 parent 0a6a7c6 commit ef390a3
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 9 deletions.
4 changes: 4 additions & 0 deletions public/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ body {
cursor: pointer;
}

.btn-generate:hover {
background-color: #00c0dd;
}

.btn-download {
color: #00e1ff;
}
Expand Down
Binary file removed public/midi/Legend of Zelda - Overworld.mid
Binary file not shown.
23 changes: 22 additions & 1 deletion public/scripts/mimikov.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,31 @@ window.onload = function() {
document.getElementById('pauseButton').addEventListener('click', pauseButton)
document.getElementById('stopButton').addEventListener('click', stopButton)
document.getElementById('downloadButton').addEventListener('click', downloadButton)

document.getElementsByName('category').forEach(element => {
element.addEventListener('click', selectCategory)
})
document.getElementsByName('order').forEach(element => {
element.addEventListener('click', selectOrder)
})
}

function selectCategory(event) {
const selected = event.target.textContent;
let sourceButton = document.getElementById('sourceButton');
sourceButton.textContent = selected;
}

function selectOrder(event) {
const selected = event.target.textContent;
let orderButton = document.getElementById('orderButton');
orderButton.textContent = selected;
}

async function generateMIDI(event) {
const midiResponse = await axios.post('/generate', { category: 'Pokemon' });
const category = document.getElementById('sourceButton').textContent;
const order = document.getElementById('orderButton').textContent;
const midiResponse = await axios.post('/generate', { category: category, order: order });
console.log(midiResponse);
const midiBuffer = hexToBuffer(midiResponse.data.hex)
console.log(midiBuffer);
Expand Down
17 changes: 9 additions & 8 deletions views/index.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,20 @@
<h1 class="text-white">Mimikov. &#9939;</h1>
<p class="font-weight-bold">
<div class="dropdown">
<button class="dropbtn bg-secondary font-weight-bold">Music Source</button>
<button class="dropbtn bg-secondary font-weight-bold" id="sourceButton">Music Source</button>
<div class="dropdown-content">
<a href="#">Madonna</a>
<a href="#">Final Fantasy</a>
<a href="#">Beethoven</a>
<a href="#" name="category" id="category1">Pokemon</a>
<a href="#" name="category" id="category2">Final Fantasy</a>
<a href="#" name="category" id="category3">Legend of Zelda</a>
</div>
</div>
<div class="dropdown">
<button class="dropbtn bg-secondary font-weight-bold">Markov Order</button>
<button class="dropbtn bg-secondary font-weight-bold" id="orderButton">Markov Order</button>
<div class="dropdown-content">
<a href="#">1</a>
<a href="#">2</a>
<a href="#">3</a>
<a href="#" name="order" id="order1">Order 1</a>
<a href="#" name="order" id="order2">Order 2</a>
<a href="#" name="order" id="order3">Order 3</a>
<a href="#" name="order" id="order4">Order 4</a>
</div>
</div>
<button type="submit" class="btn-generate font-weight-bold" id="generate" name="generate">Generate song!</button>
Expand Down

0 comments on commit ef390a3

Please sign in to comment.