@squarebit/continuo
Version:
Select notes on a rendered MEI music score and create permalinks using the Music Addressability URL scheme.
88 lines (77 loc) • 2.63 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>Continuo Test</title>
<script src="http://www.verovio.org/javascript/latest/verovio-toolkit.js"></script>
<script src="../dist/js/continuo.js"></script>
<link rel="stylesheet" type="text/css" href="../dist/css/continuo.css" />
<style>
svg{
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
#controls {
display: none;
position: absolute;
right: 90px;
top: 15px;
}
</style>
</head>
<body>
<div id="controls" style="display:none">
<button id="cut">Cut</button>
<button id="highlight">Highlight</button>
</div>
<div id="continuo" style="width: 100%; height: 500px ">
</div>
<script>
var MEIurl = 'http://www.verovio.org/examples/downloads/Schubert_Lindenbaum.mei'
var ver = new verovio.toolkit();
var opts = {
pageWidth: document.getElementById("continuo").offsetWidth * 100 / 35,
pageHeight: 100,
ignoreLayout: 1,
adjustPageHeight: 1,
border: 10,
scale: 35
};
if (window.location.hash && window.location.hash != "") {
var mei = window.location.hash.substr(1);
MEIurl = mei
} else {
document.getElementById("controls").style.display = 'block'
}
var cnt = new Continuo({el: "#continuo", mei: MEIurl, verovioToolkit: ver, paginate: true, verovioOptions: opts});
cnt.render();
var server = "http://mith.umd.edu/ema";
document.getElementById("cut").onclick = function(){
var expr = document.querySelector('.cnt-emaexpr-expr')
if (!expr) {
alert('Select some notation first')
} else {
window.open("preview.html#" + server + "/" + encodeURIComponent(MEIurl) + "/" + expr.innerText)
}
}
document.getElementById("highlight").onclick = function(){
var expr = document.querySelector('.cnt-emaexpr-expr')
if (!expr) {
alert('Select some notation first')
} else {
window.open("highlight.html#" + server + "/" + encodeURIComponent(MEIurl) + "/" + expr.innerText + "/highlight")
}
}
window.cnt = cnt;
</script>
</body>
</html>