fixes
authorRadek Czajka <rczajka@rczajka.pl>
Mon, 25 Apr 2022 14:12:57 +0000 (16:12 +0200)
committerRadek Czajka <rczajka@rczajka.pl>
Mon, 25 Apr 2022 14:12:57 +0000 (16:12 +0200)
src/catalogue/static/player/2022_player.js
src/catalogue/templates/catalogue/2022/book_detail.html
src/catalogue/templates/catalogue/snippets/2022_jplayer.html
src/wolnelektury/static/2022/images/faved.svg [new file with mode: 0644]

index 0efe2fc..07bee41 100644 (file)
@@ -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");
                     }
                 });
 
                         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,
index 4eb6ec4..8548c29 100644 (file)
@@ -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 %}
 
 
 <html class="no-js">
@@ -79,7 +80,9 @@
             <li><span>Epoka:</span> {% for tag in book.epochs %}<a href="{{ tag.get_absolute_url }}">{{ tag.name }}</a> {% endfor %}</li>
             <li><span>Rodzaj:</span> {% for tag in book.kinds %}<a href="{{ tag.get_absolute_url }}">{{ tag.name }}</a> {% endfor %}</li>
             <li><span>Gatunek:</span> {% for tag in book.genres %}<a href="{{ tag.get_absolute_url }}">{{ tag.name }}</a> {% endfor %}</li>
+
           </ul>
+
           {% if book.parent or book.get_children %}
             <ul class="l-aside__zbiory">
               {% if book.parent %}
               {% endif %}
             </ul>
           {% endif  %}
+
         </aside>
         <div class="l-content">
           <header class="l-header">
               {% endif %}
             </div>
             <div class="l-header__actions">
-              <form method='post' action='{% url 'social_like_book' book.slug %}'>
-                {% csrf_token %}
-                <button class="l-button l-button--fav">
-                  <img src="{% static '2022/images/fav.svg' %}" alt="Dodaj do ulubionych">
-                </button>
-              </form>
+              {% likes_book book as likes %}
+              {% if likes %}
+                <form method='post' action='{% url 'social_unlike_book' book.slug %}'>
+                  {% csrf_token %}
+                  <button class="l-button l-button--fav">
+                    <img src="{% static '2022/images/faved.svg' %}" alt="Usuń z ulubionych">
+                  </button>
+                </form>
+              {% else %}
+                <form method='post' action='{% url 'social_like_book' book.slug %}'>
+                  {% csrf_token %}
+                  <button class="l-button l-button--fav">
+                    <img src="{% static '2022/images/fav.svg' %}" alt="Dodaj do ulubionych">
+                  </button>
+                </form>
+              {% endif %}
             </div>
           </header>
           <article class="l-article">
                         <div>
                           <h3>inne formaty</h3>
                           <ul>
+                            <li><a href="{% url 'custom_pdf_form' book.slug %}">Stwórz własny PDF</a></li>
                             {% if book.txt_file %}<li><a href="{{ book.txt_url }}">plik tekstowy (.txt)</a></li>{% endif %}
                             {% if book.fb2_file %}<li><a href="{{ book.fb2_url }}">FictionBook</a></li>{% endif %}
                           </ul>
                   </figure>
                 {% endif %}
                 <article class="l-author__info">
-                  <h3>{{ author.name }}</h3>
+                  <h3><a href="{{ author.get_absolute_url }}">{{ author.name }}</a></h3>
                   <div class="l-article__overlay" data-max-height="327">
                     {{ author.description|safe }}
                   </div>
               </div>
             {% endif %}
           </div>
-      </section>
+        </section>
       {% endfor %}
 
       <section class="l-section">
             {% endif %}
           {% endwith %}
           <ul class="links">
+            {% if book.wiki_link %}
+              <li><a href="{{ book.wiki_link }}">strona utworu w Wikipedii</a></li>
+            {% endif %}
             <li>
               <a href="{{ book.xml_url }}">źródłowy plik XML</a>
             </li>
index d710a01..e324540 100644 (file)
@@ -30,7 +30,9 @@
       <div class="c-player__timeline">
         <div class="c-player__info"></div>
         <div class="c-player__chapters">
-          <span>Rozdziały</span>
+          {% if audiobooks.0|length > 1 %}
+            <span>Rozdziały</span>
+          {% endif %}
           <ul class="jp-playlist">
             {% for i in audiobooks.0 %}
               <li
