Merge pull request #360 from Gluejar/add_dropbox

Add dropbox
pull/1/head
Raymond Yee 2014-05-25 10:43:26 -07:00
commit 3871844c04
2 changed files with 6 additions and 5 deletions

View File

@ -8,7 +8,7 @@
{% block extra_js %}
<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="https://www.dropbox.com/static/api/2/dropins.js" ></script>
<script type="text/javascript">
var $j = jQuery.noConflict();
$j(document).ready(function() {
@ -139,7 +139,6 @@ $j(document).ready(function() {
<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 %}
</p>
{% if not forloop.last %}<br /><br />{% endif %}
{% endfor %}
@ -399,7 +398,6 @@ $j(document).ready(function() {
{% endif %}
</div>
</div>
<script type="text/javascript" src="https://www.dropbox.com/static/api/2/dropins.js" ></script>
{% endblock %}
{% endwith %}

View File

@ -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: '/'});
}