Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Donald Haase
Web-Comic-Reader
Commits
2d672356
Commit
2d672356
authored
Oct 22, 2019
by
Afif Zafri
Browse files
added checking if files are selected
parent
28b71061
Changes
1
Hide whitespace changes
Inline
Side-by-side
assets/js/script.js
View file @
2d672356
...
...
@@ -7,61 +7,65 @@ $(document).ready(function(){
loadArchiveFormats
([
'
rar
'
,
'
zip
'
,
'
tar
'
]);
$
(
"
#fileup
"
).
change
(
function
(){
$
(
'
#output
'
).
hide
();
// init the gallery plugin, when there is a first click on a image
// re-bind this function when opening new comic
$
(
document
).
one
(
'
click
'
,
'
#comicImg
'
,
function
(){
event
.
preventDefault
();
// initialize gallery
$
(
'
#output
'
).
lightGallery
({
selector
:
'
a
'
,
zoom
:
true
,
fullScreen
:
true
,
download
:
false
,
enableTouch
:
true
,
});
$
(
this
).
click
();
});
// Update progress text
$
(
'
.progress-text
'
).
html
(
"
Reading 0/0 pages
"
);
// show loading
$
(
'
.se-pre-con
'
).
fadeIn
(
'
slow
'
);
// destroy lightGallery
var
$lg
=
$
(
'
#output
'
);
$lg
.
lightGallery
();
$lg
.
data
(
'
lightGallery
'
).
destroy
(
true
);
// clear previous blobs
clearBlobs
();
// clear previous output data
$
(
'
#output
'
).
empty
();
var
file
=
$
(
this
)[
0
].
files
[
0
];
// Open the file as an archive
archiveOpenFile
(
file
,
function
(
archive
,
err
)
{
if
(
archive
)
{
$
(
'
#output
'
).
append
(
"
<b>
"
+
archive
.
file_name
+
"
</b><br><i>Click on the image to enlarge</i><br><br>
"
);
readContents
(
archive
);
}
else
{
$
(
'
#output
'
).
append
(
"
<font color='red'>
"
+
err
+
"
</font><br>
"
);
// hide loading
$
(
'
.se-pre-con
'
).
fadeOut
(
'
slow
'
);
// show output box
$
(
'
#output
'
).
fadeIn
(
'
slow
'
);
}
});
if
(
$
(
this
)[
0
].
files
.
length
==
0
)
{
$
(
'
#output
'
).
html
(
"
<font color='red'>Please choose a comic file</font><br>
"
);
}
else
{
$
(
'
#output
'
).
hide
();
// init the gallery plugin, when there is a first click on a image
// re-bind this function when opening new comic
$
(
document
).
one
(
'
click
'
,
'
#comicImg
'
,
function
(){
event
.
preventDefault
();
// initialize gallery
$
(
'
#output
'
).
lightGallery
({
selector
:
'
a
'
,
zoom
:
true
,
fullScreen
:
true
,
download
:
false
,
enableTouch
:
true
,
});
$
(
this
).
click
();
});
// Update progress text
$
(
'
.progress-text
'
).
html
(
"
Reading 0/0 pages
"
);
// show loading
$
(
'
.se-pre-con
'
).
fadeIn
(
'
slow
'
);
// destroy lightGallery
var
$lg
=
$
(
'
#output
'
);
$lg
.
lightGallery
();
$lg
.
data
(
'
lightGallery
'
).
destroy
(
true
);
// clear previous blobs
clearBlobs
();
// clear previous output data
$
(
'
#output
'
).
empty
();
var
file
=
$
(
this
)[
0
].
files
[
0
];
// Open the file as an archive
archiveOpenFile
(
file
,
function
(
archive
,
err
)
{
if
(
archive
)
{
$
(
'
#output
'
).
append
(
"
<b>
"
+
archive
.
file_name
+
"
</b><br><i>Click on the image to enlarge</i><br><br>
"
);
readContents
(
archive
);
}
else
{
$
(
'
#output
'
).
append
(
"
<font color='red'>
"
+
err
+
"
</font><br>
"
);
// hide loading
$
(
'
.se-pre-con
'
).
fadeOut
(
'
slow
'
);
// show output box
$
(
'
#output
'
).
fadeIn
(
'
slow
'
);
}
});
}
});
// function for reading the contents of the archive
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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