| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Loader: | 2 * Loader: |
| 3 * Reads GM result reports written out by results.py, and imports | 3 * Reads GM result reports written out by results.py, and imports |
| 4 * them into $scope.extraColumnHeaders and $scope.imagePairs . | 4 * them into $scope.extraColumnHeaders and $scope.imagePairs . |
| 5 */ | 5 */ |
| 6 var Loader = angular.module( | 6 var Loader = angular.module( |
| 7 'Loader', | 7 'Loader', |
| 8 ['ConstantsModule'] | 8 ['ConstantsModule'] |
| 9 ); | 9 ); |
| 10 | 10 |
| 11 // This configuration is needed to allow downloads of the diff patch. |
| 12 // See https://github.com/angular/angular.js/issues/3889 |
| 13 Loader.config(['$compileProvider', function($compileProvider) { |
| 14 $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|file|blob):/); |
| 15 }]); |
| 16 |
| 11 Loader.directive( | 17 Loader.directive( |
| 12 'resultsUpdatedCallbackDirective', | 18 'resultsUpdatedCallbackDirective', |
| 13 ['$timeout', | 19 ['$timeout', |
| 14 function($timeout) { | 20 function($timeout) { |
| 15 return function(scope, element, attrs) { | 21 return function(scope, element, attrs) { |
| 16 if (scope.$last) { | 22 if (scope.$last) { |
| 17 $timeout(function() { | 23 $timeout(function() { |
| 18 scope.resultsUpdatedCallback(); | 24 scope.resultsUpdatedCallback(); |
| 19 }); | 25 }); |
| 20 } | 26 } |
| (...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 834 modificationData[constants.KEY__LIVE_EDITS__SET_A_DESCRIPTIONS] = | 840 modificationData[constants.KEY__LIVE_EDITS__SET_A_DESCRIPTIONS] = |
| 835 $scope.header[constants.KEY__HEADER__SET_A_DESCRIPTIONS]; | 841 $scope.header[constants.KEY__HEADER__SET_A_DESCRIPTIONS]; |
| 836 modificationData[constants.KEY__LIVE_EDITS__SET_B_DESCRIPTIONS] = | 842 modificationData[constants.KEY__LIVE_EDITS__SET_B_DESCRIPTIONS] = |
| 837 $scope.header[constants.KEY__HEADER__SET_B_DESCRIPTIONS]; | 843 $scope.header[constants.KEY__HEADER__SET_B_DESCRIPTIONS]; |
| 838 $http({ | 844 $http({ |
| 839 method: "POST", | 845 method: "POST", |
| 840 url: "/live-edits", | 846 url: "/live-edits", |
| 841 data: modificationData | 847 data: modificationData |
| 842 }).success(function(data, status, headers, config) { | 848 }).success(function(data, status, headers, config) { |
| 843 $scope.diffResults = data; | 849 $scope.diffResults = data; |
| 850 var blob = new Blob([$scope.diffResults], {type: 'text/plain'}); |
| 851 $scope.diffResultsBlobUrl = window.URL.createObjectURL(blob); |
| 844 $scope.submitPending = false; | 852 $scope.submitPending = false; |
| 845 }).error(function(data, status, headers, config) { | 853 }).error(function(data, status, headers, config) { |
| 846 alert("There was an error submitting your baselines.\n\n" + | 854 alert("There was an error submitting your baselines.\n\n" + |
| 847 "Please see server-side log for details."); | 855 "Please see server-side log for details."); |
| 848 $scope.submitPending = false; | 856 $scope.submitPending = false; |
| 849 }); | 857 }); |
| 850 }; | 858 }; |
| 851 | 859 |
| 852 | 860 |
| 853 // | 861 // |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1007 * | 1015 * |
| 1008 * TODO(epoger): It might be nice to tint the color when it's not completely | 1016 * TODO(epoger): It might be nice to tint the color when it's not completely |
| 1009 * black or completely white. | 1017 * black or completely white. |
| 1010 */ | 1018 */ |
| 1011 $scope.brightnessStringToHexColor = function(brightnessString) { | 1019 $scope.brightnessStringToHexColor = function(brightnessString) { |
| 1012 var v = parseInt(brightnessString); | 1020 var v = parseInt(brightnessString); |
| 1013 return $scope.hexColorString(v, v, v); | 1021 return $scope.hexColorString(v, v, v); |
| 1014 }; | 1022 }; |
| 1015 } | 1023 } |
| 1016 ); | 1024 ); |
| OLD | NEW |