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
Hide 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
()
{
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
scripts
=
document
.
getElementsByTagName
(
'script'
);
...
...
@@ -12,15 +12,11 @@ $( function () {
}
}
)();
$login_btn
=
$
.
kmuibutton
(
{
text
:
'登录'
}
).
click
(
function
()
{
if
(
!
currentUser
)
{
login
();
}
}
).
appendTo
(
$panel
);
$login_btn
=
$
(
'<button>登录</button>'
).
addClass
(
'login'
).
click
(
login
);
$user_btn
=
$
(
'<button></button>'
).
addClass
(
'user-file'
);
var
$
menu
=
$
.
kmuidropmenu
(
{
$user_
menu
=
$
.
kmuidropmenu
(
{
data
:
[
{
label
:
'新建脑图'
,
value
:
'action_newminder'
...
...
@@ -30,22 +26,9 @@ $( function () {
label
:
'最近脑图'
,
value
:
'action_recent'
}
]
}
).
appendTo
(
'body'
).
kmui
().
attachTo
(
$
login
_btn
);
}
).
appendTo
(
'body'
).
kmui
().
attachTo
(
$
user
_btn
);
var
thisMapFilename
;
$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'
);
$save_btn
=
$
(
'<button>保存</button>'
).
click
(
saveThisFile
).
addClass
(
'baidu-cloud'
);
$share_btn
=
$
(
'<button>分享</button>'
).
click
(
function
()
{
if
(
$share_btn
.
attr
(
'disabled'
)
)
{
...
...
@@ -90,19 +73,23 @@ $( function () {
}
).
addClass
(
'share'
);
baidu
.
frontia
.
init
(
'wiE55BGOG8BkGnpPs6UNtPbb'
);
var
currentUser
=
baidu
.
frontia
.
getCurrentAccount
();
if
(
currentUser
)
{
setLogined
(
currentUser
);
}
var
AK
,
thisMapFilename
,
currentUser
;
AK
=
'wiE55BGOG8BkGnpPs6UNtPbb'
;
baidu
.
frontia
.
init
(
AK
);
baidu
.
frontia
.
social
.
setLoginCallback
(
{
success
:
set
Logined
,
success
:
set
CurrentUser
,
error
:
function
(
error
)
{
console
.
log
(
error
);
}
}
);
currentUser
=
baidu
.
frontia
.
getCurrentAccount
();
if
(
currentUser
)
{
setCurrentUser
(
currentUser
);
}
function
login
()
{
var
options
=
{
response_type
:
'token'
,
...
...
@@ -113,11 +100,13 @@ $( function () {
baidu
.
frontia
.
social
.
login
(
options
);
}
function
set
Logined
(
user
)
{
function
set
CurrentUser
(
user
)
{
currentUser
=
user
;
$login_btn
.
text
(
user
.
getName
()
+
' 的文件'
);
$user_btn
.
text
(
user
.
getName
()
+
' 的脑图'
);
$user_btn
.
appendTo
(
$panel
);
$save_btn
.
appendTo
(
$panel
);
$share_btn
.
appendTo
(
$panel
);
$login_btn
.
detach
();
loadRecent
();
loadAvator
();
window
.
location
.
hash
=
''
;
...
...
@@ -131,7 +120,7 @@ $( function () {
'width'
:
16
,
'height'
:
16
}
);
$img
.
prependTo
(
$
login
_btn
);
$img
.
prependTo
(
$
user
_btn
);
}
}
);
}
...
...
@@ -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
)
{
var
sto
=
baidu
.
frontia
.
personalStorage
;
var
options
=
{
...
...
@@ -208,9 +211,12 @@ $( function () {
var
shareId
=
match
[
1
];
var
query
=
new
baidu
.
frontia
.
storage
.
Query
();
query
.
on
(
'shareMinder.id'
).
equal
(
shareId
);
$share_btn
.
attr
(
'disabled'
,
'disabled'
).
text
(
'正在加载分享内容...'
);
baidu
.
frontia
.
storage
.
findData
(
query
,
{
success
:
function
(
ret
)
{
window
.
km
.
importData
(
ret
.
result
[
0
].
obj
.
shareMinder
.
data
,
'json'
);
$share_btn
.
removeAttr
(
'disabled'
).
text
(
'分享'
);
},
error
:
function
(
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