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
e10723bc
Commit
e10723bc
authored
May 15, 2014
by
techird
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
加载加入重试机制
parent
0e6622ca
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
20 deletions
+41
-20
.jshintrc
.jshintrc
+1
-0
social.js
social/social.js
+37
-18
dropmenu.js
src/ui/dropmenu.js
+3
-2
No files found.
.jshintrc
View file @
e10723bc
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
"trailing" : true,
"trailing" : true,
"white": false,
"white": false,
"quotmark": false,
"quotmark": false,
"browser": true,
"predef" : [
"predef" : [
"module",
"module",
"require",
"require",
...
...
social/social.js
View file @
e10723bc
...
@@ -99,7 +99,7 @@ $( function () {
...
@@ -99,7 +99,7 @@ $( function () {
loadShare
();
loadShare
();
bindShortCuts
();
bindShortCuts
();
bindDraft
();
bindDraft
();
draftManager
&&
watchChanges
();
if
(
draftManager
)
watchChanges
();
if
(
draftManager
&&
!
loadPath
()
&&
!
isShareLink
)
loadDraft
(
0
);
if
(
draftManager
&&
!
loadPath
()
&&
!
isShareLink
)
loadDraft
(
0
);
}
}
...
@@ -183,12 +183,6 @@ $( function () {
...
@@ -183,12 +183,6 @@ $( function () {
}
);
}
);
}
}
function
initPreferneceSync
()
{
if
(
currentAccount
)
{
}
}
// 检查 URL 是否分享连接,是则加载分享内容
// 检查 URL 是否分享连接,是则加载分享内容
function
loadShare
()
{
function
loadShare
()
{
...
@@ -335,27 +329,41 @@ $( function () {
...
@@ -335,27 +329,41 @@ $( function () {
// 加载用户最近使用的文件
// 加载用户最近使用的文件
function
loadUserFiles
()
{
function
loadUserFiles
()
{
if
(
loadUserFiles
.
tryCount
>
3
)
{
notice
(
'加载最近脑图失败!'
);
loadUserFiles
.
tryCount
=
0
;
}
var
sto
=
baidu
.
frontia
.
personalStorage
;
var
sto
=
baidu
.
frontia
.
personalStorage
;
//$user_btn.loading( '加载最近脑图...' );
if
(
loadUserFiles
.
tryCount
===
0
)
{
loadUserFiles
.
$loadingMenuItem
=
$user_menu
.
appendItem
(
{
item
:
{
label
:
'正在加载最近脑图...'
,
disabled
:
'disabled'
}
}
);
}
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
)
{
//$user_btn.loading( false
);
loadUserFiles
.
$loadingMenuItem
.
remove
(
);
addToRecentMenu
(
result
.
list
.
filter
(
function
(
file
)
{
addToRecentMenu
(
result
.
list
.
filter
(
function
(
file
)
{
return
getFileFormat
(
file
.
path
)
in
fileLoader
;
return
getFileFormat
(
file
.
path
)
in
fileLoader
;
}
)
);
}
)
);
syncPreference
(
result
.
list
);
syncPreference
(
result
.
list
);
}
}
},
},
error
:
function
()
{
error
:
loadUserFiles
notice
(
'加载最近脑图失败!'
);
//$user_btn.loading( false );
}
}
);
}
);
loadUserFiles
.
tryCount
++
;
}
}
loadUserFiles
.
tryCount
=
0
;
// 同步用户配置文件
// 同步用户配置文件
function
syncPreference
(
fileList
)
{
function
syncPreference
(
fileList
)
{
...
@@ -460,6 +468,12 @@ $( function () {
...
@@ -460,6 +468,12 @@ $( function () {
// 加载当前 remoteUrl 中制定的文件
// 加载当前 remoteUrl 中制定的文件
function
loadRemote
()
{
function
loadRemote
()
{
// 失败重试判断
if
(
loadRemote
.
tryCount
>
3
)
{
notice
(
'加载脑图失败!'
);
loadRemote
.
tryCount
=
0
;
}
var
sto
=
baidu
.
frontia
.
personalStorage
;
var
sto
=
baidu
.
frontia
.
personalStorage
;
$user_btn
.
loading
(
'加载“'
+
getFileName
(
remotePath
)
+
'”...'
);
$user_btn
.
loading
(
'加载“'
+
getFileName
(
remotePath
)
+
'”...'
);
...
@@ -471,11 +485,16 @@ $( function () {
...
@@ -471,11 +485,16 @@ $( function () {
if
(
format
in
fileLoader
)
{
if
(
format
in
fileLoader
)
{
fileLoader
[
format
](
url
);
fileLoader
[
format
](
url
);
}
}
loadRemote
.
tryCount
=
0
;
},
},
error
:
notic
e
error
:
loadRemot
e
}
);
}
);
loadRemote
.
tryCount
++
;
}
}
loadRemote
.
tryCount
=
0
;
function
getFileFormat
(
fileUrl
)
{
function
getFileFormat
(
fileUrl
)
{
return
fileUrl
.
split
(
'.'
).
pop
();
return
fileUrl
.
split
(
'.'
).
pop
();
}
}
...
@@ -677,7 +696,7 @@ $( function () {
...
@@ -677,7 +696,7 @@ $( function () {
$share_btn
.
loading
(
'正在分享...'
);
$share_btn
.
loading
(
'正在分享...'
);
$
.
ajax
({
$
.
ajax
(
{
url
:
'http://naotu.baidu.com/mongo.php'
,
url
:
'http://naotu.baidu.com/mongo.php'
,
type
:
'POST'
,
type
:
'POST'
,
data
:
{
data
:
{
...
@@ -694,11 +713,11 @@ $( function () {
...
@@ -694,11 +713,11 @@ $( function () {
notice
(
result
.
error
);
notice
(
result
.
error
);
}
else
{
}
else
{
$share_dialog
.
show
();
$share_dialog
.
show
();
$share_url
.
val
(
shareUrl
)[
0
].
select
();
$share_url
.
val
(
shareUrl
)[
0
].
select
();
}
}
},
},
error
:
function
()
{
error
:
function
()
{
notice
(
'分享失败,可能是当前的环境不支持该操作。'
);
notice
(
'分享失败,可能是当前的环境不支持该操作。'
);
}
}
}
);
}
);
...
...
src/ui/dropmenu.js
View file @
e10723bc
...
@@ -3,7 +3,7 @@ KM.ui.define( 'dropmenu', {
...
@@ -3,7 +3,7 @@ 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
id="<%= ci.id%>"
<%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><%}}%>'
+
'<%}%>'
+
'<%}%>'
+
...
@@ -106,12 +106,13 @@ KM.ui.define( 'dropmenu', {
...
@@ -106,12 +106,13 @@ KM.ui.define( 'dropmenu', {
},
},
appendItem
:
function
(
item
)
{
appendItem
:
function
(
item
)
{
var
itemTpl
=
'<%if(item.divider){%><li class="kmui-divider"></li><%}else{%>'
+
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%>">'
+
'<li
id="<%= item.id%>"
<%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>'
+
'<a href="#" tabindex="-1"><em class="kmui-dropmenu-checkbox"><i class="kmui-icon-ok"></i></em><%= item.label%></a>'
+
'</li><%}%>'
;
'</li><%}%>'
;
var
html
=
$
.
parseTmpl
(
itemTpl
,
item
);
var
html
=
$
.
parseTmpl
(
itemTpl
,
item
);
var
$item
=
$
(
html
).
click
(
item
.
click
);
var
$item
=
$
(
html
).
click
(
item
.
click
);
this
.
root
().
append
(
$item
);
this
.
root
().
append
(
$item
);
return
$item
;
},
},
addSubmenu
:
function
(
label
,
menu
,
index
)
{
addSubmenu
:
function
(
label
,
menu
,
index
)
{
index
=
index
||
0
;
index
=
index
||
0
;
...
...
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