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
68fb69e2
Commit
68fb69e2
authored
Feb 12, 2014
by
campaign
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
by zhanyi
parent
d285ccb7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
80 additions
and
0 deletions
+80
-0
saveto.js
src/adapter/saveto.js
+45
-0
utils.js
src/adapter/utils.js
+35
-0
No files found.
src/adapter/saveto.js
0 → 100644
View file @
68fb69e2
KM
.
registerUI
(
'saveto'
,
function
(
name
)
{
var
me
=
this
,
label
=
me
.
getLang
(
'tooltips.'
+
name
),
options
=
{
label
:
label
,
title
:
label
,
comboboxName
:
name
,
items
:
[],
itemStyles
:
[],
value
:
[],
autowidthitem
:
[]
},
$combox
=
null
,
comboboxWidget
=
null
;
utils
.
each
(
KityMinder
.
getAllRegisteredProtocals
(),
function
(
k
){
options
.
value
.
push
(
k
);
options
.
items
.
push
(
k
);
options
.
autowidthitem
.
push
(
$
.
wordCountAdaptive
(
k
)
);
});
//实例化
$combox
=
$
.
kmuibuttoncombobox
(
options
).
css
(
'zIndex'
,
me
.
getOptions
(
'zIndex'
)
+
1
);
comboboxWidget
=
$combox
.
kmui
();
comboboxWidget
.
on
(
'comboboxselect'
,
function
(
evt
,
res
){
alert
(
me
.
exportData
(
res
.
value
));
}).
on
(
"beforeshow"
,
function
(){
if
(
$combox
.
parent
().
length
===
0
)
{
$combox
.
appendTo
(
me
.
$container
.
find
(
'.kmui-dialog-container'
)
);
}
}).
on
(
'aftercomboboxselect'
,
function
(){
this
.
setLabelWithDefaultValue
()
});
return
comboboxWidget
.
button
().
addClass
(
'kmui-combobox'
);
});
src/adapter/utils.js
0 → 100644
View file @
68fb69e2
/**
* 宽度自适应工具函数
* @param word 单词内容
* @param hasSuffix 是否含有后缀
*/
$
.
wordCountAdaptive
=
function
(
word
,
hasSuffix
)
{
var
$tmpNode
=
$
(
'<span>'
).
html
(
word
).
css
(
{
display
:
'inline'
,
position
:
'absolute'
,
top
:
-
10000000
,
left
:
-
100000
}
).
appendTo
(
document
.
body
),
width
=
$tmpNode
.
width
();
$tmpNode
.
remove
();
$tmpNode
=
null
;
if
(
width
<
50
)
{
return
word
;
}
else
{
word
=
word
.
slice
(
0
,
hasSuffix
?
-
4
:
-
1
);
if
(
!
word
.
length
)
{
return
'...'
;
}
return
$
.
wordCountAdaptive
(
word
+
'...'
,
true
);
}
};
\ No newline at end of file
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