From 376e1efa4c2484afb3d46f6739e6534b80563442 Mon Sep 17 00:00:00 2001 From: Danny Coates Date: Thu, 3 Aug 2017 15:42:40 -0700 Subject: [PATCH] don't preventDefault on links --- frontend/src/download.js | 8 +------- frontend/src/upload.js | 17 ++++------------- 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/frontend/src/download.js b/frontend/src/download.js index b9692401..0f004357 100644 --- a/frontend/src/download.js +++ b/frontend/src/download.js @@ -14,23 +14,17 @@ $(document).ready(function() { //link back to homepage $('.send-new').attr('href', window.location.origin); - $('.send-new').click(function(target) { - target.preventDefault(); + $('.send-new').click(function() { sendEvent('recipient', 'restarted', { cd2: 'completed' - }).then(() => { - location.href = target.currentTarget.href; }); }); $('.legal-links a, .social-links a, #dl-firefox').click(function(target) { - target.preventDefault(); const metric = findMetric(target.currentTarget.href); // record exited event by recipient sendEvent('recipient', 'exited', { cd3: metric - }).then(() => { - location.href = target.currentTarget.href; }); }); diff --git a/frontend/src/upload.js b/frontend/src/upload.js index 2191a7fe..1ae58428 100644 --- a/frontend/src/upload.js +++ b/frontend/src/upload.js @@ -23,35 +23,26 @@ $(document).ready(function() { $('#file-upload').change(onUpload); $('.legal-links a, .social-links a, #dl-firefox').click(function(target) { - target.preventDefault(); const metric = findMetric(target.currentTarget.href); // record exited event by recipient sendEvent('sender', 'exited', { cd3: metric - }).then(() => { - location.href = target.currentTarget.href; }); }); - $('#send-new-completed').click(function(target) { - target.preventDefault(); + $('#send-new-completed').click(function() { // record restarted event + storage.referrer = 'errored-upload'; sendEvent('sender', 'restarted', { cd2: 'completed' - }).then(() => { - storage.referrer = 'completed-upload'; - location.href = target.currentTarget.href; }); }); - $('#send-new-error').click(function(target) { - target.preventDefault(); + $('#send-new-error').click(function() { // record restarted event + storage.referrer = 'errored-upload'; sendEvent('sender', 'restarted', { cd2: 'errored' - }).then(() => { - storage.referrer = 'errored-upload'; - location.href = target.currentTarget.href; }); });