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
c2bfb297
Commit
c2bfb297
authored
Apr 21, 2019
by
subdiox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add reading direction settings to readcbr page
parent
204de4ae
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
61 additions
and
21 deletions
+61
-21
kthoom.css
cps/static/css/kthoom.css
+2
-2
kthoom.js
cps/static/js/kthoom.js
+30
-13
readcbr.html
cps/templates/readcbr.html
+29
-6
No files found.
cps/static/css/kthoom.css
View file @
c2bfb297
...
...
@@ -152,11 +152,11 @@ body {
max-width
:
70%
;
}
#
prev
{
#
left
{
left
:
40px
;
}
#
nex
t
{
#
righ
t
{
right
:
40px
;
}
...
...
cps/static/js/kthoom.js
View file @
c2bfb297
...
...
@@ -66,7 +66,8 @@ var settings = {
vflip
:
false
,
rotateTimes
:
0
,
fitMode
:
kthoom
.
Key
.
B
,
theme
:
"light"
theme
:
"light"
,
direction
:
0
// 0 = Left to Right, 1 = Right to Left
};
kthoom
.
saveSettings
=
function
()
{
...
...
@@ -367,6 +368,22 @@ function setImage(url) {
}
}
function
showLeftPage
()
{
if
(
settings
.
direction
===
0
)
{
showPrevPage
()
}
else
{
showNextPage
()
}
}
function
showRightPage
()
{
if
(
settings
.
direction
===
0
)
{
showNextPage
()
}
else
{
showPrevPage
()
}
}
function
showPrevPage
()
{
currentImage
--
;
if
(
currentImage
<
0
)
{
...
...
@@ -421,11 +438,11 @@ function keyHandler(evt) {
switch
(
evt
.
keyCode
)
{
case
kthoom
.
Key
.
LEFT
:
if
(
hasModifier
)
break
;
show
Prev
Page
();
show
Left
Page
();
break
;
case
kthoom
.
Key
.
RIGHT
:
if
(
hasModifier
)
break
;
show
Nex
tPage
();
show
Righ
tPage
();
break
;
case
kthoom
.
Key
.
L
:
if
(
hasModifier
)
break
;
...
...
@@ -486,11 +503,11 @@ function keyHandler(evt) {
if
(
evt
.
shiftKey
&&
atTop
)
{
evt
.
preventDefault
();
// If it's Shift + Space and the container is at the top of the page
show
Prev
Page
();
show
Left
Page
();
}
else
if
(
!
evt
.
shiftKey
&&
atBottom
)
{
evt
.
preventDefault
();
// If you're at the bottom of the page and you only pressed space
show
Nex
tPage
();
show
Righ
tPage
();
container
.
scrollTop
(
0
);
}
break
;
...
...
@@ -621,25 +638,25 @@ function init(filename) {
// Determine if the user clicked/tapped the left side or the
// right side of the page.
var
clicked
Prev
=
false
;
var
clicked
Left
=
false
;
switch
(
settings
.
rotateTimes
)
{
case
0
:
clicked
Prev
=
clickX
<
(
comicWidth
/
2
);
clicked
Left
=
clickX
<
(
comicWidth
/
2
);
break
;
case
1
:
clicked
Prev
=
clickY
<
(
comicHeight
/
2
);
clicked
Left
=
clickY
<
(
comicHeight
/
2
);
break
;
case
2
:
clicked
Prev
=
clickX
>
(
comicWidth
/
2
);
clicked
Left
=
clickX
>
(
comicWidth
/
2
);
break
;
case
3
:
clicked
Prev
=
clickY
>
(
comicHeight
/
2
);
clicked
Left
=
clickY
>
(
comicHeight
/
2
);
break
;
}
if
(
clicked
Prev
)
{
show
Prev
Page
();
if
(
clicked
Left
)
{
show
Left
Page
();
}
else
{
show
Nex
tPage
();
show
Righ
tPage
();
}
});
}
...
...
cps/templates/readcbr.html
View file @
c2bfb297
...
...
@@ -17,9 +17,19 @@
<script
src=
"{{ url_for('static', filename='js/kthoom.js') }}"
></script>
<script
src=
"{{ url_for('static', filename='js/archive.js') }}"
></script>
<script>
var
updateArrows
=
function
()
{
if
(
$
(
'input[name="direction"]:checked'
).
val
()
===
"0"
)
{
$
(
"#prev_page_key"
).
html
(
"←"
);
$
(
"#next_page_key"
).
html
(
"→"
);
}
else
{
$
(
"#prev_page_key"
).
html
(
"→"
);
$
(
"#next_page_key"
).
html
(
"←"
);
}
};
document
.
onreadystatechange
=
function
()
{
if
(
document
.
readyState
==
"complete"
)
{
init
(
"{{ url_for('serve_book', book_id=comicfile, book_format=extension) }}"
);
init
(
"{{ url_for('serve_book', book_id=comicfile, book_format=extension) }}"
);
updateArrows
();
}
};
</script>
...
...
@@ -70,8 +80,8 @@
<div
id=
"mainText"
style=
"display:none"
></div>
<canvas
id=
"mainImage"
></canvas>
</div>
<div
id=
"
prev"
class=
"arrow"
onclick=
"showPrev
Page()"
>
‹
</div>
<div
id=
"
next"
class=
"arrow"
onclick=
"showNex
tPage()"
>
›
</div>
<div
id=
"
left"
class=
"arrow"
onclick=
"showLeft
Page()"
>
‹
</div>
<div
id=
"
right"
class=
"arrow"
onclick=
"showRigh
tPage()"
>
›
</div>
</div>
<div
class=
"modal md-effect-1"
id=
"settings-modal"
>
...
...
@@ -84,8 +94,8 @@
<tr><th
colspan=
"2"
>
{{_('Keyboard Shortcuts')}}
</th></tr>
</thead>
<tbody>
<tr><td>
←
</td>
<td>
{{_('Previous Page')}}
</td></tr>
<tr><td>
→
</td>
<td>
{{_('Next Page')}}
</td></tr>
<tr><td
id=
"prev_page_key"
>
←
</td>
<td>
{{_('Previous Page')}}
</td></tr>
<tr><td
id=
"next_page_key"
>
→
</td>
<td>
{{_('Next Page')}}
</td></tr>
<tr><td>
B
</td>
<td>
{{_('Scale to Best')}}
</td></tr>
<tr><td>
W
</td>
<td>
{{_('Scale to Width')}}
</td></tr>
<tr><td>
H
</td>
<td>
{{_('Scale to Height')}}
</td></tr>
...
...
@@ -144,6 +154,15 @@
</div>
</td>
</tr>
<tr>
<th>
{{_('Direction')}}:
</th>
<td>
<div
class=
"inputs"
>
<label
for=
"leftToRight"
><input
type=
"radio"
id=
"leftToRight"
name=
"direction"
value=
"0"
/>
{{_('Left to Right')}}
</label>
<label
for=
"rightToLeft"
><input
type=
"radio"
id=
"rightToLeft"
name=
"direction"
value=
"1"
/>
{{_('Right to Left')}}
</label>
</div>
</td>
</tr>
</tbody>
</table>
</div>
...
...
@@ -152,6 +171,10 @@
</div>
</div>
<div
class=
"overlay"
></div>
<script>
$
(
'input[name="direction"]'
).
change
(
function
()
{
updateArrows
();
});
</script>
</body>
</html>
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