From 8d1a9f44b0ab08a743799c17267ea7f0f362ca1f Mon Sep 17 00:00:00 2001 From: eric Date: Sun, 25 May 2014 00:26:47 -0400 Subject: [PATCH] fix dropbox on second load The problem was that the dropbox saver checks to see if it's already run before adding buttons. the lightbox was actually running the saver a second time. on pages with multiple download buttons, the buttons would get added only on the first lightbox. --- frontend/templates/download.html | 4 +--- static/js/sitewide1.js | 7 +++++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/frontend/templates/download.html b/frontend/templates/download.html index 09c209fc..faf00898 100644 --- a/frontend/templates/download.html +++ b/frontend/templates/download.html @@ -8,7 +8,7 @@ {% block extra_js %} - + {% endblock %} {% endwith %} \ No newline at end of file diff --git a/static/js/sitewide1.js b/static/js/sitewide1.js index 166cfba0..760fca09 100644 --- a/static/js/sitewide1.js +++ b/static/js/sitewide1.js @@ -22,8 +22,11 @@ $j(document).ready(function() { }); if ($j(this).attr("href").indexOf("download") !== -1) { - jQuery.getScript('/static/js/download_page.js'); - jQuery.getScript('https://www.dropbox.com/static/api/2/dropins.js'); + $j.getScript('/static/js/download_page.js'); + if(typeof(Dropbox) != "undefined"){ + Dropbox._dropinsjs_loaded=false; + } + $j.getScript('https://www.dropbox.com/static/api/2/dropins.js'); var work_page = $j(this).attr("href").split("download")[0]; $j.cookie('next', work_page, {path: '/'}); }