--- /dev/null
+(function($) {
+ $(function() {
+
+
+
+$('.open-player').click(function(event) {
+ event.preventDefault();
+ window.open($(this).attr('href'),
+ 'player',
+ 'width=422, height=500'
+ );
+});
+
+
+
+ });
+})(jQuery);
+
.play:hover {
color: #0D7E85;
}
+
+.daisy-list {
+ list-style: none;
+}
{% load i18n %}
+{% load url from future %}
{% load static from staticfiles %}
{% load chunks compressed catalogue_tags %}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<li><a class="menu" href="#info">{% trans "Infobox" %}</a></li>
<li><a href="{{ book.get_absolute_url }}">{% trans "Book's page" %}</a></li>
<li><a class="menu" href="#download">{% trans "Download" %}</a></li>
+ {% if related.media.mp3 or related.media.ogg %}
+ <li><a class="open-player" target="_blank" href="{% url "book_player" book.slug %}">
+ {% trans "Listen" %}</a></li>
+ {% endif %}
</ul>
</div>
<div id="info">
{% if book.pdf_file %}
<li><a href="{{ book.pdf_file.url}}">PDF</a> {% trans "to print" %}</li>
{% endif %}
- {% if book.epub_file %}
+ {% if book.epub_file %}
<li><a href="{{ book.epub_file.url}}">EPUB</a> {% trans "for a reader" %}</li>
{% endif %}
- {% if book.mobi_file %}
+ {% if book.mobi_file %}
<li><a href="{{ book.mobi_file.url}}">MOBI</a> {% trans "for Kindle" %}</li>
{% endif %}
- {% if book.txt_file %}
+ {% if book.txt_file %}
<li><a href="{{ book.txt_file.url}}">TXT</a> {% trans "for advanced usage" %}</li>
{% endif %}
- <li><a href="{% url custom_pdf_form book.slug %}">{% trans "Download a custom PDF" %}</a></li>
+ <li><a href="{% url "custom_pdf_form" book.slug %}">{% trans "Download a custom PDF" %}</a></li>
+ {% if related.media.mp3 or related.media.ogg or related.media.daisy %}
+ <li>{% trans "Download all audiobooks for this book" %}:
+ {% download_audio book %}</li>
+ {% endif %}
</ul>
</div>
<div id="header">
{% extends "catalogue/book_short.html" %}
{% load i18n %}
-{% load tag_list from catalogue_tags %}
+{% load download_audio tag_list from catalogue_tags %}
{% load cite_promo from social_tags %}
<h2 class="mono">{% trans "Download" %}</h2>
<ul class="plain">
<li>
- {% if related.media.mp3 or related.media.ogg %}
- {% trans "Download all audiobooks for this book" %}:
- {% if related.media.mp3 %}<a href="{% url download_zip_mp3 book.slug %}">MP3</a>{% endif %}{% if related.media.mp3 and related.media.ogg %},{% endif %}
- {% if related.media.ogg %}<a href="{% url download_zip_ogg book.slug %}">OGG</a>{% endif %}.
+ {% if related.media.mp3 or related.media.ogg or related.media.daisy %}
+ {% trans "Download all audiobooks for this book" %}:
+ {% download_audio book %}.
{% endif %}
</li>
<li>
<!DOCTYPE html>
<html>
+ {% load static from staticfiles %}
{% load i18n compressed %}
{% load catalogue_tags %}
{% load thumbnail %}
<div class="player-info normal-text">
<p><a target="_blank" href="{{ book.get_absolute_url }}">{% trans "Book's page" %}</a>.</p>
- <p>{% trans "Download as" %}
- <a href="{% url download_zip_mp3 book.slug %}">MP3</a>{% if have_oggs %},
- <a href="{% url download_zip_ogg book.slug %}">Ogg Vorbis</a>{% endif %}.
- </p>
+ <p>{% trans "Download as" %} {% download_audio book False %}.</p>
{% if book.has_daisy_file %}
<p>DAISY:</p>
from catalogue import forms
from catalogue.utils import split_tags
-from catalogue.models import Book, Fragment, Tag
+from catalogue.models import Book, BookMedia, Fragment, Tag
register = template.Library()
return reverse('catalogue.views.tagged_object_list', args=[
'/'.join((Tag.categories_dict[category], slug))
])
+
+
+@register.simple_tag
+def download_audio(book, daisy=True):
+ related = book.related_info()
+ links = []
+ if related['media'].get('mp3'):
+ links.append("<a href='%s'>%s</a>" %
+ (reverse('download_zip_mp3', args=[book.slug]),
+ BookMedia.formats['mp3'].name))
+ if related['media'].get('ogg'):
+ links.append("<a href='%s'>%s</a>" %
+ (reverse('download_zip_ogg', args=[book.slug]),
+ BookMedia.formats['ogg'].name))
+ if daisy and related['media'].get('daisy'):
+ for dsy in book.get_media('daisy'):
+ links.append("<a href='%s'>%s</a>" %
+ (dsy.file.url, BookMedia.formats['daisy'].name))
+ return ", ".join(links)
book_themes = book_themes.items()
book_themes.sort(key=lambda s: s[0].sort_key)
+ related = book.related_info()
return render_to_response('catalogue/book_text.html', locals(),
context_instance=RequestContext(request))
});
-$('.open-player').click(function(event) {
- event.preventDefault();
- window.open($(this).attr('href'),
- 'player',
- 'width=422, height=500'
- );
-});
-
-
$('.book-list-index').click(function(){
$('.book-list-show-index').hide('slow');
if($(this).parent().next('ul:not(:hidden)').length == 0){
'js/base.js',
'pdcounter/pdcounter.js',
'sponsors/js/sponsors.js',
+ 'player/openplayer.js',
'js/search.js',
),
'output_filename': 'js/player.min.js',
},
'book': {
- 'source_filenames': ('js/jquery.eventdelegation.js', 'js/jquery.scrollto.js', 'js/jquery.highlightfade.js', 'js/book.js',),
+ 'source_filenames': [
+ 'js/jquery.eventdelegation.js',
+ 'js/jquery.scrollto.js',
+ 'js/jquery.highlightfade.js',
+ 'js/book.js',
+ 'player/openplayer.js',
+ ],
'output_filename': 'js/book.min.js',
},
'book_ie': {