diff --git a/app/assets/javascripts/angular/controllers/experiments.js b/app/assets/javascripts/angular/controllers/experiments.js index a93412cc..80e55582 100644 --- a/app/assets/javascripts/angular/controllers/experiments.js +++ b/app/assets/javascripts/angular/controllers/experiments.js @@ -220,7 +220,8 @@ "notes", "extraInstructions", "imageLink", - "show" + "show", + "downloaded" ] ); @@ -338,6 +339,21 @@ } }); + $scope.totalDownloaded = 0; + $scope.downloading = function() { + var total = 0; +// angular.forEach($scope.stepResults.flashes, function(value, index) { +// if(value.downloaded === true) { +// total += 1; +// } +// }); + + return $("#step_"+$scope.bigScope.step +" img").toArray().every(function(value) {return value.complete}); + + $scope.totalDownloaded = total; + return total; + }; + $scope.showInstructions = true; $scope.showDoneButton = false; $scope.start = function () { @@ -523,7 +539,8 @@ show: false, detected: null, hits: [], - pauses: [] + pauses: [], + downloaded: null } ); } diff --git a/app/assets/javascripts/angular/directives/directives.js b/app/assets/javascripts/angular/directives/directives.js index b7eea757..cbd46fd9 100644 --- a/app/assets/javascripts/angular/directives/directives.js +++ b/app/assets/javascripts/angular/directives/directives.js @@ -503,7 +503,7 @@ return { - restict: 'A', + restrict: 'A', link: function radioInputType(scope, element, attr) { // make the name unique, if not defined if (baw.angularCopies.isUndefined(attr.name)) { @@ -599,6 +599,38 @@ } }); + bawds.directive('bawImageLoaded',['$timeout', '$parse', function($timeout, $parse) { + return { + restrict: 'A', + link: function(scope, elements, attr) { + var element = elements[0]; + if (element.nodeName !== "IMG") { + throw 'Cannot put ngAudio element on an element that is not a