Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
solo
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
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
Hide 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 @@
...
@@ -18,7 +18,7 @@
*
*
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @author <a href="http://88250.b3log.org">Liang Ding</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
=
{
admin
.
article
=
{
currentEditorType
:
''
,
currentEditorType
:
''
,
...
@@ -472,23 +472,34 @@ admin.article = {
...
@@ -472,23 +472,34 @@ admin.article = {
// upload
// upload
var
qiniu
=
window
.
qiniu
;
var
qiniu
=
window
.
qiniu
;
var
filename
=
""
;
$
(
'
#articleUpload
'
).
fileupload
({
$
(
'
#articleUpload
'
).
fileupload
({
multipart
:
true
,
multipart
:
true
,
url
:
"
http://upload.qiniu.com/
"
,
url
:
"
http://upload.qiniu.com/
"
,
add
:
function
(
e
,
data
)
{
filename
=
data
.
files
[
0
].
name
;
data
.
submit
();
},
formData
:
function
(
form
)
{
formData
:
function
(
form
)
{
var
data
=
form
.
serializeArray
();
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
});
data
.
push
({
name
:
'
token
'
,
value
:
qiniu
.
qiniuUploadToken
});
return
data
;
return
data
;
},
},
done
:
function
(
e
,
data
)
{
done
:
function
(
e
,
data
)
{
var
qiniuKey
=
data
.
result
.
key
;
var
qiniuKey
=
data
.
result
.
key
;
if
(
!
qiniuKey
)
{
if
(
!
qiniuKey
)
{
alert
(
"
Upload error
"
);
alert
(
"
Upload error
"
);
return
;
return
;
}
}
$
(
'
#articleUpload
'
).
after
(
'
<div id="uploadContent">
<a target="_blank" href="http://
'
+
qiniu
.
qiniuDomain
+
qiniuKey
+
'
">[
'
+
data
.
files
[
0
].
name
+
'
]</a>
http://
'
$
(
'
#articleUpload
'
).
after
(
'
<div id="uploadContent">
!<a target="_blank" href="http://
'
+
qiniu
.
qiniuDomain
+
qiniuKey
+
'
">[
'
+
filename
+
'
]</a>(
http://
'
+
qiniu
.
qiniuDomain
+
qiniuKey
+
'
</div>
'
);
+
qiniu
.
qiniuDomain
+
qiniuKey
+
'
)
</div>
'
);
},
},
fail
:
function
(
e
,
data
)
{
fail
:
function
(
e
,
data
)
{
alert
(
"
Upload error:
"
+
data
.
errorThrown
);
alert
(
"
Upload error:
"
+
data
.
errorThrown
);
...
@@ -679,4 +690,18 @@ admin.register.article = {
...
@@ -679,4 +690,18 @@ admin.register.article = {
$
(
"
#loadMsg
"
).
text
(
""
);
$
(
"
#loadMsg
"
).
text
(
""
);
$
(
"
#tipMsg
"
).
text
(
""
);
$
(
"
#tipMsg
"
).
text
(
""
);
}
}
};
};
\ No newline at end of file
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