From 10f0b92c996391b52f0189853ab2549fe8bcdd36 Mon Sep 17 00:00:00 2001 From: Roboe Date: Sat, 8 Aug 2015 02:46:06 +0200 Subject: [PATCH] Replace JSON.stringify with angular.toJson. Fix #52 --- scripts/metadata-editor/metadataEditor.js | 4 ++-- scripts/services/analyzer.js | 2 +- scripts/services/projectData.js | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/metadata-editor/metadataEditor.js b/scripts/metadata-editor/metadataEditor.js index 760fc7c..414c5f1 100644 --- a/scripts/metadata-editor/metadataEditor.js +++ b/scripts/metadata-editor/metadataEditor.js @@ -44,7 +44,7 @@ cueIn.value = vtt.tc; // - jotacueri('textarea').value = JSON.stringify(vtt.value); + jotacueri('textarea').value = angular.toJson(vtt.value); video.currentTime = timecodeUtils.timecodeToMilis(vtt.tc) / 1000; } }); @@ -62,7 +62,7 @@ cueIn.value = vtt.tc; // - jotacueri('textarea').value = vtt.index + '\n' + JSON.stringify(vtt.value); + jotacueri('textarea').value = vtt.index + '\n' + angular.toJson(vtt.value); video.currentTime = timecodeUtils.timecodeToMilis(vtt.tc) / 1000; } }); diff --git a/scripts/services/analyzer.js b/scripts/services/analyzer.js index a31cb35..6c1b89f 100644 --- a/scripts/services/analyzer.js +++ b/scripts/services/analyzer.js @@ -131,7 +131,7 @@ angular.module('filmViz') data.forEach(function(cueObj, index, arr) { var startTime = cueObj.startTime; var endTime = (index === arr.length - 1) ? video.duration : arr[index + 1].startTime; - track.addCue(new VTTCue(startTime, endTime, JSON.stringify(cueObj.content))); + track.addCue(new VTTCue(startTime, endTime, angular.toJson(cueObj.content))); }); }; diff --git a/scripts/services/projectData.js b/scripts/services/projectData.js index a1bacff..230539f 100644 --- a/scripts/services/projectData.js +++ b/scripts/services/projectData.js @@ -65,7 +65,7 @@ angular.module('filmViz') newLine(data.startTime + ' --> ' + arr[index + 1].startTime); }; - newLine(JSON.stringify(data.content)); + newLine(angular.toJson(data.content)); newLine(); }); } @@ -83,7 +83,7 @@ angular.module('filmViz') // Add project data on 'project.json' console.log(_this.Analysis); - zip.file('project.json', JSON.stringify({ + zip.file('project.json', angular.toJson({ name: _this.name, videoSrc: _this.videoSrc, analysisCollection: _this.analysisCollection,