-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathkitchen-sink.html
269 lines (260 loc) · 9.8 KB
/
kitchen-sink.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<script src="https://unpkg.com/[email protected]/dist/vue.global.js" integrity="sha384-BH5oUugih03zExkjoteSc34cK4iCUfguzIdJvARWLGYWh4c00ZFGOZxT32/IMG7/" crossorigin="anonymous"></script>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<style>
#app {
align-items: center;
display: flex;
justify-content: center;
}
#app > section:first-child {
display: flex;
height: 100vh;
justify-content: center;
overflow: auto;
}
#app > section:nth-child(2) {
border-left: 5px solid #888;
height: 100vh;
overflow-y: scroll
}
</style>
</head>
<body class="container-fluid">
<div id="app" class="row">
<section class="col-9 align-middle" v-bind:style="{ alignItems: orientation == 'horizontal' ? 'center' : ''}">
<v-fretboard
:scale="$root.scale"
:tuning="$root.tuning"
:orientation="$root.orientation"
:strumming-hand="$root.strummingHand"
:reference="$root.reference"
:reference-radius="$root.referenceRadius"
:reference-color="$root.referenceColor"
:start="$root.start"
:frets="$root.frets"
:nut-size="$root.nutSize"
:fret-size="$root.fretSize"
:fret-space="$root.fretSpace"
:fret-color="$root.fretColor"
:strings="$root.strings"
:string-space="$root.stringSpace"
:string-size="$root.stringSize"
:string-color="$root.stringColor"
:note-radius="$root.noteRadius"
:note-color="$root.noteColor"
:root-color="$root.rootColor"
:note-text-color="$root.noteTextColor"
:root-text-color="$root.rootTextColor"
title="Test"
></v-fretboard>
</section>
<section class="col-3">
<fieldset class="form-group mt-4">
<legend>General</legend>
<div class="form-group">
<label for="scale">Scale</label>
<input id="scale" class="form-control" type="text" v-model="$root.scale" list="scaleOptions" />
<datalist id="scaleOptions">
<script>
let scales = {
Major: [2, 2, 1, 2, 2, 2, 1],
Minor: [2, 1, 2, 2, 1, 2, 2],
Dorian: [2, 1, 2, 2, 2, 1, 2],
Locrian: [1,2,2,1,2,2,2],
Lydian: [2,2,2,1,2,2,1],
Mixolydian: [2,2,1,2,2,1,2],
Phrygian: [1,2,2,2,1,2,2],
'Major Pentatonic': [2,2,3,2,3],
'Minor Pentatonic': [3,2,2,3,2],
};
let notes = ['C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B'];
let html = '';
Object.keys(scales).forEach((scale) => {
notes.forEach((note, i) => {
let scale_notes = [];
for (let k = 0, j = 0, l = scales[scale].length; k < l; ++k) {
scale_notes.push(notes[(i + j) % 12]);
j += scales[scale][k];
}
scale_notes = scale_notes.join(' ');
html += `<option value="${note} ${scale}">${scale_notes}</option>`;
});
});
document.currentScript.parentNode.innerHTML = html;
</script>
</datalist>
<span class="form-text text-muted">1 or more space separated note names or a scale name (e.g. C Major)</span>
</div>
<div class="form-group">
<label for="tuning">Tuning</label>
<input id="tuning" class="form-control" type="text" v-model="$root.tuning" list="tuningOptions" />
<datalist id="tuningOptions">
<option value="E A D G B E">Guitar Standard</option>
<option value="D A G B C E">Guitar Drop D</option>
<option value="E A C# E A E">Guitar Open A</option>
<option value="C G C G C E">Guitar Open C</option>
<option value="G C E A">Tenor Ukele Standard</option>
</datalist>
<span class="form-text text-muted">1 or more space separated notes. Use b for flats and # for sharps. String order: last to first</span>
</div>
<div class="form-group">
<label for="orientation">Orientation</label>
<select id="orientation" class="form-control" v-model="$root.orientation"><option value="horizontal">Horizontal</option><option value="vertical">Vertical</option></select>
</div>
<div class="form-group">
<label for="strummingHand">Strumming Hand</label>
<select id="strummingHand" class="form-control" v-model="$root.strummingHand"><option value="left">Left</option><option value="right">Right</option></select>
</div>
</fieldset>
<hr/>
<fieldset class="form-group">
<legend>Notes</legend>
<div class="form-group">
<label for="noteRadius">Note Radius</label>
<input id="noteRadius" class="form-control" type="number" v-model="$root.noteRadius" />
</div>
<div class="form-group">
<label for="noteColor">Note Color</label>
<input id="noteColor" class="form-control" type="color" v-model="$root.noteColor" />
</div>
<div class="form-group">
<label for="rootColor">Root Note Color</label>
<input id="rootColor" class="form-control" type="color" v-model="$root.rootColor" />
</div>
<div class="form-group">
<label for="noteTextColor">Note Text Color</label>
<input id="noteTextColor" class="form-control" type="color" v-model="$root.noteTextColor" />
</div>
<div class="form-group">
<label for="rootTextColor">Root Text Color</label>
<input id="rootTextColor" class="form-control" type="color" v-model="$root.rootTextColor" />
</div>
</fieldset>
<hr/>
<fieldset class="form-group">
<legend>Strings</legend>
<div class="form-group">
<label for="strings"># of Strings</label>
<select id="strings" class="form-control" v-model="$root.strings">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
</select>
</div>
<div class="form-group">
<label for="stringSize">String Size</label>
<input id="stringSize" class="form-control" type="text" v-model="$root.stringSize" />
<span class="form-text text-muted">1 or more space-separated numbers. String order: last to first</span>
</div>
<div class="form-group">
<label for="stringSpace">Space Between Strings</label>
<input id="stringSpace" class="form-control" type="text" v-model="$root.stringSpace" />
</div>
<div class="form-group">
<label for="stringColor">String Color</label>
<input id="stringColor" class="form-control" type="color" v-model="$root.stringColor" />
</div>
</fieldset>
<hr/>
<fieldset class="form-group">
<legend>Frets</legend>
<div class="form-group">
<label for="numberOfFrets"># of Frets</label>
<input id="numberOfFrets" class="form-control" type="number" max="30" min="1" v-model="$root.frets" />
<span class="text-muted form-text">number between 1 and 30</span>
</div>
<div class="form-group">
<label for="startingFret">Starting Fret</label>
<input id="startingFret" class="form-control" type="number" min="0" max="30" v-model="$root.start" />
<span class="text-muted form-text">number ≥ 0 and < frets</span>
</div>
<div class="form-group">
<label for="nutSize">Nut Size</label>
<input id="nutSize" class="form-control" type="number" v-model="$root.nutSize" />
</div>
<div class="form-group">
<label for="fretSize">Fret Size</label>
<input id="fretSize" class="form-control" type="number" v-model="$root.fretSize" />
</div>
<div class="form-group">
<label for="fretSpace">Space Between Frets</label>
<input id="fretSpace" class="form-control" type="text" v-model="$root.fretSpace" />
</div>
<div class="form-group">
<label for="fretColor">Fret Color</label>
<input id="fretColor" class="form-control" type="color" v-model="$root.fretColor" />
</div>
</fieldset>
<hr/>
<fieldset class="form-group">
<legend>Reference Dots</legend>
<div class="form-group">
<label for="references">References</label>
<input id="references" class="form-control" type="text" v-model="$root.reference" />
<span class="form-text text-muted">1 or more space-separated numbers. Enter a number twice to get 2 dots.</span>
</div>
<div class="form-group">
<label for="referenceRadius">Reference Radius</label>
<input id="referenceRadius" class="form-control" type="number" v-model="$root.referenceRadius" />
</div>
<div class="form-group">
<label for="color">Reference Color</label>
<input id="color" class="form-control" type="color" v-model="$root.referenceColor" />
</div>
</fieldset>
</section>
</div>
<script type="module">
import {fretboard} from './v-fretboard.js';
let data = {
scale: "C Major",
tuning: "G C E A",
orientation: "horizontal",
strummingHand: "right",
nutSize: 10,
start: 0,
fretSize: 2,
frets: 15,
fretSpace: "66",
fretColor: "#707070",
strings: 4,
stringSize: "3",
stringSpace: "40",
stringColor: "#a8744d",
noteRadius: 12,
noteColor: "#0f267b",
rootColor: "#ba2121",
noteTextColor: "#EEEEEE",
rootTextColor: "#EEEEEE",
reference: "5 7 10 12 12 15",
referenceRadius: 5,
referenceColor: "#7c27b4",
};
let watch = {};
Object.keys(data).forEach((key) => {
watch[key] = (val) => window.localStorage.setItem(key, val);
let value = window.localStorage.getItem(key);
if (value !== null) {
data[key] = value;
}
});
let app = Vue.createApp({
data: () => data,
watch: watch,
});
app.component('v-fretboard', fretboard);
app.mount('#app');
</script>
</body>
</html>