From edf01dc493de62acf2abf93acfcc023a0877439f Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Mon, 25 Apr 2022 16:12:57 +0200 Subject: [PATCH] fixes --- src/catalogue/static/player/2022_player.js | 8 +-- .../templates/catalogue/2022/book_detail.html | 34 ++++++++--- .../catalogue/snippets/2022_jplayer.html | 4 +- src/wolnelektury/static/2022/images/faved.svg | 59 +++++++++++++++++++ 4 files changed, 91 insertions(+), 14 deletions(-) create mode 100644 src/wolnelektury/static/2022/images/faved.svg diff --git a/src/catalogue/static/player/2022_player.js b/src/catalogue/static/player/2022_player.js index 0efe2fc10..07bee41eb 100644 --- a/src/catalogue/static/player/2022_player.js +++ b/src/catalogue/static/player/2022_player.js @@ -4,7 +4,6 @@ $.jPlayer.timeFormat.showHour = true; $(".jp-jplayer").each(function() { - console.log('starting player') var $self = $(this); var $root = $self.parent(); var $currentMedia = null @@ -15,7 +14,6 @@ var player = null; var setMedia = function(elem, time=0) { - console.log('setMedia', elem, time); var media = {} media['mp3'] = elem.attr('data-mp3'); @@ -37,7 +35,6 @@ player.jPlayer("pause", time); $currentMedia = elem; - $(".play-prev", $root).prop("disabled", !elem.prev().length); $(".play-next", $root).prop("disabled", !elem.next().length); let du = elem.data('duration'); @@ -60,7 +57,6 @@ ready: function() { player = $(this); - console.log(1); let selectItem = $('.c-select li'); selectItem.on('click', function() { @@ -80,6 +76,9 @@ let p = $currentMedia.prev(); if (p.length) { setMedia(p).jPlayer("play"); + } else { + // If in first part, restart it. + setMedia($currentMedia).jPlayer("play"); } }); @@ -137,7 +136,6 @@ audiobooks = {}; } if (t && event.jPlayer.status.duration - t > 10) { - console.log('writer'); audiobooks[$root.attr("data-book-slug")] = [ Date.now(), event.jPlayer.status.media.id, diff --git a/src/catalogue/templates/catalogue/2022/book_detail.html b/src/catalogue/templates/catalogue/2022/book_detail.html index 4eb6ec4da..8548c29f7 100644 --- a/src/catalogue/templates/catalogue/2022/book_detail.html +++ b/src/catalogue/templates/catalogue/2022/book_detail.html @@ -4,6 +4,7 @@ {% load choose_cites from social_tags %} {% load choose_fragment license_icon from catalogue_tags %} {% load catalogue_tags %} +{% load likes_book from social_tags %} @@ -79,7 +80,9 @@
  • Epoka: {% for tag in book.epochs %}{{ tag.name }} {% endfor %}
  • Rodzaj: {% for tag in book.kinds %}{{ tag.name }} {% endfor %}
  • Gatunek: {% for tag in book.genres %}{{ tag.name }} {% endfor %}
  • + + {% if book.parent or book.get_children %} {% endif %} +
    -
    - {% csrf_token %} - -
    + {% likes_book book as likes %} + {% if likes %} +
    + {% csrf_token %} + +
    + {% else %} +
    + {% csrf_token %} + +
    + {% endif %}
    @@ -240,6 +254,7 @@

    inne formaty

    @@ -350,7 +365,7 @@ {% endif %}
    -

    {{ author.name }}

    +

    {{ author.name }}

    {{ author.description|safe }}
    @@ -378,7 +393,7 @@
    {% endif %} - + {% endfor %}
    @@ -398,6 +413,9 @@ {% endif %} {% endwith %}