Added swipe support for comic reader and txt reader (#925)
Bugfix for txt file not present on serving file
This commit is contained in:
parent
0b32738f4e
commit
d2ad78eb40
|
@ -635,6 +635,14 @@ function init(filename) {
|
||||||
// Focus the scrollable area so that keyboard scrolling work as expected
|
// Focus the scrollable area so that keyboard scrolling work as expected
|
||||||
$("#mainContent").focus();
|
$("#mainContent").focus();
|
||||||
|
|
||||||
|
$("#mainContent").swipe( {
|
||||||
|
swipeRight:function() {
|
||||||
|
showLeftPage();
|
||||||
|
},
|
||||||
|
swipeLeft:function() {
|
||||||
|
showRightPage();
|
||||||
|
},
|
||||||
|
});
|
||||||
$("#mainImage").click(function(evt) {
|
$("#mainImage").click(function(evt) {
|
||||||
// Firefox does not support offsetX/Y so we have to manually calculate
|
// Firefox does not support offsetX/Y so we have to manually calculate
|
||||||
// where the user clicked in the image.
|
// where the user clicked in the image.
|
||||||
|
|
|
@ -13,14 +13,10 @@
|
||||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/kthoom.css') }}" type="text/css"/>
|
<link rel="stylesheet" href="{{ url_for('static', filename='css/kthoom.css') }}" type="text/css"/>
|
||||||
|
|
||||||
<script src="{{ url_for('static', filename='js/libs/jquery.min.js') }}"></script>
|
<script src="{{ url_for('static', filename='js/libs/jquery.min.js') }}"></script>
|
||||||
|
<script src="{{ url_for('static', filename='js/libs/plugins.js') }}"></script>
|
||||||
<script src="{{ url_for('static', filename='js/libs/screenfull.min.js') }}"></script>
|
<script src="{{ url_for('static', filename='js/libs/screenfull.min.js') }}"></script>
|
||||||
<script src="{{ url_for('static', filename='js/io/bytestream.js') }}"></script>
|
|
||||||
<script src="{{ url_for('static', filename='js/io/bytebuffer.js') }}"></script>
|
|
||||||
<script src="{{ url_for('static', filename='js/io/bitstream.js') }}"></script>
|
|
||||||
<script src="{{ url_for('static', filename='js/archive/archive.js') }}"></script>
|
|
||||||
<script src="{{ url_for('static', filename='js/archive/rarvm.js') }}"></script>
|
|
||||||
<script src="{{ url_for('static', filename='js/archive/unrar5.js') }}"></script>
|
|
||||||
<script src="{{ url_for('static', filename='js/kthoom.js') }}"></script>
|
<script src="{{ url_for('static', filename='js/kthoom.js') }}"></script>
|
||||||
|
<script src="{{ url_for('static', filename='js/archive/archive.js') }}"></script>
|
||||||
<script>
|
<script>
|
||||||
var updateArrows = function() {
|
var updateArrows = function() {
|
||||||
if ($('input[name="direction"]:checked').val() === "0") {
|
if ($('input[name="direction"]:checked').val() === "0") {
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
<!-- EPUBJS Renderer -->
|
<!-- EPUBJS Renderer -->
|
||||||
<!--<script src="../build/epub.js"></script>-->
|
<!--<script src="../build/epub.js"></script>-->
|
||||||
<script src="{{ url_for('static', filename='js/libs/jquery.min.js') }}"></script>
|
<script src="{{ url_for('static', filename='js/libs/jquery.min.js') }}"></script>
|
||||||
|
<script src="{{ url_for('static', filename='js/libs/plugins.js') }}"></script>
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
|
|
||||||
|
@ -97,6 +98,14 @@
|
||||||
$( "#right" ).click(function() {
|
$( "#right" ).click(function() {
|
||||||
nextPage();
|
nextPage();
|
||||||
});
|
});
|
||||||
|
$("#readmain").swipe( {
|
||||||
|
swipeRight:function() {
|
||||||
|
prevPage();
|
||||||
|
},
|
||||||
|
swipeLeft:function() {
|
||||||
|
nextPage();
|
||||||
|
},
|
||||||
|
});
|
||||||
//bind mouse
|
//bind mouse
|
||||||
$(window).bind('DOMMouseScroll mousewheel', function(event) {
|
$(window).bind('DOMMouseScroll mousewheel', function(event) {
|
||||||
var delta = 0;
|
var delta = 0;
|
||||||
|
|
15
cps/web.py
15
cps/web.py
|
@ -1198,7 +1198,7 @@ def serve_book(book_id, book_format, anyname):
|
||||||
book = calibre_db.get_book(book_id)
|
book = calibre_db.get_book(book_id)
|
||||||
data = calibre_db.get_book_format(book_id, book_format.upper())
|
data = calibre_db.get_book_format(book_id, book_format.upper())
|
||||||
if not data:
|
if not data:
|
||||||
abort(404)
|
return "File not in Database"
|
||||||
log.info('Serving book: %s', data.name)
|
log.info('Serving book: %s', data.name)
|
||||||
if config.config_use_google_drive:
|
if config.config_use_google_drive:
|
||||||
headers = Headers()
|
headers = Headers()
|
||||||
|
@ -1207,11 +1207,14 @@ def serve_book(book_id, book_format, anyname):
|
||||||
return do_gdrive_download(df, headers, (book_format.upper() == 'TXT'))
|
return do_gdrive_download(df, headers, (book_format.upper() == 'TXT'))
|
||||||
else:
|
else:
|
||||||
if book_format.upper() == 'TXT':
|
if book_format.upper() == 'TXT':
|
||||||
rawdata = open(os.path.join(config.config_calibre_dir, book.path, data.name + "." + book_format),
|
try:
|
||||||
"rb").read()
|
rawdata = open(os.path.join(config.config_calibre_dir, book.path, data.name + "." + book_format),
|
||||||
result = chardet.detect(rawdata)
|
"rb").read()
|
||||||
return make_response(
|
result = chardet.detect(rawdata)
|
||||||
rawdata.decode(result['encoding']).encode('utf-8'))
|
return make_response(
|
||||||
|
rawdata.decode(result['encoding']).encode('utf-8'))
|
||||||
|
except FileNotFoundError:
|
||||||
|
return "File Not Found"
|
||||||
return send_from_directory(os.path.join(config.config_calibre_dir, book.path), data.name + "." + book_format)
|
return send_from_directory(os.path.join(config.config_calibre_dir, book.path), data.name + "." + book_format)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user