-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
executable file
·74 lines (69 loc) · 2.77 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>The Transposer</title>
<link href="simple.css" rel="stylesheet" type="text/css">
<script src="vexflow-min.js"></script>
<script src="main.js"></script>
<style>
canvas {
background: #eed;
padding: 10px;
border: 10px solid #ddc;
cursor: pointer;
width: 100%;
}
select {
width: 150px;
}
</style>
<script>
document.addEventListener('DOMContentLoaded', function () {
const originalCanvas = document.getElementById('original');
const transposedCanvas = document.getElementById('transposed');
const originalKeySelector = document.getElementById('originalKeySelector');
const transposedKeySelector = document.getElementById('transposedKeySelector');
const originalKey = document.getElementById('originalKey');
const transposedKey = document.getElementById('transposedKey');
const transposer = new Transposer(originalCanvas, transposedCanvas, originalKeySelector, transposedKeySelector, originalKey, transposedKey);
document.onkeydown = function (e) {
switch (e.key) {
case "ArrowUp":
e.preventDefault(); // prevent the default action (scroll / move caret)
transposer.updateKeyIndex(1);
break;
case "ArrowDown":
e.preventDefault(); // prevent the default action (scroll / move caret)
transposer.updateKeyIndex(-1);
break;
default:
return; // exit this handler for other keys
}
};
});
</script>
</head>
<body>
<header>
<h1>The Transposer</h1>
</header>
<main>
<p>Click on the upper top of the stave to add sharps and below to add flats.</p>
<h2>Original Key</h2>
<p>The key of the instrument for which the piece was written.</p>
<select id="originalKeySelector"></select>
<canvas id="original" width="600" height="120"></canvas>
<p id="originalKey"></p>
<h2>Transposed Key</h2>
<p>The key of your instrument. For example, for a French Horn, it will most likely be in F.</p>
<select id="transposedKeySelector"/></select>
<canvas id="transposed" width="600" height="120"></canvas>
<p id="transposedKey"></p>
</main>
<footer>
<p>Using <a href="http://www.vexflow.com/">VexFlow</a>.</p>
</footer>
</body>
</html>