Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
solo-1
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Administrator
solo-1
Commits
92643a83
Commit
92643a83
authored
Jan 27, 2016
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #12079
parent
6041e435
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
5 deletions
+30
-5
src/main/webapp/js/admin/article.js
src/main/webapp/js/admin/article.js
+30
-5
No files found.
src/main/webapp/js/admin/article.js
View file @
92643a83
...
...
@@ -18,7 +18,7 @@
*
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.
2.4.4, Jan
7, 2016
* @version 1.
3.4.4, Jan 2
7, 2016
*/
admin
.
article
=
{
currentEditorType
:
''
,
...
...
@@ -472,23 +472,34 @@ admin.article = {
// upload
var
qiniu
=
window
.
qiniu
;
var
filename
=
""
;
$
(
'
#articleUpload
'
).
fileupload
({
multipart
:
true
,
url
:
"
http://upload.qiniu.com/
"
,
add
:
function
(
e
,
data
)
{
filename
=
data
.
files
[
0
].
name
;
data
.
submit
();
},
formData
:
function
(
form
)
{
var
data
=
form
.
serializeArray
();
var
ext
=
filename
.
substring
(
filename
.
lastIndexOf
(
"
.
"
)
+
1
);
data
.
push
({
name
:
'
key
'
,
value
:
getUUID
()
+
"
.
"
+
ext
});
data
.
push
({
name
:
'
token
'
,
value
:
qiniu
.
qiniuUploadToken
});
return
data
;
},
done
:
function
(
e
,
data
)
{
var
qiniuKey
=
data
.
result
.
key
;
if
(
!
qiniuKey
)
{
alert
(
"
Upload error
"
);
return
;
}
$
(
'
#articleUpload
'
).
after
(
'
<div id="uploadContent">
<a target="_blank" href="http://
'
+
qiniu
.
qiniuDomain
+
qiniuKey
+
'
">[
'
+
data
.
files
[
0
].
name
+
'
]</a>
http://
'
+
qiniu
.
qiniuDomain
+
qiniuKey
+
'
</div>
'
);
$
(
'
#articleUpload
'
).
after
(
'
<div id="uploadContent">
!<a target="_blank" href="http://
'
+
qiniu
.
qiniuDomain
+
qiniuKey
+
'
">[
'
+
filename
+
'
]</a>(
http://
'
+
qiniu
.
qiniuDomain
+
qiniuKey
+
'
)
</div>
'
);
},
fail
:
function
(
e
,
data
)
{
alert
(
"
Upload error:
"
+
data
.
errorThrown
);
...
...
@@ -680,3 +691,17 @@ admin.register.article = {
$
(
"
#tipMsg
"
).
text
(
""
);
}
};
function
getUUID
()
{
var
d
=
new
Date
().
getTime
();
var
ret
=
'
xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx
'
.
replace
(
/
[
xy
]
/g
,
function
(
c
)
{
var
r
=
(
d
+
Math
.
random
()
*
16
)
%
16
|
0
;
d
=
Math
.
floor
(
d
/
16
);
return
(
c
==
'
x
'
?
r
:
(
r
&
0x3
|
0x8
)).
toString
(
16
);
});
ret
=
ret
.
replace
(
new
RegExp
(
"
-
"
,
'
g
'
),
""
);
return
ret
;
};
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