From a4b492136bbe64f4774366e26eef952cdb4ee585 Mon Sep 17 00:00:00 2001 From: j Date: Fri, 25 Dec 2015 19:19:12 +0530 Subject: [PATCH] use Blob url for annotation export --- static/js/exportAnnotationsDialog.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/static/js/exportAnnotationsDialog.js b/static/js/exportAnnotationsDialog.js index 01e861ab..8116649a 100644 --- a/static/js/exportAnnotationsDialog.js +++ b/static/js/exportAnnotationsDialog.js @@ -120,14 +120,18 @@ pandora.ui.exportAnnotationsDialog = function(options) { out: annotation.out, text: text }; - }); - $link.attr({ - download: options.title + ' - ' - + Ox.getObjectById(layers, layer).title + '.' + format, - href: 'data:text/plain;base64,' + btoa(Ox.encodeUTF8( + }), + blob = new Blob([Ox.encodeUTF8( format == 'json' ? JSON.stringify(items, null, ' ') : Ox.formatSRT(items) + )], {type: 'text/plain'}), + url = window.URL.createObjectURL(blob); + + $link.attr({ + download: options.title + ' - ' + + Ox.getObjectById(layers, layer).title + '.' + format, + href: url, )) }); }