annot-server/webapp/templates/pianoroll.html
changeset 108 082b64a5c699
parent 84 d7c5bffdd2d8
child 151 8468703ef93c
--- a/annot-server/webapp/templates/pianoroll.html	Thu Jan 22 03:23:08 2015 +0100
+++ b/annot-server/webapp/templates/pianoroll.html	Thu Jan 22 07:04:42 2015 +0100
@@ -2,37 +2,51 @@
 <head>
     <meta charset="UTF-8">
     <title>Piano Roll {{event.label}}</title>
-    <style>
-        body {
-            margin: 0;
-            padding: 0;
-            background-color: #FFF;
-        }
-        #log {
-            height: 20em;
-            overflow-y: scroll;
-            background-color: #faa;
-        }
-    </style>
+    <link href="{{ config['STATIC_URL'] }}/css/annotviz.min.css" rel="stylesheet">
 </head>
 <body>
     <h1>Piano Roll {{event.label}}</h1>
     <noscript>You must enable JavaScript</noscript>
     <div id="canvasContainer"></div>
     <p>
-        <a href="#" onclick="clearInterval(moveInterval); clearInterval(verticalLinesInterval); return false;">stop intervals</a>
-         - temps écoulé : <span id="myspan"></span>
-     </p>
+        <a href="#" onclick="stop(); return false;">stop intervals</a> -
+        <a href="#" onclick="start(); return false;">start intervals</a> -
+        temps écoulé : <span id="timeStarted"></span>
+    </p>
     <pre id="log"></pre>
-    <script src="{{ config['STATIC_URL'] }}/js/libs-pianoroll.min.js"></script>
+    <script src="{{ config['STATIC_URL'] }}/js/libs-annotviz.min.js"></script>
+    <script src="{{ config['STATIC_URL'] }}/js/annotviz.min.js"></script>
     <script>
-        var eventCode = "{{event.code}}";
+    var annotationChannel = 'PIANOROLL';
+    var eventCode = '{{event.code}}';
+    var wsUri;
+    if (window.location.protocol === 'file:') {
+        wsUri = 'ws://127.0.0.1:8090/broadcast';
+    }
+    else {
+        wsUri = 'ws://' + window.location.hostname + ':8090/broadcast';
+    }
+    wsUri += '?channel='+annotationChannel+'&event_code='+eventCode;
+
+    var logger = new annotviz.HtmlLogger(false, 'log');
+
+    var stageView = new annotviz.StageView({
+        logger: logger
+    });
+
+    var doubleroll = new annotviz.DoubleRoll({
+        logger: logger,
+        stageView: stageView,
+        ws: new annotviz.WsWrapper(wsUri)
+    });
+
+    function stop() { stageView.stop(); }
+    function start() { stageView.start(); }
+
+    window.onload = function() {
+        stageView.init();
+        start();
+    }
     </script>
-    <script src="{{ config['STATIC_URL'] }}/js/pianoroll.min.js"></script>
-    <script>
-        var moveInterval = pianoroll.moveInterval;
-        var verticalLinesInterval = pianoroll.verticalLinesInterval;
-    </script>
-
 </body>
 </html>