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
98fc1ee0
Commit
98fc1ee0
authored
May 22, 2021
by
Ozzie Isaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Comic reader code cleaning
parent
a62fca1e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
15 deletions
+5
-15
kthoom.js
cps/static/js/kthoom.js
+5
-15
No files found.
cps/static/js/kthoom.js
View file @
98fc1ee0
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
* Typed Arrays: http://www.khronos.org/registry/typedarray/specs/latest/#6
* Typed Arrays: http://www.khronos.org/registry/typedarray/specs/latest/#6
*/
*/
/* global screenfull, bitjs, Uint8Array, opera */
/* global screenfull, bitjs, Uint8Array, opera
, loadArchiveFormats, archiveOpenFile
*/
/* exported init, event */
/* exported init, event */
...
@@ -173,27 +173,23 @@ function initProgressClick() {
...
@@ -173,27 +173,23 @@ function initProgressClick() {
var
offset
=
$
(
this
).
offset
();
var
offset
=
$
(
this
).
offset
();
var
x
=
e
.
pageX
-
offset
.
left
;
var
x
=
e
.
pageX
-
offset
.
left
;
var
rate
=
settings
.
direction
===
0
?
x
/
$
(
this
).
width
()
:
1
-
x
/
$
(
this
).
width
();
var
rate
=
settings
.
direction
===
0
?
x
/
$
(
this
).
width
()
:
1
-
x
/
$
(
this
).
width
();
var
page
=
Math
.
max
(
1
,
Math
.
ceil
(
rate
*
totalImages
))
-
1
;
currentImage
=
Math
.
max
(
1
,
Math
.
ceil
(
rate
*
totalImages
))
-
1
;
currentImage
=
page
;
updatePage
();
updatePage
();
});
});
}
}
function
loadFromArrayBuffer
(
ab
)
{
function
loadFromArrayBuffer
(
ab
)
{
var
start
=
(
new
Date
).
getTime
();
var
h
=
new
Uint8Array
(
ab
,
0
,
10
);
var
pathToBitJS
=
"../../static/js/archive/"
;
var
lastCompletion
=
0
;
var
lastCompletion
=
0
;
loadArchiveFormats
([
'rar'
,
'zip'
,
'tar'
],
function
()
{
loadArchiveFormats
([
'rar'
,
'zip'
,
'tar'
],
function
()
{
// Open the file as an archive
// Open the file as an archive
archiveOpenFile
(
ab
,
function
(
archive
,
err
)
{
archiveOpenFile
(
ab
,
function
(
archive
)
{
if
(
archive
)
{
if
(
archive
)
{
totalImages
=
archive
.
entries
.
length
totalImages
=
archive
.
entries
.
length
console
.
info
(
'Uncompressing '
+
archive
.
archive_type
+
' ...'
);
console
.
info
(
'Uncompressing '
+
archive
.
archive_type
+
' ...'
);
archive
.
entries
.
forEach
(
function
(
e
,
i
)
{
archive
.
entries
.
forEach
(
function
(
e
,
i
)
{
updateProgress
(
(
i
+
1
)
/
totalImages
*
100
);
updateProgress
(
(
i
+
1
)
/
totalImages
*
100
);
if
(
e
.
is_file
)
{
if
(
e
.
is_file
)
{
var
f
=
e
.
readData
(
function
(
d
)
{
e
.
readData
(
function
(
d
)
{
// add any new pages based on the filename
// add any new pages based on the filename
if
(
imageFilenames
.
indexOf
(
e
.
name
)
===
-
1
)
{
if
(
imageFilenames
.
indexOf
(
e
.
name
)
===
-
1
)
{
let
data
=
{
filename
:
e
.
name
,
fileData
:
d
};
let
data
=
{
filename
:
e
.
name
,
fileData
:
d
};
...
@@ -523,10 +519,6 @@ function keyHandler(evt) {
...
@@ -523,10 +519,6 @@ function keyHandler(evt) {
updateScale
(
false
);
updateScale
(
false
);
break
;
break
;
case
kthoom
.
Key
.
SPACE
:
case
kthoom
.
Key
.
SPACE
:
var
container
=
$
(
"#mainContent"
);
// var atTop = container.scrollTop() === 0;
// var atBottom = container.scrollTop() >= container[0].scrollHeight - container.height();
if
(
evt
.
shiftKey
)
{
if
(
evt
.
shiftKey
)
{
evt
.
preventDefault
();
evt
.
preventDefault
();
// If it's Shift + Space and the container is at the top of the page
// If it's Shift + Space and the container is at the top of the page
...
@@ -547,9 +539,7 @@ function init(filename) {
...
@@ -547,9 +539,7 @@ function init(filename) {
var
request
=
new
XMLHttpRequest
();
var
request
=
new
XMLHttpRequest
();
request
.
open
(
"GET"
,
filename
);
request
.
open
(
"GET"
,
filename
);
request
.
responseType
=
"arraybuffer"
;
request
.
responseType
=
"arraybuffer"
;
request
.
setRequestHeader
(
"X-Test"
,
"test1"
);
request
.
addEventListener
(
"load"
,
function
()
{
request
.
setRequestHeader
(
"X-Test"
,
"test2"
);
request
.
addEventListener
(
"load"
,
function
(
event
)
{
if
(
request
.
status
>=
200
&&
request
.
status
<
300
)
{
if
(
request
.
status
>=
200
&&
request
.
status
<
300
)
{
loadFromArrayBuffer
(
request
.
response
);
loadFromArrayBuffer
(
request
.
response
);
}
else
{
}
else
{
...
...
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