forked from mechanicalscribe/vexflow-musicxml
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
57 lines (50 loc) · 1.61 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
<html>
<head>
<title>VexFlow MusicXML Demo</title>
<meta name="viewport" content="initial-scale = 1.0, minimum-scale = 1.0, maximum-scale = 1.0, user-scalable = no">
<!-- VexFlow Compiled Source -->
<script src="../node_modules/vexflow/releases/vexflow-min.js"></script>
<script src="../vexflow.musicxml.js"></script>
<!-- Support Sources -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<!--<script src="../support/jquery.js"></script>-->
<!--<script src="../support/raphael.js"></script>-->
<style type="text/css">
div.content {
overflow: hidden;
width: 100%;
padding: 0; margin: 0;
}
</style>
<script>
var VexDocument = null;
var VexFormatter = null;
$.ajax({
url: "beethoven_moonlight_m1.xml",
success: function(data) {
var start = new Date().getTime(); // time execution
VexDocument = new Vex.Flow.Document(data);
//console.log(VexDocument);
var content = $(".content")[0];
if (VexDocument) {
VexFormatter = VexDocument.getFormatter();
VexFormatter.draw(content);
}
var elapsed = (new Date().getTime() - start)/1000;
var debouncedResize = null;
$(window).resize(function() {
if (! debouncedResize)
debouncedResize = setTimeout(function() {
content.empty();
VexFormatter.draw(content);
debouncedResize = null;
}, 500);
});
}
});
</script>
</head>
<body>
<div class="content" id="viewer" style="padding-bottom: 5pt"></div>
</body>
</html>