Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yoho-blk
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
1
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
yyq
9 years ago
Commit
898626c11b090ba6316e772baea7f2f44c5cb298
1 parent
2528f5cb
upload
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
7 deletions
public/js/plugins/upload.js
public/js/plugins/upload.js
View file @
898626c
...
...
@@ -16,6 +16,8 @@ var $result,
$upload
,
$filename
;
var
uping
;
var
num
,
inter
,
callback
;
...
...
@@ -27,8 +29,12 @@ $upload = $('#yoho-upload');
$filename
=
$upload
.
find
(
'.file-name'
);
function
up
(
opt
)
{
if
(
uping
)
{
return
;
}
$filename
.
click
();
if
(
opt
)
{
if
(
opt
&&
typeof
opt
.
callback
===
'function'
)
{
callback
=
opt
.
callback
;
}
else
{
callback
=
''
;
...
...
@@ -40,22 +46,24 @@ function getResponse(cb) {
inter
=
setInterval
(
function
()
{
var
res
=
$result
[
0
].
contentDocument
.
body
.
innerText
||
''
;
if
(
num
>
20
||
res
)
{
uping
=
false
;
clearInterval
(
inter
);
}
num
++
;
if
(
res
)
{
$result
[
0
].
contentDocument
.
body
.
innerText
=
''
;
if
(
cb
)
{
return
cb
(
$
.
parseJSON
(
res
));
}
}
if
(
num
>
20
||
res
)
{
clearInterval
(
inter
);
}
num
++
;
},
500
);
}
$filename
.
change
(
function
()
{
uping
=
true
;
$upload
.
submit
();
getResponse
(
callback
);
});
...
...
Please
register
or
login
to post a comment