Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kityminder-core
Project
Project
Details
Activity
Releases
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
吴志俊
kityminder-core
Commits
378f9bf1
Commit
378f9bf1
authored
Feb 26, 2014
by
techird
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
UI整理
parent
044ec7b0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
33 deletions
+39
-33
social.js
dist/social.js
+39
-33
No files found.
dist/social.js
View file @
378f9bf1
$
(
function
()
{
$
(
function
()
{
var
$panel
=
$
(
'#social'
);
var
$panel
=
$
(
'#social'
);
var
$login_btn
,
$save_btn
,
$share_btn
,
$user_btn
;
var
$login_btn
,
$save_btn
,
$share_btn
,
$user_btn
,
$user_menu
;
var
baseUrl
=
(
function
()
{
var
baseUrl
=
(
function
()
{
var
scripts
=
document
.
getElementsByTagName
(
'script'
);
var
scripts
=
document
.
getElementsByTagName
(
'script'
);
...
@@ -12,15 +12,11 @@ $( function () {
...
@@ -12,15 +12,11 @@ $( function () {
}
}
}
)();
}
)();
$login_btn
=
$
.
kmuibutton
(
{
$login_btn
=
$
(
'<button>登录</button>'
).
addClass
(
'login'
).
click
(
login
);
text
:
'登录'
}
).
click
(
function
()
{
$user_btn
=
$
(
'<button></button>'
).
addClass
(
'user-file'
);
if
(
!
currentUser
)
{
login
();
}
}
).
appendTo
(
$panel
);
var
$
menu
=
$
.
kmuidropmenu
(
{
$user_
menu
=
$
.
kmuidropmenu
(
{
data
:
[
{
data
:
[
{
label
:
'新建脑图'
,
label
:
'新建脑图'
,
value
:
'action_newminder'
value
:
'action_newminder'
...
@@ -30,22 +26,9 @@ $( function () {
...
@@ -30,22 +26,9 @@ $( function () {
label
:
'最近脑图'
,
label
:
'最近脑图'
,
value
:
'action_recent'
value
:
'action_recent'
}
]
}
]
}
).
appendTo
(
'body'
).
kmui
().
attachTo
(
$
login
_btn
);
}
).
appendTo
(
'body'
).
kmui
().
attachTo
(
$
user
_btn
);
var
thisMapFilename
;
$save_btn
=
$
(
'<button>保存</button>'
).
click
(
saveThisFile
).
addClass
(
'baidu-cloud'
);
$save_btn
=
$
(
'<button>保存</button>'
).
click
(
function
()
{
var
data
=
window
.
km
.
exportData
(
'json'
);
save
(
data
,
'apps/kityminder/mymind.km'
,
function
(
success
,
info
)
{
if
(
success
)
{
$save_btn
.
text
(
'保存成功!'
);
setTimeout
(
function
()
{
$save_btn
.
removeAttr
(
'disabled'
).
text
(
'保存'
);
},
3000
);
}
console
.
log
(
info
);
}
);
$save_btn
.
attr
(
'disabled'
,
'disabled'
).
text
(
'正在保存...'
);
}
).
addClass
(
'baidu-cloud'
);
$share_btn
=
$
(
'<button>分享</button>'
).
click
(
function
()
{
$share_btn
=
$
(
'<button>分享</button>'
).
click
(
function
()
{
if
(
$share_btn
.
attr
(
'disabled'
)
)
{
if
(
$share_btn
.
attr
(
'disabled'
)
)
{
...
@@ -90,19 +73,23 @@ $( function () {
...
@@ -90,19 +73,23 @@ $( function () {
}
).
addClass
(
'share'
);
}
).
addClass
(
'share'
);
baidu
.
frontia
.
init
(
'wiE55BGOG8BkGnpPs6UNtPbb'
);
var
AK
,
thisMapFilename
,
currentUser
;
var
currentUser
=
baidu
.
frontia
.
getCurrentAccount
();
if
(
currentUser
)
{
setLogined
(
currentUser
);
}
AK
=
'wiE55BGOG8BkGnpPs6UNtPbb'
;
baidu
.
frontia
.
init
(
AK
);
baidu
.
frontia
.
social
.
setLoginCallback
(
{
baidu
.
frontia
.
social
.
setLoginCallback
(
{
success
:
set
Logined
,
success
:
set
CurrentUser
,
error
:
function
(
error
)
{
error
:
function
(
error
)
{
console
.
log
(
error
);
console
.
log
(
error
);
}
}
}
);
}
);
currentUser
=
baidu
.
frontia
.
getCurrentAccount
();
if
(
currentUser
)
{
setCurrentUser
(
currentUser
);
}
function
login
()
{
function
login
()
{
var
options
=
{
var
options
=
{
response_type
:
'token'
,
response_type
:
'token'
,
...
@@ -113,11 +100,13 @@ $( function () {
...
@@ -113,11 +100,13 @@ $( function () {
baidu
.
frontia
.
social
.
login
(
options
);
baidu
.
frontia
.
social
.
login
(
options
);
}
}
function
set
Logined
(
user
)
{
function
set
CurrentUser
(
user
)
{
currentUser
=
user
;
currentUser
=
user
;
$login_btn
.
text
(
user
.
getName
()
+
' 的文件'
);
$user_btn
.
text
(
user
.
getName
()
+
' 的脑图'
);
$user_btn
.
appendTo
(
$panel
);
$save_btn
.
appendTo
(
$panel
);
$save_btn
.
appendTo
(
$panel
);
$share_btn
.
appendTo
(
$panel
);
$share_btn
.
appendTo
(
$panel
);
$login_btn
.
detach
();
loadRecent
();
loadRecent
();
loadAvator
();
loadAvator
();
window
.
location
.
hash
=
''
;
window
.
location
.
hash
=
''
;
...
@@ -131,7 +120,7 @@ $( function () {
...
@@ -131,7 +120,7 @@ $( function () {
'width'
:
16
,
'width'
:
16
,
'height'
:
16
'height'
:
16
}
);
}
);
$img
.
prependTo
(
$
login
_btn
);
$img
.
prependTo
(
$
user
_btn
);
}
}
}
);
}
);
}
}
...
@@ -165,6 +154,20 @@ $( function () {
...
@@ -165,6 +154,20 @@ $( function () {
}
);
}
);
}
}
function
saveThisFile
()
{
var
data
=
window
.
km
.
exportData
(
'json'
);
save
(
data
,
thisMapFilename
,
function
(
success
,
info
)
{
if
(
success
)
{
$save_btn
.
text
(
'保存成功!'
);
setTimeout
(
function
()
{
$save_btn
.
removeAttr
(
'disabled'
).
text
(
'保存'
);
},
3000
);
}
console
.
log
(
info
);
}
);
$save_btn
.
attr
(
'disabled'
,
'disabled'
).
text
(
'正在保存...'
);
}
function
save
(
file
,
filename
,
callback
)
{
function
save
(
file
,
filename
,
callback
)
{
var
sto
=
baidu
.
frontia
.
personalStorage
;
var
sto
=
baidu
.
frontia
.
personalStorage
;
var
options
=
{
var
options
=
{
...
@@ -208,9 +211,12 @@ $( function () {
...
@@ -208,9 +211,12 @@ $( function () {
var
shareId
=
match
[
1
];
var
shareId
=
match
[
1
];
var
query
=
new
baidu
.
frontia
.
storage
.
Query
();
var
query
=
new
baidu
.
frontia
.
storage
.
Query
();
query
.
on
(
'shareMinder.id'
).
equal
(
shareId
);
query
.
on
(
'shareMinder.id'
).
equal
(
shareId
);
$share_btn
.
attr
(
'disabled'
,
'disabled'
).
text
(
'正在加载分享内容...'
);
baidu
.
frontia
.
storage
.
findData
(
query
,
{
baidu
.
frontia
.
storage
.
findData
(
query
,
{
success
:
function
(
ret
)
{
success
:
function
(
ret
)
{
window
.
km
.
importData
(
ret
.
result
[
0
].
obj
.
shareMinder
.
data
,
'json'
);
window
.
km
.
importData
(
ret
.
result
[
0
].
obj
.
shareMinder
.
data
,
'json'
);
$share_btn
.
removeAttr
(
'disabled'
).
text
(
'分享'
);
},
},
error
:
function
(
e
)
{
error
:
function
(
e
)
{
console
.
log
(
e
);
console
.
log
(
e
);
...
...
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