only _blank links while downloading. fixed safari link after download

This commit is contained in:
Danny Coates 2017-08-05 09:40:57 -07:00
parent 432a39d313
commit 859554ce21
No known key found for this signature in database
GPG key ID: 4C442633C62E00CB
8 changed files with 74 additions and 60 deletions

View file

@ -1,20 +1,17 @@
require('./common');
const { Raven, findMetric, sendEvent } = require('./common');
const FileReceiver = require('./fileReceiver');
const { notify, findMetric, sendEvent, gcmCompliant } = require('./utils');
const { notify, gcmCompliant } = require('./utils');
const bytes = require('bytes');
const Storage = require('./storage');
const storage = new Storage(localStorage);
const links = require('./links');
const $ = require('jquery');
require('jquery-circle-progress');
const Raven = window.Raven;
$(document).ready(function() {
gcmCompliant()
.then(function() {
//link back to homepage
$('.send-new').attr('href', window.location.origin);
$('.send-new').click(function() {
sendEvent('recipient', 'restarted', {
@ -46,7 +43,8 @@ $(document).ready(function() {
function download() {
// Disable the download button to avoid accidental double clicks.
$('#download-btn').attr('disabled', 'disabled');
links.setOpenInNewTab(true);
storage.totalDownloads += 1;
const fileReceiver = new FileReceiver();
@ -181,7 +179,8 @@ $(document).ready(function() {
.catch(err => {
Raven.captureException(err);
return Promise.reject(err);
});
})
.then(() => links.setOpenInNewTab(false));
}
})
.catch(err => {