Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
douban-api-proxy
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
captainwong
douban-api-proxy
Commits
d2ad78eb
Commit
d2ad78eb
authored
Jan 24, 2021
by
Ozzie Isaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added swipe support for comic reader and txt reader (#925)
Bugfix for txt file not present on serving file
parent
0b32738f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
12 deletions
+28
-12
kthoom.js
cps/static/js/kthoom.js
+8
-0
readcbr.html
cps/templates/readcbr.html
+2
-6
readtxt.html
cps/templates/readtxt.html
+9
-0
web.py
cps/web.py
+9
-6
No files found.
cps/static/js/kthoom.js
View file @
d2ad78eb
...
...
@@ -635,6 +635,14 @@ function init(filename) {
// Focus the scrollable area so that keyboard scrolling work as expected
$
(
"#mainContent"
).
focus
();
$
(
"#mainContent"
).
swipe
(
{
swipeRight
:
function
()
{
showLeftPage
();
},
swipeLeft
:
function
()
{
showRightPage
();
},
});
$
(
"#mainImage"
).
click
(
function
(
evt
)
{
// Firefox does not support offsetX/Y so we have to manually calculate
// where the user clicked in the image.
...
...
cps/templates/readcbr.html
View file @
d2ad78eb
...
...
@@ -13,14 +13,10 @@
<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/plugins.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/archive/archive.js') }}"
></script>
<script>
var
updateArrows
=
function
()
{
if
(
$
(
'input[name="direction"]:checked'
).
val
()
===
"0"
)
{
...
...
cps/templates/readtxt.html
View file @
d2ad78eb
...
...
@@ -12,6 +12,7 @@
<!-- EPUBJS Renderer -->
<!--<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/plugins.js') }}"
></script>
<style
type=
"text/css"
>
...
...
@@ -97,6 +98,14 @@
$
(
"#right"
).
click
(
function
()
{
nextPage
();
});
$
(
"#readmain"
).
swipe
(
{
swipeRight
:
function
()
{
prevPage
();
},
swipeLeft
:
function
()
{
nextPage
();
},
});
//bind mouse
$
(
window
).
bind
(
'DOMMouseScroll mousewheel'
,
function
(
event
)
{
var
delta
=
0
;
...
...
cps/web.py
View file @
d2ad78eb
...
...
@@ -1198,7 +1198,7 @@ def serve_book(book_id, book_format, anyname):
book
=
calibre_db
.
get_book
(
book_id
)
data
=
calibre_db
.
get_book_format
(
book_id
,
book_format
.
upper
())
if
not
data
:
abort
(
404
)
return
"File not in Database"
log
.
info
(
'Serving book:
%
s'
,
data
.
name
)
if
config
.
config_use_google_drive
:
headers
=
Headers
()
...
...
@@ -1207,11 +1207,14 @@ def serve_book(book_id, book_format, anyname):
return
do_gdrive_download
(
df
,
headers
,
(
book_format
.
upper
()
==
'TXT'
))
else
:
if
book_format
.
upper
()
==
'TXT'
:
rawdata
=
open
(
os
.
path
.
join
(
config
.
config_calibre_dir
,
book
.
path
,
data
.
name
+
"."
+
book_format
),
"rb"
)
.
read
()
result
=
chardet
.
detect
(
rawdata
)
return
make_response
(
rawdata
.
decode
(
result
[
'encoding'
])
.
encode
(
'utf-8'
))
try
:
rawdata
=
open
(
os
.
path
.
join
(
config
.
config_calibre_dir
,
book
.
path
,
data
.
name
+
"."
+
book_format
),
"rb"
)
.
read
()
result
=
chardet
.
detect
(
rawdata
)
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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment