Removed dropdown button on single file listen/read (Fix #1840)

This commit is contained in:
Ozzie Isaacs 2021-03-15 08:58:50 +01:00
parent 2451605033
commit 994bc8b0e4
2 changed files with 10 additions and 2 deletions

View File

@ -87,7 +87,7 @@ $(".container-fluid").bind('drop', function (e) {
var files = e.originalEvent.dataTransfer.files; var files = e.originalEvent.dataTransfer.files;
var test = $("#btn-upload")[0].accept; var test = $("#btn-upload")[0].accept;
$(this).css('background', ''); $(this).css('background', '');
const dt = new DataTransfer() const dt = new DataTransfer();
jQuery.each(files, function (index, item) { jQuery.each(files, function (index, item) {
if (test.indexOf(item.name.substr(item.name.lastIndexOf('.'))) !== -1) { if (test.indexOf(item.name.substr(item.name.lastIndexOf('.'))) !== -1) {
dt.items.add(item); dt.items.add(item);

View File

@ -55,6 +55,7 @@
{% endif %} {% endif %}
{% if reader_list and g.user.role_viewer() %} {% if reader_list and g.user.role_viewer() %}
<div class="btn-group" role="group"> <div class="btn-group" role="group">
{% if reader_list|length > 1 %}
<button id="read-in-browser" type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <button id="read-in-browser" type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="glyphicon glyphicon-eye-open"></span> {{_('Read in Browser')}} <span class="glyphicon glyphicon-eye-open"></span> {{_('Read in Browser')}}
<span class="caret"></span> <span class="caret"></span>
@ -64,15 +65,19 @@
<li><a target="_blank" href="{{ url_for('web.read_book', book_id=entry.id, book_format=format) }}">{{format}}</a></li> <li><a target="_blank" href="{{ url_for('web.read_book', book_id=entry.id, book_format=format) }}">{{format}}</a></li>
{%endfor%} {%endfor%}
</ul> </ul>
{% else %}
<a target="_blank" href="{{url_for('web.read_book', book_id=entry.id, book_format=reader_list[0])}}" id="readbtn" class="btn btn-primary" role="button"><span class="glyphicon glyphicon-eye-open"></span> {{_('Read in Browser')}} - {{reader_list[0]}}</a>
{% endif %}
</div> </div>
{% endif %} {% endif %}
{% if audioentries|length > 0 and g.user.role_viewer() %} {% if audioentries|length > 0 and g.user.role_viewer() %}
<div class="btn-group" role="group"> <div class="btn-group" role="group">
{% if audioentries|length > 1 %}
<button id="listen-in-browser" type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <button id="listen-in-browser" type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="glyphicon glyphicon-music"></span> {{_('Listen in Browser')}} <span class="glyphicon glyphicon-music"></span> {{_('Listen in Browser')}}
<span class="caret"></span> <span class="caret"></span>
</button> </button>
<ul class="dropdown-menu" aria-labelledby="read-in-browser"> <ul class="dropdown-menu" aria-labelledby="listen-in-browser">
{% for format in reader_list %} {% for format in reader_list %}
<li><a target="_blank" href="{{ url_for('web.read_book', book_id=entry.id, book_format=format) }}">{{format}}</a></li> <li><a target="_blank" href="{{ url_for('web.read_book', book_id=entry.id, book_format=format) }}">{{format}}</a></li>
{%endfor%} {%endfor%}
@ -85,6 +90,9 @@
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</ul> </ul>
{% else %}
<a target="_blank" href="{{url_for('web.read_book', book_id=entry.id, book_format=audioentries[0])}}" id="listenbtn" class="btn btn-primary" role="button"><span class="glyphicon glyphicon-music"></span> {{_('Listen in Browser')}} - {{audioentries[0]}}</a>
{% endif %}
</div> </div>
{% endif %} {% endif %}
</div> </div>