diff --git a/src/wolnelektury/static/2022/images/faved.svg b/src/wolnelektury/static/2022/images/faved.svg
new file mode 100644 (file)
index 0000000..ceeb693
--- /dev/null
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+   width="50"
+   height="50"
+   viewBox="0 0 50 50"
+   fill="none"
+   version="1.1"
+   id="svg9"
+   sodipodi:docname="faved.svg"
+   inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:svg="http://www.w3.org/2000/svg">
+  <defs
+     id="defs13" />
+  <sodipodi:namedview
+     id="namedview11"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageshadow="2"
+     inkscape:pageopacity="0.0"
+     inkscape:pagecheckerboard="0"
+     showgrid="false"
+     inkscape:zoom="23.645651"
+     inkscape:cx="24.000185"
+     inkscape:cy="23.915603"
+     inkscape:window-width="1920"
+     inkscape:window-height="1003"
+     inkscape:window-x="0"
+     inkscape:window-y="40"
+     inkscape:window-maximized="1"
+     inkscape:current-layer="svg9" />
+  <path
+     d="M0 25C0 11.1929 11.1929 0 25 0V0C38.8071 0 50 11.1929 50 25V25C50 38.8071 38.8071 50 25 50V50C11.1929 50 0 38.8071 0 25V25Z"
+     fill="white"
+     id="path2" />
+  <mask
+     id="path-2-inside-1_138_343"
+     fill="white">
+    <path
+       fill-rule="evenodd"
+       d="M38.4611 15.0136C41.8466 18.3991 41.8466 23.8882 38.4611 27.2737L37.0342 28.7006L37.0492 28.7156L26.7049 39.06C25.6468 40.118 23.9314 40.118 22.8733 39.06L19.0768 35.2634C18.9238 35.1305 18.7744 34.9912 18.6289 34.8457C18.4834 34.7002 18.3442 34.5508 18.2112 34.3979L11.087 27.2737C7.70147 23.8882 7.70146 18.3991 11.087 15.0136C14.4725 11.628 19.9616 11.628 23.3471 15.0136L24.774 16.4405L26.201 15.0136C29.5865 11.628 35.0755 11.628 38.4611 15.0136Z"
+       id="path4"
+       clip-rule="evenodd" />
+  </mask>
+  <path
+     d="M38.4611 27.2737L36.3398 25.1524L36.3398 25.1524L38.4611 27.2737ZM38.4611 15.0136L40.5824 12.8922V12.8922L38.4611 15.0136ZM37.0342 28.7006L34.9128 26.5793L32.7915 28.7006L34.9128 30.8219L37.0342 28.7006ZM37.0492 28.7156L39.1705 30.837L41.2918 28.7156L39.1705 26.5943L37.0492 28.7156ZM26.7049 39.06L24.5835 36.9387L26.7049 39.06ZM22.8733 39.06L24.9946 36.9387L22.8733 39.06ZM19.0768 35.2634L21.1981 33.1421L21.1242 33.0682L21.0453 32.9997L19.0768 35.2634ZM18.6289 34.8457L16.5076 36.967L16.5076 36.967L18.6289 34.8457ZM18.2112 34.3979L20.475 32.4293L20.4064 32.3505L20.3325 32.2766L18.2112 34.3979ZM11.087 27.2737L13.2083 25.1524H13.2083L11.087 27.2737ZM11.087 15.0136L13.2083 17.1349L11.087 15.0136ZM23.3471 15.0136L21.2258 17.1349V17.1349L23.3471 15.0136ZM24.774 16.4405L22.6527 18.5618L24.774 20.6831L26.8954 18.5618L24.774 16.4405ZM26.201 15.0136L28.3223 17.1349L26.201 15.0136ZM40.5824 29.395C45.1395 24.8379 45.1395 17.4494 40.5824 12.8922L36.3398 17.1349C38.5537 19.3489 38.5537 22.9384 36.3398 25.1524L40.5824 29.395ZM39.1555 30.8219L40.5824 29.395L36.3398 25.1524L34.9128 26.5793L39.1555 30.8219ZM34.9128 30.8219L34.9279 30.837L39.1705 26.5943L39.1555 26.5793L34.9128 30.8219ZM34.9279 26.5943L24.5835 36.9387L28.8262 41.1813L39.1705 30.837L34.9279 26.5943ZM24.5835 36.9387C24.6971 36.8251 24.8811 36.8251 24.9946 36.9387L20.752 41.1813C22.9816 43.4109 26.5966 43.4109 28.8262 41.1813L24.5835 36.9387ZM24.9946 36.9387L21.1981 33.1421L16.9554 37.3848L20.752 41.1813L24.9946 36.9387ZM16.5076 36.967C16.7024 37.1618 16.9027 37.3486 17.1082 37.5272L21.0453 32.9997C20.9449 32.9123 20.8465 32.8206 20.7503 32.7244L16.5076 36.967ZM15.9474 36.3665C16.1261 36.5719 16.3128 36.7722 16.5076 36.967L20.7503 32.7244C20.654 32.6282 20.5623 32.5297 20.475 32.4293L15.9474 36.3665ZM20.3325 32.2766L13.2083 25.1524L8.96569 29.395L16.0899 36.5192L20.3325 32.2766ZM13.2083 25.1524C10.9944 22.9384 10.9944 19.3489 13.2083 17.1349L8.96568 12.8922C4.40857 17.4494 4.40858 24.8379 8.96569 29.395L13.2083 25.1524ZM13.2083 17.1349C15.4223 14.9209 19.0118 14.9209 21.2258 17.1349L25.4685 12.8922C20.9113 8.33514 13.5228 8.33513 8.96568 12.8922L13.2083 17.1349ZM21.2258 17.1349L22.6527 18.5618L26.8954 14.3192L25.4685 12.8922L21.2258 17.1349ZM24.0796 12.8922L22.6527 14.3192L26.8954 18.5618L28.3223 17.1349L24.0796 12.8922ZM40.5824 12.8922C36.0253 8.33513 28.6368 8.33513 24.0796 12.8922L28.3223 17.1349C30.5362 14.9209 34.1258 14.9209 36.3398 17.1349L40.5824 12.8922Z"
+     fill="#FF4C54"
+     id="path7"
+     mask="url(#path-2-inside-1_138_343)"
+     style="fill:#ff4c54" />
+  <path
+     style="fill:#ff4c54;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+     d="m 26.612157,37.398057 c -1.017404,1.27723 -2.21253,1.280813 -3.608402,-0.154269 l -9.801272,-9.880042 c -9.2950974,-7.60318 3.906349,-19.8785797 11.706859,-8.734891 8.133961,-9.93822 18.437971,-0.791174 13.137848,6.679566 z"
+     id="path3075"
+     sodipodi:nodetypes="cccccc" />
+</svg>