mirror of
https://gitlab.com/LazyLibrarian/LazyLibrarian.git
synced 2026-02-06 10:47:15 +00:00
288 lines
14 KiB
HTML
288 lines
14 KiB
HTML
<%inherit file="base.html" />
|
|
<%!
|
|
import lazylibrarian
|
|
from lazylibrarian.config2 import CONFIG
|
|
%>
|
|
<%def name="headerIncludes()">
|
|
<div id="subhead_container" class="row">
|
|
<form action="find_comic" method="get">
|
|
<input type="hidden" name="comicfilter" id="comicfilter" value=''>
|
|
<div id="subhead_menu" class="col-xs-12 col-md-8">
|
|
%if perm&lazylibrarian.perm_force:
|
|
<a href="force_search?source=comics" class="button btn btn-sm btn-primary"><i class="fa fa-search"></i> Search</a>
|
|
<a href="force_process?source=comics" class="button btn btn-sm btn-primary"><i class="fa fa-cogs"></i> Run Post-Processor</a>
|
|
<a href="comic_scan" class="button btn btn-sm btn-primary"><i class="fa fa-bolt"></i> Library Scan</a>
|
|
%endif
|
|
<a href="comic_wall" class="button btn btn-sm btn-primary"><i class="fa fa-calendar-check"></i> Recent Issues</a>
|
|
%if CONFIG['USER_ACCOUNTS']:
|
|
%if CONFIG['RSS_ENABLED']:
|
|
<a href="rss_feed?user=${user}&type=Comic&limit=10.xml" class="button btn btn-sm btn-primary" data-toggle="tooltip" title="rss feed of recent downloads"><i class="fa fa-rss"></i></a>
|
|
<link rel="alternate" type="application/rss+xml" title="LazyLibrarian latest comics" href="rss_feed?user=${user}&type=Comic&limit=10.xml">
|
|
%endif
|
|
%if pref&lazylibrarian.pref_mycomics:
|
|
<a href="toggle_my_comics" class="button btn btn-sm btn-primary" data-toggle="tooltip" title="All, or just mine"><i class="fa fa-user-circle"></i></a>
|
|
%else:
|
|
<a href="toggle_my_comics" class="button btn btn-sm btn-primary" data-toggle="tooltip" title="All, or just mine"><i class="fa fa-users"></i></a>
|
|
%endif
|
|
%endif
|
|
</div>
|
|
<div class="clearfix visible-xs"><hr/></div>
|
|
<div class="col-xs-12 col-md-4">
|
|
<div class="form-group">
|
|
<label class="sr-only">Comic Title</label>
|
|
<div class="input-group">
|
|
<input type="text" placeholder="Comic Title" name="title" class="form-control input-sm col-xs-12">
|
|
<span class="input-group-btn">
|
|
%if CONFIG['IMP_AUTOSEARCH']:
|
|
<button type="submit" value="Comic" class="btn btn-sm btn-primary" data-toggle="tooltip" data-placement="bottom" title="Search for comic"><i class="fa fa-search-plus"></i><span> Comic</span></button>
|
|
%else:
|
|
<button type="submit" value="Comic" class="btn btn-sm btn-primary" data-toggle="tooltip" data-placement="bottom" title="Add comic"><i class="fa fa-plus"></i><span> Comic</span></button>
|
|
%endif
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</%def>
|
|
<%def name="body()">
|
|
<h1>${title}</h1>
|
|
%if lazylibrarian.COMIC_UPDATE == True:
|
|
<p>
|
|
<button onclick="" id="myAlert" title=""><i class="fa fa-circle-notch fa-spin"></i> Libraryscan in progress ...</button>
|
|
</p>
|
|
%endif
|
|
<form name="mark_comics" id="mark_comics" action="mark_comics" method="get" class="form-inline" onsubmit="return false;">
|
|
<div class="row">
|
|
% if perm%lazylibrarian.perm_status or CONFIG['USER_ACCOUNTS']:
|
|
<div class="col-xs-12 col-sm-5">
|
|
<div class="form-group">
|
|
<label for="action" class="">Mark selected as</label>
|
|
<select class="mark_comics form-control input-sm" id="action" name="action">
|
|
%if perm&lazylibrarian.perm_status:
|
|
<option value="Active">Active</option>
|
|
<option value="Paused">Paused</option>
|
|
<option value="Reset">Reset</option>
|
|
<option value="Remove">Remove</option>
|
|
<option value="Delete">Delete</option>
|
|
%endif
|
|
%if CONFIG['USER_ACCOUNTS']:
|
|
<option value="Subscribe">Subscribe</option>
|
|
<option value="Unsubscribe">Unsubscribe</option>
|
|
%endif
|
|
</select>
|
|
</div>
|
|
<button type="submit" class="btn btn-sm btn-primary" onclick="validateForm()">Go</button>
|
|
</div>
|
|
%endif
|
|
%if CONFIG['TOGGLES']:
|
|
<div class="toggles col-xs-12 col-sm-7 text-right">
|
|
Toggle: <a class="toggle-vis" data-column="1"> Cover</a>
|
|
<a class="toggle-vis" data-column="2"> Title</a>
|
|
<a class="toggle-vis" data-column="3"> Num</a>
|
|
<a class="toggle-vis" data-column="4"> Added</a>
|
|
<a class="toggle-vis" data-column="5"> Latest</a>
|
|
<a class="toggle-vis" data-column="6"> Status</a>
|
|
<a class="toggle-vis" data-column="7"> Select</a>
|
|
</div>
|
|
%endif
|
|
</div>
|
|
<p> </p>
|
|
<div class="table-responsive">
|
|
<table class="display table table-striped table-hover table-bordered" id="book_table">
|
|
<thead>
|
|
<tr>
|
|
%if perm&lazylibrarian.perm_status:
|
|
<th class="select text-center no-sort"><input type="checkbox" id="allcheck" onClick="toggleAll(this)" /></th>
|
|
%else:
|
|
<th class="hidden"></th>
|
|
%endif
|
|
% if covercount > 0:
|
|
<th class="bookart text-center no-sort">Cover</th>
|
|
% else:
|
|
<th class="bookart hidden">Cover</th>
|
|
% endif
|
|
<th class="bookname text-center">Title</th>
|
|
<th class="number text-center">Num</th>
|
|
<th class="series text-center">Added</th>
|
|
<th class="date text-center">Latest Issue</th>
|
|
<th class="stars text-center">Status</th>
|
|
<th class="status text-center no-sort">Select</th>
|
|
</tr>
|
|
</thead>
|
|
</table>
|
|
</div>
|
|
</form>
|
|
</%def>
|
|
<%def name="javascriptIncludes()">
|
|
<script>
|
|
$(document).ready(function()
|
|
{
|
|
var selected = [];
|
|
var intjob = 0;
|
|
$('#comicfilter').val(getUrlVars()['comic_filter']);
|
|
|
|
var oTable = $('#book_table').DataTable(
|
|
{
|
|
"bAutoWidth": false,
|
|
"stateSave": true,
|
|
"order": [[ 2, 'asc']],
|
|
"rowId": 0,
|
|
"columnDefs":
|
|
[{ targets: 'no-sort', orderable: false },
|
|
{ targets: [0],
|
|
'class': 'text-center',
|
|
'render': function(data, type, row) {
|
|
if ( $.inArray('C' + data, selected) !== -1 ) {
|
|
return '<input type="checkbox" id="C' + data + '" name="' + data + '" class="checkbox" checked=true />'; }
|
|
return '<input type="checkbox" id="C' + data + '" name="' + data + '" class="checkbox" />';} },
|
|
{ targets: [1],
|
|
'class': 'text-center',
|
|
'render': function(data, type, row) {
|
|
return '<a href="' + data + '" target="_blank" rel="noreferrer"><img src="' + data + '" alt="Cover" class="bookcover-sm img-responsive"></a>';} },
|
|
{ targets: [2],
|
|
'class': 'text-left',
|
|
'render': function(data, type, row) {
|
|
btn = '<button onclick="bookinfo(\'' + row[0] + '\')" class="button btn-link text-left" type="button" ' + '>' + row[2] + '</button>'
|
|
if ( row[8]) { btn = btn + ' (' + row[8] + ')' }
|
|
if ( row[11]) {
|
|
let arr = row[11].split(',');
|
|
let genres = ''
|
|
arr.forEach(function (item, index) {
|
|
genres = genres + ' <a href=\'comics?comic_filter=' + item.trim() + '\'">' + item.trim() + '</a>';
|
|
});
|
|
btn = btn + '<br><i><small>[' + genres + ']</i></small>'
|
|
}
|
|
if ( row[10]) { btn = btn + '<br><small><a href="' + row[10] + '" target="_blank" rel="noreferrer">'
|
|
if ( row[10].indexOf('comicvine') >= 0) { btn = btn + 'ComicVine</a></small>'}
|
|
if ( row[10].indexOf('comixology') >= 0) { btn = btn + 'ComiXology</a></small>'}
|
|
}
|
|
if ( row[9]) { btn = btn + ' <i><small>' + row[9] + '</small></i> ' }
|
|
return btn
|
|
;} },
|
|
{ targets: [3, 4, 5, 6],
|
|
'class': 'text-center'},
|
|
{ targets: [7],
|
|
'class': 'text-center',
|
|
'render': function(data, type, row) {
|
|
var btn = data
|
|
if ( btn.indexOf('Open') >= 0 ) {
|
|
btn = '<a class="button green btn btn-xs btn-warning" href="open_comic?comicid=' +
|
|
row[0] + '" target="_self"><i class="fa fa-book"></i>'
|
|
%if CONFIG['COMIC_SINGLE']:
|
|
if ( row[3] == 1) { btn = btn + ' Open</a>' }
|
|
else { btn = btn + ' Show</a>' }
|
|
%else:
|
|
btn = btn + ' Show</a>'
|
|
%endif
|
|
}
|
|
else if ( btn.indexOf('Wanted') >= 0 ) {
|
|
btn = '<p><a class="a btn btn-xs btn-danger" href="comicissue_page?comicid=' + row[0] +
|
|
'" target="_self">' + btn + '</a></p>'
|
|
%if perm&lazylibrarian.perm_force:
|
|
btn += '<p><a class="b btn btn-xs btn-success" href="search_for_comic?comicid=' + row[0] +
|
|
'" target="_self"><i class="fa fa-search"></i> Search</a></p>'
|
|
%endif
|
|
}
|
|
else if ( btn.indexOf('Snatched') >= 0 ) {
|
|
btn = '<a class="button btn btn-xs btn-info" href="comicissue_page?comicid=' + row[0] +
|
|
'" target="_self">' + btn + '</a>'}
|
|
else if ( btn.indexOf('Have') >= 0 ) {
|
|
btn = '<a class="button btn btn-xs btn-info" href="comicissue_page?comicid=' + row[0] +
|
|
'" target="_self">' + btn + '</a>'}
|
|
else { btn = '<a class="button btn btn-xs btn-default grey">' + btn + '</a>'}
|
|
return btn;} },
|
|
],
|
|
"oLanguage": {
|
|
"sSearch": "Filter: ",
|
|
"sLengthMenu":"_MENU_ rows per page",
|
|
"sEmptyTable": "No comics found",
|
|
"sInfo":"Showing _START_ to _END_ of _TOTAL_ rows",
|
|
"sInfoEmpty":"Showing 0 to 0 of 0 results",
|
|
"sInfoFiltered":"(filtered from _MAX_ total rows)"},
|
|
"sPaginationType": "full_numbers",
|
|
"aaSorting": [[2, 'asc']],
|
|
"bServerSide": true,
|
|
"sAjaxSource": 'get_comics',
|
|
"aLengthMenu": [[5, 10, 15, 25, 50, 100, 500, 1000, 5000, -1], [5, 10, 15, 25, 50, 100, 500, 1000, 5000, "All"]],
|
|
"iDisplayLength": ${CONFIG['DISPLAYLENGTH']},
|
|
"bFilter": true,
|
|
"fnRowCallback": function (nRow, aData, iDisplayIndex, iDisplayIndexFull) {
|
|
%if perm&lazylibrarian.perm_status == 0:
|
|
$('td', nRow).eq(0).addClass("hidden");
|
|
%endif
|
|
return nRow;
|
|
},
|
|
});
|
|
|
|
$('#book_table tbody').on('click', 'tr input:checkbox', function () {
|
|
var id = this.id;
|
|
var index = $.inArray(id, selected);
|
|
if ( index === -1 ) {
|
|
selected.push( id );
|
|
} else {
|
|
selected.splice( index, 1 );
|
|
}
|
|
$(this).toggleClass('selected');
|
|
} );
|
|
|
|
oTable.on( 'xhr', function () {
|
|
var json = oTable.ajax.json();
|
|
if (json.loading) {
|
|
if (intjob === 0) {
|
|
intjob = setInterval( function () {
|
|
oTable.ajax.reload( null, false );
|
|
}, 10000 );
|
|
}
|
|
}
|
|
else {
|
|
if (intjob != 0) { clearInterval( intjob )};
|
|
$('#myAlert').addClass('hidden');
|
|
};
|
|
});
|
|
|
|
var filt = decodeURI(document.getElementById("comicfilter").value)
|
|
if (! (filt === null || filt.trim() === "")){
|
|
oTable.search(filt).draw()
|
|
}
|
|
|
|
$('.dataTables_filter input').attr("placeholder", "Results filter");
|
|
$('a.toggle-vis').click(function (e) {
|
|
e.preventDefault();
|
|
var column = oTable.column( $(this).attr('data-column') );
|
|
column.visible( ! column.visible() );
|
|
} );
|
|
$('#w_width').val(window.innerWidth);
|
|
});
|
|
|
|
function validateForm() {
|
|
var x = document.forms["mark_comics"]["action"].value;
|
|
var c = (document.querySelectorAll('input[class="checkbox"]:checked').length);
|
|
var all_check = document.getElementById("allcheck").checked;
|
|
if (all_check) { c -= 1};
|
|
if (c > 0 && x == "Delete") {
|
|
if (c == 1) {msg = "Are you sure you want to permanently delete the selected comic?"}
|
|
if (c > 1) {msg = "Are you sure you want to permanently delete the " + c + " selected comics?"}
|
|
bootbox.confirm({
|
|
message: msg,
|
|
buttons: {
|
|
confirm: {
|
|
label: 'Yes',
|
|
className: 'btn-success'
|
|
},
|
|
cancel: {
|
|
label: 'No',
|
|
className: 'btn-danger'
|
|
}
|
|
},
|
|
callback: function (result) {
|
|
if (result) { document.getElementById("mark_comics").submit(); }
|
|
}
|
|
});
|
|
return false;
|
|
}
|
|
else { document.getElementById("mark_comics").submit(); }
|
|
}
|
|
</script>
|
|
</%def>
|