diff --git a/www/file/main.js b/www/file/main.js index 5d6542f24..a07a7d27e 100644 --- a/www/file/main.js +++ b/www/file/main.js @@ -55,6 +55,7 @@ define([ $row.find('.upCancel').html('-'); var $pv = $row.find('.progressValue'); var $pb = $row.find('.progressContainer'); + var $link = $row.find('.upLink'); var updateProgress = function (progressValue) { $pv.text(Math.round(progressValue*100)/100 + '%'); @@ -103,9 +104,17 @@ define([ console.log("encrypted blob is now available as %s", uri); var b64Key = Nacl.util.encodeBase64(key); - Cryptpad.replaceHash(Cryptpad.getFileHashFromKeys(id, b64Key)); - APP.toolbar.addElement(['fileshare'], {}); + var hash = Cryptpad.getFileHashFromKeys(id, b64Key); + + $link.attr('href', '/file/#' + hash) + .click(function (e) { + e.preventDefault(); + window.open($link.attr('href'), '_blank'); + }); + + // TODO add button to table which copies link to clipboard? + //APP.toolbar.addElement(['fileshare'], {}); var title = document.title = metadata.name; myFile = blob; @@ -114,7 +123,7 @@ define([ Title.updateTitle(title || defaultName); APP.toolbar.title.show(); console.log(title); - Cryptpad.alert(Messages._getKey('upload_success', [title])); + Cryptpad.log(Messages._getKey('upload_success', [title])); queue.inProgress = false; queue.next(); }); @@ -125,9 +134,11 @@ define([ queue.inProgress = false; queue.next(); if (e === 'TOO_LARGE') { + // TODO update table to say too big? return void Cryptpad.alert(Messages.upload_tooLarge); } if (e === 'NOT_ENOUGH_SPACE') { + // TODO update table to say not enough space? return void Cryptpad.alert(Messages.upload_notEnoughSpace); } console.error(e); @@ -184,7 +195,11 @@ define([ $tr.find('.progressValue').text(Messages.upload_cancelled); }); - $('