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
c08ded2d
Commit
c08ded2d
authored
Feb 26, 2014
by
techird
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' into gh-pages
parents
e21f8788
4f8a98c8
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
326 additions
and
182 deletions
+326
-182
social.css
dist/social.css
+7
-5
social.js
dist/social.js
+176
-78
social.less
dist/social.less
+21
-1
minder.node.js
src/core/minder.node.js
+3
-1
minder.select.js
src/core/minder.select.js
+33
-0
dragtree.js
src/module/dragtree.js
+1
-30
dropmenu.js
src/ui/dropmenu.js
+72
-62
menu.js
src/ui/menu.js
+10
-3
dropmenu.css
themes/default/css/dropmenu.css
+3
-2
No files found.
dist/social.css
View file @
c08ded2d
#social
{
position
:
absolute
;
right
:
10px
;
top
:
10px
;
line-height
:
20px
;
text-align
:
right
;
overflow
:
hidden
}
#social
button
,
#social
.kmui-btn
{
outline
:
none
;
display
:
inline-block
;
padding
:
0
15px
;
height
:
35px
;
font-size
:
13px
;
line-height
:
35px
;
text-align
:
center
;
border-radius
:
5px
;
color
:
#fff
;
text-decoration
:
none
;
border
:
none
;
margin-left
:
5px
;
cursor
:
pointer
;
background
:
#0099f2
;
background
:
url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzAwOTlmMiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjAlIiBzdG9wLWNvbG9yPSIjNDA5NmVlIiBzdG9wLW9wYWNpdHk9IjEiLz4KICAgIDxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iIzAwNzZkZCIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgPC9saW5lYXJHcmFkaWVudD4KICA8cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIiBmaWxsPSJ1cmwoI2dyYWQtdWNnZy1nZW5lcmF0ZWQpIiAvPgo8L3N2Zz4=)
;
background
:
-moz-linear-gradient
(
top
,
#0099f2
0
,
#4096ee
0
,
#0076dd
100%
);
background
:
-webkit-gradient
(
linear
,
left
top
,
left
bottom
,
color-stop
(
0
,
#0099f2
),
color-stop
(
0
,
#4096ee
),
color-stop
(
100%
,
#0076dd
));
background
:
-webkit-linear-gradient
(
top
,
#0099f2
0
,
#4096ee
0
,
#0076dd
100%
);
background
:
-o-linear-gradient
(
top
,
#0099f2
0
,
#4096ee
0
,
#0076dd
100%
);
background
:
-ms-linear-gradient
(
top
,
#0099f2
0
,
#4096ee
0
,
#0076dd
100%
);
background
:
linear-gradient
(
to
bottom
,
#0099f2
0
,
#4096ee
0
,
#0076dd
100%
);
filter
:
progid
:
DXImageTransform
.
Microsoft
.
gradient
(
startColorstr
=
'#0099f2'
,
endColorstr
=
'#0076dd'
,
GradientType
=
0
);}
#social
button
:hover
,
#social
.kmui-btn
:hover
{
background
:
#009fff
}
#social
{
position
:
absolute
;
right
:
10px
;
top
:
10px
;
line-height
:
20px
;
text-align
:
right
;
overflow
:
hidden
}
#social
button
{
outline
:
none
;
display
:
inline-block
;
padding
:
0
15px
;
height
:
35px
;
font-size
:
13px
;
line-height
:
35px
;
text-align
:
center
;
border-radius
:
5px
;
color
:
#fff
;
text-decoration
:
none
;
border
:
none
;
margin-left
:
5px
;
cursor
:
pointer
;
background
:
#0099f2
;
background
:
url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzAwOTlmMiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjAlIiBzdG9wLWNvbG9yPSIjNDA5NmVlIiBzdG9wLW9wYWNpdHk9IjEiLz4KICAgIDxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iIzAwNzZkZCIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgPC9saW5lYXJHcmFkaWVudD4KICA8cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIiBmaWxsPSJ1cmwoI2dyYWQtdWNnZy1nZW5lcmF0ZWQpIiAvPgo8L3N2Zz4=)
;
background
:
-moz-linear-gradient
(
top
,
#0099f2
0
,
#4096ee
0
,
#0076dd
100%
);
background
:
-webkit-gradient
(
linear
,
left
top
,
left
bottom
,
color-stop
(
0
,
#0099f2
),
color-stop
(
0
,
#4096ee
),
color-stop
(
100%
,
#0076dd
));
background
:
-webkit-linear-gradient
(
top
,
#0099f2
0
,
#4096ee
0
,
#0076dd
100%
);
background
:
-o-linear-gradient
(
top
,
#0099f2
0
,
#4096ee
0
,
#0076dd
100%
);
background
:
-ms-linear-gradient
(
top
,
#0099f2
0
,
#4096ee
0
,
#0076dd
100%
);
background
:
linear-gradient
(
to
bottom
,
#0099f2
0
,
#4096ee
0
,
#0076dd
100%
);
filter
:
progid
:
DXImageTransform
.
Microsoft
.
gradient
(
startColorstr
=
'#0099f2'
,
endColorstr
=
'#0076dd'
,
GradientType
=
0
);}
#social
button
:hover
{
background
:
#009fff
}
#social
button
[
disabled
],
#social
.kmui-btn
[
disabled
]
{
background
:
#aaa
}
#social
button
[
disabled
]
{
background
:
#aaa
}
#social
button
.baidu-cloud
,
#social
.kmui-btn.baidu-cloud
{
padding-left
:
35px
;
position
:
relative
}
#social
button
.baidu-cloud
:before
,
#social
.kmui-btn.baidu-cloud
:before
{
content
:
' '
;
display
:
block
;
width
:
24px
;
height
:
24px
;
background
:
url(../themes/default/images/baiducloud.png)
;
position
:
absolute
;
left
:
7px
;
top
:
5px
}
#social
button
.baidu-cloud
{
padding-left
:
35px
;
position
:
relative
}
#social
button
.baidu-cloud
:before
{
content
:
' '
;
display
:
block
;
width
:
24px
;
height
:
24px
;
background
:
url(../themes/default/images/baiducloud.png)
;
position
:
absolute
;
left
:
7px
;
top
:
5px
}
#social
button
.share
,
#social
.kmui-btn.share
{
padding-left
:
35px
;
position
:
relative
}
#social
button
.share
:before
,
#social
.kmui-btn.share
:before
{
content
:
' '
;
display
:
block
;
width
:
24px
;
height
:
24px
;
background
:
url(../themes/default/images/share.png)
no-repeat
;
position
:
absolute
;
left
:
7px
;
top
:
5px
}
#social
button
.share
{
padding-left
:
35px
;
position
:
relative
}
#social
button
.share
:before
{
content
:
' '
;
display
:
block
;
width
:
24px
;
height
:
24px
;
background
:
url(../themes/default/images/share.png)
no-repeat
;
position
:
absolute
;
left
:
7px
;
top
:
5px
}
#social
button
img
,
#social
.kmui-btn
img
{
position
:
relative
;
top
:
3px
;
border-radius
:
2px
;
margin-right
:
7px
}
#social
button
img
{
position
:
relative
;
top
:
3px
;
border-radius
:
2px
;
margin-right
:
7px
}
#social
button
.user-file
{
padding-right
:
28px
;
position
:
relative
}
#social
button
.user-file
:after
{
content
:
' '
;
display
:
block
;
position
:
absolute
;
right
:
10px
;
top
:
15px
;
width
:
0
;
height
:
0
;
border
:
solid
;
border-width
:
4px
5px
;
border-color
:
#fff
transparent
transparent
transparent
}
.user-file-menu
{
margin-top
:
20px
;
margin-left
:
1px
}
dist/social.js
View file @
c08ded2d
$
.
extend
(
$
.
fn
,
{
disabled
:
function
(
value
)
{
if
(
value
===
undefined
)
return
!!
this
.
attr
(
'disabled'
);
if
(
value
)
{
this
.
attr
(
'disabled'
,
'disabled'
);
}
else
{
this
.
removeAttr
(
'disabled'
);
}
return
this
;
},
loading
:
function
(
text
)
{
if
(
text
)
{
if
(
!
this
.
disabled
()
)
{
this
.
disabled
(
true
);
this
.
attr
(
'origin-text'
,
this
.
text
()
);
}
this
.
text
(
text
);
}
else
{
this
.
text
(
this
.
attr
(
'origin-text'
)
);
this
.
removeAttr
(
'origin-text'
);
this
.
disabled
(
false
);
}
return
this
;
},
text
:
(
function
()
{
var
originFn
=
$
.
fn
.
text
;
return
function
()
{
var
textSpan
=
this
.
children
(
'span.text'
);
if
(
textSpan
.
length
)
{
return
originFn
.
apply
(
textSpan
,
arguments
);
}
else
{
return
originFn
.
apply
(
this
,
arguments
);
}
};
}
)()
}
);
$
(
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,92 +49,39 @@ $( function () {
...
@@ -12,92 +49,39 @@ $( function () {
}
}
}
)();
}
)();
$login_btn
=
$
.
kmuibutton
(
{
$login_btn
=
$
(
'<button>登录</button>'
).
addClass
(
'login'
).
click
(
login
);
text
:
'登录'
}
).
click
(
function
()
{
$user_btn
=
$
(
'<button><span class="text"></span></button>'
).
addClass
(
'user-file'
);
if
(
!
currentUser
)
{
login
();
}
}
).
appendTo
(
$panel
);
var
$
menu
=
$
.
kmuidropmenu
(
{
$user_
menu
=
$
.
kmuidropmenu
(
{
data
:
[
{
data
:
[
{
label
:
'新建脑图'
,
label
:
'新建脑图'
,
value
:
'action_newminder'
click
:
newFile
},
{
},
{
divider
:
true
label
:
'到网盘管理文件...'
,
click
:
function
()
{
window
.
open
(
'http://pan.baidu.com/disk/home#dir/path=/apps/kityminder'
);
}
},
{
},
{
label
:
'最近脑图'
,
divider
:
true
value
:
'action_recent'
}
]
}
]
}
).
a
ppendTo
(
'body'
).
kmui
().
attachTo
(
$login_btn
);
}
).
a
ddClass
(
'user-file-menu'
).
appendTo
(
'body'
).
kmui
(
);
var
thisMapFilename
;
$user_menu
.
attachTo
(
$user_btn
);
$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
()
{
$save_btn
=
$
(
'<button>保存</button>'
).
click
(
saveThisFile
).
addClass
(
'baidu-cloud'
);
if
(
$share_btn
.
attr
(
'disabled'
)
)
{
return
;
}
var
data
=
window
.
km
.
exportData
(
'json'
);
$share_btn
=
$
(
'<button>分享</button>'
).
click
(
shareThisFile
).
addClass
(
'share'
);
$share_btn
.
attr
(
'disabled'
,
'disabled'
).
text
(
'正在分享...'
);
var
share_id
=
uuid
();
var
shareUrl
=
baseUrl
+
'index.html?share_id='
+
share_id
;
share
(
data
,
share_id
,
function
(
success
)
{
if
(
success
)
{
var
$popup
=
$
(
'<div></div>'
).
addClass
(
'popup'
).
appendTo
(
'body'
);
$popup
.
css
(
{
'position'
:
'absolute'
,
'right'
:
10
,
'top'
:
$share_btn
.
offset
().
top
+
$share_btn
.
height
()
+
10
,
'width'
:
250
,
'padding'
:
10
,
'background'
:
'white'
,
'border-radius'
:
'5px'
,
'box-shadow'
:
'1px 2px 4px rgba(0, 0, 0, .3)'
}
);
$popup
.
append
(
'<p style="margin: 5px 0; font-size: 12px;">分享成功,请复制URL:</p>'
);
var
$input
=
$
(
'<input type="text" style="width: 250px;" value="'
+
shareUrl
+
'"></input>'
).
appendTo
(
$popup
);
var
AK
,
thisMapFilename
,
currentUser
,
share_id
=
uuid
(),
$input
[
0
].
select
()
;
isShareLink
;
$popup
.
mousedown
(
function
(
e
)
{
AK
=
'wiE55BGOG8BkGnpPs6UNtPbb'
;
e
.
stopPropagation
();
}
);
$
(
'body'
).
on
(
'mousedown'
,
function
(
e
)
{
$popup
.
fadeOut
(
'fast'
,
function
()
{
$popup
.
remove
();
}
);
$share_btn
.
removeAttr
(
'disabled'
).
text
(
'分享'
);
$
(
'body'
).
off
(
'mousedown'
,
arguments
.
callee
);
}
);
}
}
);
}
).
addClass
(
'share'
);
baidu
.
frontia
.
init
(
'wiE55BGOG8BkGnpPs6UNtPbb'
);
var
currentUser
=
baidu
.
frontia
.
getCurrentAccount
();
if
(
currentUser
)
{
setLogined
(
currentUser
);
}
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
);
}
}
...
@@ -113,11 +97,13 @@ $( function () {
...
@@ -113,11 +97,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,26 +117,56 @@ $( function () {
...
@@ -131,26 +117,56 @@ $( function () {
'width'
:
16
,
'width'
:
16
,
'height'
:
16
'height'
:
16
}
);
}
);
$img
.
prependTo
(
$
login
_btn
);
$img
.
prependTo
(
$
user
_btn
);
}
}
}
);
}
);
}
}
function
loadRecent
()
{
function
loadRecent
()
{
var
sto
=
baidu
.
frontia
.
personalStorage
;
var
sto
=
baidu
.
frontia
.
personalStorage
;
$user_btn
.
loading
(
'加载最近脑图...'
);
sto
.
listFile
(
'apps/kityminder/'
,
{
sto
.
listFile
(
'apps/kityminder/'
,
{
by
:
'time'
,
by
:
'time'
,
success
:
function
(
result
)
{
success
:
function
(
result
)
{
if
(
result
.
list
.
length
)
{
if
(
result
.
list
.
length
)
{
loadPersonal
(
result
.
list
[
0
].
path
);
if
(
!
isShareLink
)
{
loadPersonal
(
result
.
list
[
0
].
path
);
}
else
{
$user_btn
.
loading
(
false
);
}
addToRecentMenu
(
result
.
list
);
}
}
}
}
}
);
}
);
}
}
function
addToRecentMenu
(
list
)
{
console
.
log
(
list
);
list
.
forEach
(
function
(
file
)
{
$user_menu
.
appendItem
(
{
item
:
{
label
:
getFileName
(
file
.
path
),
value
:
file
.
path
},
click
:
openFile
}
);
}
);
}
function
getFileName
(
path
)
{
var
filename
=
path
.
substr
(
path
.
lastIndexOf
(
'/'
)
+
1
);
return
filename
.
substr
(
0
,
filename
.
lastIndexOf
(
'.'
)
);
}
function
openFile
(
e
)
{
var
path
=
$
(
this
).
data
(
'value'
);
loadPersonal
(
path
);
}
function
loadPersonal
(
path
)
{
function
loadPersonal
(
path
)
{
var
sto
=
baidu
.
frontia
.
personalStorage
;
var
sto
=
baidu
.
frontia
.
personalStorage
;
thisMapFilename
=
path
;
thisMapFilename
=
path
;
$user_btn
.
loading
(
'加载“'
+
getFileName
(
path
)
+
'”...'
);
sto
.
getFileUrl
(
path
,
{
sto
.
getFileUrl
(
path
,
{
success
:
function
(
url
)
{
success
:
function
(
url
)
{
$
.
ajax
(
{
$
.
ajax
(
{
...
@@ -159,16 +175,46 @@ $( function () {
...
@@ -159,16 +175,46 @@ $( function () {
dataType
:
'text'
,
dataType
:
'text'
,
success
:
function
(
result
)
{
success
:
function
(
result
)
{
window
.
km
.
importData
(
result
,
'json'
);
window
.
km
.
importData
(
result
,
'json'
);
$user_btn
.
loading
(
false
).
text
(
getFileName
(
path
)
);
}
}
}
);
}
);
}
}
}
);
}
);
}
}
function
getMapFileName
()
{
return
'/apps/kityminder/'
+
window
.
km
.
getMinderTitle
()
+
'.km'
;
}
function
newFile
()
{
thisMapFilename
=
null
;
window
.
km
.
importData
(
'新建脑图'
,
'plain'
);
$user_btn
.
text
(
'<新建脑图>'
);
}
function
saveThisFile
()
{
var
data
=
window
.
km
.
exportData
(
'json'
);
save
(
data
,
thisMapFilename
||
getMapFileName
(),
function
(
success
,
info
)
{
if
(
success
)
{
$save_btn
.
text
(
'保存成功!'
);
setTimeout
(
function
()
{
$save_btn
.
loading
(
false
);
},
3000
);
if
(
!
thisMapFilename
)
{
thisMapFilename
=
info
.
path
;
addToRecentMenu
(
[
info
]
);
$user_btn
.
text
(
getFileName
(
thisMapFilename
)
);
}
}
console
.
log
(
info
);
}
);
$save_btn
.
loading
(
'正在保存...'
);
}
function
save
(
file
,
filename
,
callback
)
{
function
save
(
file
,
filename
,
callback
)
{
var
sto
=
baidu
.
frontia
.
personalStorage
;
var
sto
=
baidu
.
frontia
.
personalStorage
;
var
options
=
{
var
options
=
{
ondup
:
sto
.
constant
.
ONDUP_OVERWRITE
,
ondup
:
thisMapFilename
?
sto
.
constant
.
ONDUP_OVERWRITE
:
sto
.
constant
.
ONDUP_NEWCOPY
,
success
:
function
(
result
)
{
success
:
function
(
result
)
{
callback
(
true
,
result
);
callback
(
true
,
result
);
},
},
...
@@ -183,6 +229,47 @@ $( function () {
...
@@ -183,6 +229,47 @@ $( function () {
return
(
(
+
new
Date
()
*
10000
)
+
(
Math
.
random
()
*
9999
)
).
toString
(
36
);
return
(
(
+
new
Date
()
*
10000
)
+
(
Math
.
random
()
*
9999
)
).
toString
(
36
);
}
}
function
shareThisFile
()
{
if
(
$share_btn
.
disabled
()
)
{
return
;
}
var
data
=
window
.
km
.
exportData
(
'json'
);
$share_btn
.
loading
(
'正在分享...'
);
var
shareUrl
=
baseUrl
+
'index.html?share_id='
+
share_id
;
share
(
data
,
share_id
,
function
(
success
)
{
if
(
success
)
{
var
$popup
=
$
(
'<div></div>'
).
addClass
(
'popup'
).
appendTo
(
'body'
);
$popup
.
css
(
{
'position'
:
'absolute'
,
'right'
:
10
,
'top'
:
$share_btn
.
offset
().
top
+
$share_btn
.
height
()
+
10
,
'width'
:
250
,
'padding'
:
10
,
'background'
:
'white'
,
'border-radius'
:
'5px'
,
'box-shadow'
:
'1px 2px 4px rgba(0, 0, 0, .3)'
}
);
$popup
.
append
(
'<p style="margin: 5px 0; font-size: 12px;">分享成功,请复制URL:</p>'
);
var
$input
=
$
(
'<input type="text" style="width: 250px;" value="'
+
shareUrl
+
'"></input>'
).
appendTo
(
$popup
);
$input
[
0
].
select
();
$popup
.
mousedown
(
function
(
e
)
{
e
.
stopPropagation
();
}
);
$
(
'body'
).
on
(
'mousedown'
,
function
(
e
)
{
$popup
.
fadeOut
(
'fast'
,
function
()
{
$popup
.
remove
();
}
);
$share_btn
.
loading
(
false
);
$
(
'body'
).
off
(
'mousedown'
,
arguments
.
callee
);
}
);
}
}
);
}
function
share
(
text
,
shareId
,
callback
)
{
function
share
(
text
,
shareId
,
callback
)
{
var
data
=
new
baidu
.
frontia
.
Data
(
{
var
data
=
new
baidu
.
frontia
.
Data
(
{
shareMinder
:
{
shareMinder
:
{
...
@@ -208,14 +295,25 @@ $( function () {
...
@@ -208,14 +295,25 @@ $( 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
.
loading
(
'正在加载分享内容...'
);
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
.
loading
(
false
);
},
},
error
:
function
(
e
)
{
error
:
function
(
e
)
{
console
.
log
(
e
);
console
.
log
(
e
);
}
}
}
);
}
);
isShareLink
=
true
;
}
}
loadShare
();
loadShare
();
currentUser
=
baidu
.
frontia
.
getCurrentAccount
();
if
(
currentUser
)
{
setCurrentUser
(
currentUser
);
}
else
{
$login_btn
.
appendTo
(
$panel
);
}
}
);
}
);
\ No newline at end of file
dist/social.less
View file @
c08ded2d
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
line-height: 20px;
line-height: 20px;
text-align: right;
text-align: right;
overflow: hidden;
overflow: hidden;
button
, .kmui-btn
{
button {
outline: none;
outline: none;
display: inline-block;
display: inline-block;
padding: 0 15px;
padding: 0 15px;
...
@@ -72,5 +72,25 @@
...
@@ -72,5 +72,25 @@
border-radius: 2px;
border-radius: 2px;
margin-right: 7px;
margin-right: 7px;
}
}
&.user-file {
padding-right: 28px;
position: relative;
&:after {
content: ' ';
display: block;
position: absolute;
right: 10px;
top: 15px;
width: 0;
height: 0;
border: solid;
border-width: 4px 5px;
border-color: #FFFFFF transparent transparent transparent;
}
}
}
}
}
.user-file-menu {
margin-top: 20px;
margin-left: 1px;
}
}
\ No newline at end of file
src/core/minder.node.js
View file @
c08ded2d
...
@@ -12,7 +12,6 @@ kity.extendClass( Minder, {
...
@@ -12,7 +12,6 @@ kity.extendClass( Minder, {
rc
.
addShape
(
current
.
getRenderContainer
()
);
rc
.
addShape
(
current
.
getRenderContainer
()
);
}
);
}
);
},
},
handelNodeRemove
:
function
(
node
)
{
handelNodeRemove
:
function
(
node
)
{
var
rc
=
this
.
_rc
;
var
rc
=
this
.
_rc
;
node
.
traverse
(
function
(
current
)
{
node
.
traverse
(
function
(
current
)
{
...
@@ -29,6 +28,9 @@ kity.extendClass( Minder, {
...
@@ -29,6 +28,9 @@ kity.extendClass( Minder, {
}
else
{
}
else
{
km
.
renderNode
(
nodes
);
km
.
renderNode
(
nodes
);
}
}
},
getMinderTitle
:
function
()
{
return
this
.
getRoot
().
getText
();
}
}
}
);
}
);
\ No newline at end of file
src/core/minder.select.js
View file @
c08ded2d
...
@@ -67,6 +67,39 @@ kity.extendClass( Minder, function () {
...
@@ -67,6 +67,39 @@ kity.extendClass( Minder, function () {
},
},
isSingleSelect
:
function
()
{
isSingleSelect
:
function
()
{
return
this
.
_selectedNodes
.
length
==
1
;
return
this
.
_selectedNodes
.
length
==
1
;
},
getSelectedAncestors
:
function
()
{
var
nodes
=
this
.
getSelectedNodes
().
slice
(
0
),
ancestors
=
[],
judge
;
// 根节点不参与计算
var
rootIndex
=
nodes
.
indexOf
(
this
.
getRoot
()
);
if
(
~
rootIndex
)
{
nodes
.
splice
(
rootIndex
,
1
);
}
// 判断 nodes 列表中是否存在 judge 的祖先
function
hasAncestor
(
nodes
,
judge
)
{
for
(
var
i
=
nodes
.
length
-
1
;
i
>=
0
;
--
i
)
{
if
(
nodes
[
i
].
isAncestorOf
(
judge
)
)
return
true
;
}
return
false
;
}
// 按照拓扑排序
nodes
.
sort
(
function
(
node1
,
node2
)
{
return
node1
.
getLevel
()
-
node2
.
getLevel
();
}
);
// 因为是拓扑有序的,所以只需往上查找
while
(
(
judge
=
nodes
.
pop
()
)
)
{
if
(
!
hasAncestor
(
nodes
,
judge
)
)
{
ancestors
.
push
(
judge
);
}
}
return
ancestors
;
}
}
};
};
}()
);
}()
);
\ No newline at end of file
src/module/dragtree.js
View file @
c08ded2d
...
@@ -75,36 +75,7 @@ var DragBox = kity.createClass( "DragBox", {
...
@@ -75,36 +75,7 @@ var DragBox = kity.createClass( "DragBox", {
// 2. 从后往前枚举排序的结果,如果发现枚举目标之前存在其祖先,
// 2. 从后往前枚举排序的结果,如果发现枚举目标之前存在其祖先,
// 则排除枚举目标作为拖放源,否则加入拖放源
// 则排除枚举目标作为拖放源,否则加入拖放源
_calcDragSources
:
function
()
{
_calcDragSources
:
function
()
{
var
nodes
=
this
.
_minder
.
getSelectedNodes
().
slice
(
0
),
this
.
_dragSources
=
this
.
_minder
.
getSelectedAncestors
();
ancestors
=
[],
judge
;
// 根节点不参与计算
var
rootIndex
=
nodes
.
indexOf
(
this
.
_minder
.
getRoot
()
);
if
(
~
rootIndex
)
{
nodes
.
splice
(
rootIndex
,
1
);
}
// 判断 nodes 列表中是否存在 judge 的祖先
function
hasAncestor
(
nodes
,
judge
)
{
for
(
var
i
=
nodes
.
length
-
1
;
i
>=
0
;
--
i
)
{
if
(
nodes
[
i
].
isAncestorOf
(
judge
)
)
return
true
;
}
return
false
;
}
// 按照拓扑排序
nodes
.
sort
(
function
(
node1
,
node2
)
{
return
node1
.
getLevel
()
-
node2
.
getLevel
();
}
);
// 因为是拓扑有序的,所以只需往上查找
while
(
(
judge
=
nodes
.
pop
()
)
)
{
if
(
!
hasAncestor
(
nodes
,
judge
)
)
{
ancestors
.
push
(
judge
);
}
}
this
.
_dragSources
=
ancestors
;
},
},
...
...
src/ui/dropmenu.js
View file @
c08ded2d
//dropmenu 类
//dropmenu 类
KM
.
ui
.
define
(
'dropmenu'
,
{
KM
.
ui
.
define
(
'dropmenu'
,
{
tmpl
:
'<ul class="kmui-dropdown-menu" aria-labelledby="dropdownMenu" >'
+
tmpl
:
'<ul class="kmui-dropdown-menu" aria-labelledby="dropdownMenu" >'
+
'<%if(data && data.length){for(var i=0,ci;ci=data[i++];){%>'
+
'<%if(data && data.length){for(var i=0,ci;ci=data[i++];){%>'
+
'<%if(ci.divider){%><li class="kmui-divider"></li><%}else{%>'
+
'<%if(ci.divider){%><li class="kmui-divider"></li><%}else{%>'
+
'<li <%if(ci.active||ci.disabled){%>class="<%= ci.active||
\'\'
%> <%=ci.disabled||
\'\'
%>" <%}%> data-value="<%= ci.value%>" data-label="<%= ci.label%>">'
+
'<li <%if(ci.active||ci.disabled){%>class="<%= ci.active||
\'\'
%> <%=ci.disabled||
\'\'
%>" <%}%> data-value="<%= ci.value%>" data-label="<%= ci.label%>">'
+
'<a href="#" tabindex="-1"><em class="kmui-dropmenu-checkbox"><i class="kmui-icon-ok"></i></em><%= ci.label%></a>'
+
'<a href="#" tabindex="-1"><em class="kmui-dropmenu-checkbox"><i class="kmui-icon-ok"></i></em><%= ci.label%></a>'
+
'</li><%}}%>'
+
'</li><%}}%>'
+
'<%}%>'
+
'<%}%>'
+
'</ul>'
,
'</ul>'
,
subTmpl
:
'<%if(data && data.length){for(var i=0,ci;ci=data[i++];){%>'
+
subTmpl
:
'<%if(data && data.length){for(var i=0,ci;ci=data[i++];){%>'
+
'<%if(ci.divider){%><li class="kmui-divider"></li><%}else{%>'
+
'<%if(ci.divider){%><li class="kmui-divider"></li><%}else{%>'
+
'<li <%if(ci.active||ci.disabled){%>class="<%= ci.active||
\'\'
%> <%=ci.disabled||
\'\'
%>" <%}%> data-value="<%= ci.value%>" data-label="<%= ci.label%>">'
+
'<li <%if(ci.active||ci.disabled){%>class="<%= ci.active||
\'\'
%> <%=ci.disabled||
\'\'
%>" <%}%> data-value="<%= ci.value%>" data-label="<%= ci.label%>">'
+
'<a href="#" tabindex="-1"><em class="kmui-dropmenu-checkbox"><i class="kmui-icon-ok"></i></em><%= ci.label%></a>'
+
'<a href="#" tabindex="-1"><em class="kmui-dropmenu-checkbox"><i class="kmui-icon-ok"></i></em><%= ci.label%></a>'
+
...
@@ -16,32 +16,33 @@ KM.ui.define('dropmenu', {
...
@@ -16,32 +16,33 @@ KM.ui.define('dropmenu', {
'<%}%>'
,
'<%}%>'
,
defaultOpt
:
{
defaultOpt
:
{
data
:
[],
data
:
[],
click
:
function
()
{
click
:
function
()
{}
}
},
},
setData
:
function
(
items
)
{
setData
:
function
(
items
)
{
this
.
root
().
html
(
$
.
parseTmpl
(
this
.
subTmpl
,
items
)
);
this
.
root
().
html
(
$
.
parseTmpl
(
this
.
subTmpl
,
items
)
);
return
this
;
return
this
;
},
},
position
:
function
(
offset
)
{
position
:
function
(
offset
)
{
this
.
root
().
css
({
this
.
root
().
css
(
{
left
:
offset
.
x
,
left
:
offset
.
x
,
top
:
offset
.
y
top
:
offset
.
y
});
}
);
return
this
;
return
this
;
},
},
show
:
function
(){
show
:
function
()
{
if
(
this
.
trigger
(
'beforeshow'
)
===
false
){
if
(
this
.
trigger
(
'beforeshow'
)
===
false
)
{
return
;
return
;
}
else
{
}
else
{
this
.
root
().
css
({
display
:
'block'
});
this
.
root
().
css
(
{
this
.
trigger
(
'aftershow'
);
display
:
'block'
}
}
);
return
this
;
this
.
trigger
(
'aftershow'
);
}
return
this
;
},
},
init
:
function
(
options
)
{
init
:
function
(
options
)
{
var
me
=
this
;
var
me
=
this
;
var
eventName
=
{
var
eventName
=
{
click
:
1
,
click
:
1
,
...
@@ -49,63 +50,72 @@ KM.ui.define('dropmenu', {
...
@@ -49,63 +50,72 @@ KM.ui.define('dropmenu', {
mouseout
:
1
mouseout
:
1
};
};
this
.
root
(
$
(
$
.
parseTmpl
(
this
.
tmpl
,
options
))).
on
(
'click'
,
'li[class!="kmui-disabled kmui-divider kmui-dropdown-submenu"]'
,
function
(
evt
)
{
this
.
root
(
$
(
$
.
parseTmpl
(
this
.
tmpl
,
options
)
)
).
on
(
'click'
,
'li[class!="kmui-disabled kmui-divider kmui-dropdown-submenu"]'
,
function
(
evt
)
{
$
.
proxy
(
options
.
click
,
me
,
evt
,
$
(
this
).
data
(
'value'
),
$
(
this
).
data
(
'label'
),
$
(
this
)
)()
$
.
proxy
(
options
.
click
,
me
,
evt
,
$
(
this
).
data
(
'value'
),
$
(
this
).
data
(
'label'
),
$
(
this
)
)()
}
).
find
(
'li'
).
each
(
function
(
i
,
el
)
{
}
).
find
(
'li'
).
each
(
function
(
i
,
el
)
{
var
$this
=
$
(
this
);
var
$this
=
$
(
this
);
if
(
!
$this
.
hasClass
(
"kmui-disabled kmui-divider kmui-dropdown-submenu"
)
)
{
if
(
!
$this
.
hasClass
(
"kmui-disabled kmui-divider kmui-dropdown-submenu"
)
)
{
var
data
=
options
.
data
[
i
];
var
data
=
options
.
data
[
i
];
$
.
each
(
eventName
,
function
(
k
)
{
$
.
each
(
eventName
,
function
(
k
)
{
data
[
k
]
&&
$this
[
k
](
function
(
evt
)
{
data
[
k
]
&&
$this
[
k
](
function
(
evt
)
{
$
.
proxy
(
data
[
k
],
el
)(
evt
,
data
,
me
.
root
)
$
.
proxy
(
data
[
k
],
el
)(
evt
,
data
,
me
.
root
)
}
)
}
)
}
)
}
)
}
}
}
)
}
)
},
},
disabled
:
function
(
cb
)
{
disabled
:
function
(
cb
)
{
$
(
'li[class!=kmui-divider]'
,
this
.
root
()).
each
(
function
()
{
$
(
'li[class!=kmui-divider]'
,
this
.
root
()
).
each
(
function
()
{
var
$el
=
$
(
this
);
var
$el
=
$
(
this
);
if
(
cb
===
true
)
{
if
(
cb
===
true
)
{
$el
.
addClass
(
'kmui-disabled'
)
$el
.
addClass
(
'kmui-disabled'
)
}
else
if
(
$
.
isFunction
(
cb
)
)
{
}
else
if
(
$
.
isFunction
(
cb
)
)
{
$el
.
toggleClass
(
'kmui-disabled'
,
cb
(
li
)
)
$el
.
toggleClass
(
'kmui-disabled'
,
cb
(
li
)
)
}
else
{
}
else
{
$el
.
removeClass
(
'kmui-disabled'
)
$el
.
removeClass
(
'kmui-disabled'
)
}
}
});
}
);
},
},
val
:
function
(
val
)
{
val
:
function
(
val
)
{
var
currentVal
;
var
currentVal
;
$
(
'li[class!="kmui-divider kmui-disabled kmui-dropdown-submenu"]'
,
this
.
root
()).
each
(
function
()
{
$
(
'li[class!="kmui-divider kmui-disabled kmui-dropdown-submenu"]'
,
this
.
root
()
).
each
(
function
()
{
var
$el
=
$
(
this
);
var
$el
=
$
(
this
);
if
(
val
===
undefined
)
{
if
(
val
===
undefined
)
{
if
(
$el
.
find
(
'em.kmui-dropmenu-checked'
).
length
)
{
if
(
$el
.
find
(
'em.kmui-dropmenu-checked'
).
length
)
{
currentVal
=
$el
.
data
(
'value'
);
currentVal
=
$el
.
data
(
'value'
);
return
false
return
false
}
}
}
else
{
}
else
{
$el
.
find
(
'em'
).
toggleClass
(
'kmui-dropmenu-checked'
,
$el
.
data
(
'value'
)
==
val
)
$el
.
find
(
'em'
).
toggleClass
(
'kmui-dropmenu-checked'
,
$el
.
data
(
'value'
)
==
val
)
}
}
});
}
);
if
(
val
===
undefined
)
{
if
(
val
===
undefined
)
{
return
currentVal
return
currentVal
}
}
},
},
addSubmenu
:
function
(
label
,
menu
,
index
)
{
appendItem
:
function
(
item
)
{
var
itemTpl
=
'<%if(item.divider){%><li class="kmui-divider"></li><%}else{%>'
+
'<li <%if(item.active||item.disabled){%>class="<%= item.active||
\'\'
%> <%=item.disabled||
\'\'
%>" <%}%> data-value="<%= item.value%>" data-label="<%= item.label%>">'
+
'<a href="#" tabindex="-1"><em class="kmui-dropmenu-checkbox"><i class="kmui-icon-ok"></i></em><%= item.label%></a>'
+
'</li><%}%>'
;
var
html
=
$
.
parseTmpl
(
itemTpl
,
item
);
var
$item
=
$
(
html
).
click
(
item
.
click
);
this
.
root
().
append
(
$item
);
},
addSubmenu
:
function
(
label
,
menu
,
index
)
{
index
=
index
||
0
;
index
=
index
||
0
;
var
$list
=
$
(
'li[class!=kmui-divider]'
,
this
.
root
()
);
var
$list
=
$
(
'li[class!=kmui-divider]'
,
this
.
root
()
);
var
$node
=
$
(
'<li class="kmui-dropdown-submenu"><a tabindex="-1" href="#">'
+
label
+
'</a></li>'
).
append
(
menu
);
var
$node
=
$
(
'<li class="kmui-dropdown-submenu"><a tabindex="-1" href="#">'
+
label
+
'</a></li>'
).
append
(
menu
);
if
(
index
>=
0
&&
index
<
$list
.
length
)
{
if
(
index
>=
0
&&
index
<
$list
.
length
)
{
$node
.
insertBefore
(
$list
[
index
]
);
$node
.
insertBefore
(
$list
[
index
]
);
}
else
if
(
index
<
0
)
{
}
else
if
(
index
<
0
)
{
$node
.
insertBefore
(
$list
[
0
]
);
$node
.
insertBefore
(
$list
[
0
]
);
}
else
if
(
index
>=
$list
.
length
)
{
}
else
if
(
index
>=
$list
.
length
)
{
$node
.
appendTo
(
$list
);
$node
.
appendTo
(
$list
);
}
}
}
}
},
'menu'
);
},
'menu'
);
\ No newline at end of file
\ No newline at end of file
src/ui/menu.js
View file @
c08ded2d
...
@@ -31,9 +31,16 @@ KM.ui.define('menu',{
...
@@ -31,9 +31,16 @@ KM.ui.define('menu',{
var
me
=
this
;
var
me
=
this
;
if
(
!
$obj
.
data
(
'$mergeObj'
)){
if
(
!
$obj
.
data
(
'$mergeObj'
)){
$obj
.
data
(
'$mergeObj'
,
me
.
root
());
$obj
.
data
(
'$mergeObj'
,
me
.
root
());
$obj
.
on
(
'wrapclick'
,
function
(
evt
){
if
(
$obj
.
kmui
()){
me
.
supper
.
show
.
call
(
me
,
$obj
,
''
,
'offset'
)
$obj
.
on
(
'wrapclick'
,
function
(
evt
){
});
me
.
supper
.
show
.
call
(
me
,
$obj
,
''
,
'offset'
,
15
)
});
}
else
{
$obj
.
on
(
'click'
,
function
(
evt
){
me
.
supper
.
show
.
call
(
me
,
$obj
,
''
,
'offset'
,
15
)
})
}
me
.
register
(
'click'
,
$obj
,
function
(
evt
){
me
.
register
(
'click'
,
$obj
,
function
(
evt
){
me
.
hide
()
me
.
hide
()
});
});
...
...
themes/default/css/dropmenu.css
View file @
c08ded2d
...
@@ -20,11 +20,12 @@
...
@@ -20,11 +20,12 @@
.kmui-dropdown-menu
.kmui-divider
{
.kmui-dropdown-menu
.kmui-divider
{
height
:
1px
;
height
:
1px
;
margin
:
9
px
0
;
margin
:
5
px
0
;
overflow
:
hidden
;
overflow
:
hidden
;
background-color
:
#e5e5e5
;
background-color
:
#e5e5e5
;
}
}
.kmui-dropdown-menu
.kmui-divider
:first-child
{
.kmui-dropdown-menu
.kmui-divider
:first-child
,
.kmui-dropdown-menu
.kmui-divider
:last-child
{
display
:
none
;
display
:
none
;
}
}
...
...
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