diff -r 986ee928a866 -r 16a1925df2df client/app/app.js --- a/client/app/app.js Tue Oct 14 05:07:37 2014 +0200 +++ b/client/app/app.js Tue Oct 14 08:12:54 2014 +0200 @@ -26,7 +26,7 @@ //console.log('homeCtrl 1', $scope, $location, context); console.log('homeCtrl 2', context); $scope.data = dataModel.data; - + dataModel.data.$promise.then(function(data) { if(typeof data.categories!=='undefined' && data.categories.length>0){ var cats = []; @@ -43,7 +43,7 @@ $scope.allCatLabels = cats; } }); - + $scope.selectedlevel = false; $scope.currentInterval = false; @@ -63,13 +63,13 @@ $scope.currentInterval = $interval(function(){ $interval.cancel($scope.currentInterval); $scope.showAlertDiv = false; }, 2000, 1); } $scope.annotPile = []; - - + + // Socket management var sock = null; var ellog = null; - + ellog = document.getElementById('log'); function log(m) { if(ellog){ @@ -96,7 +96,7 @@ } window.location = 'http://autobahn.ws/unsupportedbrowser'; } - + if (sock) { sock.onopen = function() { if(context.logging===true){ @@ -113,9 +113,10 @@ }; sock.onmessage = function(e) { - if(context.logging===true){ - log('Got message: ' + e.data); + if(context.logging){ + console.log('Got message: ', e.data); } + var data_json = JSON.parse(e.data) //showAlert('Annotation bien reçue.', true); console.log('2 message', $scope.annotPile.length); if($scope.annotPile.length>0){ @@ -173,7 +174,7 @@ } } }; - + // Interface management $scope.selectLevel = function(label, code, c){ if(typeof c==='undefined'){ @@ -191,7 +192,7 @@ $scope.sendAnnotation(label, code, c); } }; - + }); })();