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.pull/1/head
parent
2e41e2a33d
commit
8d1a9f44b0
|
@ -8,7 +8,7 @@
|
||||||
{% block extra_js %}
|
{% block extra_js %}
|
||||||
<script type="text/javascript" src="/static/js/embed.js"></script>
|
<script type="text/javascript" src="/static/js/embed.js"></script>
|
||||||
<script type="text/javascript" src="/static/js/download_page.js"></script>
|
<script type="text/javascript" src="/static/js/download_page.js"></script>
|
||||||
|
<script type="text/javascript" src="https://www.dropbox.com/static/api/2/dropins.js" ></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var $j = jQuery.noConflict();
|
var $j = jQuery.noConflict();
|
||||||
$j(document).ready(function() {
|
$j(document).ready(function() {
|
||||||
|
@ -139,7 +139,6 @@ $j(document).ready(function() {
|
||||||
<a href="{% url download_ebook ebook.id %}">{{ ebook.format }}</a>
|
<a href="{% url download_ebook ebook.id %}">{{ ebook.format }}</a>
|
||||||
{% if ebook.is_direct %}<a class="dropbox-saver" href="{{ ebook.download_url }}" data-filename="unglueit-{{ work.id }}.{{ ebook.format }}"></a>{% endif %}
|
{% if ebook.is_direct %}<a class="dropbox-saver" href="{{ ebook.download_url }}" data-filename="unglueit-{{ work.id }}.{{ ebook.format }}"></a>{% endif %}
|
||||||
|
|
||||||
</p>
|
|
||||||
|
|
||||||
{% if not forloop.last %}<br /><br />{% endif %}
|
{% if not forloop.last %}<br /><br />{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -399,7 +398,6 @@ $j(document).ready(function() {
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript" src="https://www.dropbox.com/static/api/2/dropins.js" ></script>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% endwith %}
|
{% endwith %}
|
|
@ -22,8 +22,11 @@ $j(document).ready(function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
if ($j(this).attr("href").indexOf("download") !== -1) {
|
if ($j(this).attr("href").indexOf("download") !== -1) {
|
||||||
jQuery.getScript('/static/js/download_page.js');
|
$j.getScript('/static/js/download_page.js');
|
||||||
jQuery.getScript('https://www.dropbox.com/static/api/2/dropins.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];
|
var work_page = $j(this).attr("href").split("download")[0];
|
||||||
$j.cookie('next', work_page, {path: '/'});
|
$j.cookie('next', work_page, {path: '/'});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue