Commit a0c055ad authored by campaign's avatar campaign

Merge branch 'hot-fix' of https://github.com/fex-team/kityminder into hot-fix

parents a93b5e27 e10723bc
......@@ -7,6 +7,7 @@
"trailing" : true,
"white": false,
"quotmark": false,
"browser": true,
"predef" : [
"module",
"require",
......
Subproject commit 256dce28fb1e574b18f0dd084f7503cbc25e2a80
Subproject commit bfe316800ce4c78e0072d03404f0a364ae30ff0d
......@@ -99,7 +99,7 @@ $( function () {
loadShare();
bindShortCuts();
bindDraft();
draftManager && watchChanges();
if ( draftManager ) watchChanges();
if ( draftManager && !loadPath() && !isShareLink ) loadDraft( 0 );
}
......@@ -183,12 +183,6 @@ $( function () {
} );
}
function initPreferneceSync() {
if ( currentAccount ) {
}
}
// 检查 URL 是否分享连接,是则加载分享内容
function loadShare() {
......@@ -335,27 +329,41 @@ $( function () {
// 加载用户最近使用的文件
function loadUserFiles() {
if ( loadUserFiles.tryCount > 3 ) {
notice( '加载最近脑图失败!' );
loadUserFiles.tryCount = 0;
}
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/', {
by: 'time',
success: function ( result ) {
if ( result.list.length ) {
//$user_btn.loading( false );
loadUserFiles.$loadingMenuItem.remove();
addToRecentMenu( result.list.filter( function ( file ) {
return getFileFormat( file.path ) in fileLoader;
} ) );
syncPreference( result.list );
}
},
error: function () {
notice( '加载最近脑图失败!' );
//$user_btn.loading( false );
}
error: loadUserFiles
} );
loadUserFiles.tryCount++;
}
loadUserFiles.tryCount = 0;
// 同步用户配置文件
function syncPreference( fileList ) {
......@@ -460,6 +468,12 @@ $( function () {
// 加载当前 remoteUrl 中制定的文件
function loadRemote() {
// 失败重试判断
if ( loadRemote.tryCount > 3 ) {
notice( '加载脑图失败!' );
loadRemote.tryCount = 0;
}
var sto = baidu.frontia.personalStorage;
$user_btn.loading( '加载“' + getFileName( remotePath ) + '”...' );
......@@ -471,11 +485,16 @@ $( function () {
if ( format in fileLoader ) {
fileLoader[ format ]( url );
}
loadRemote.tryCount = 0;
},
error: notice
error: loadRemote
} );
loadRemote.tryCount++;
}
loadRemote.tryCount = 0;
function getFileFormat( fileUrl ) {
return fileUrl.split( '.' ).pop();
}
......@@ -677,7 +696,7 @@ $( function () {
$share_btn.loading( '正在分享...' );
$.ajax({
$.ajax( {
url: 'http://naotu.baidu.com/mongo.php',
type: 'POST',
data: {
......@@ -697,8 +716,8 @@ $( function () {
$share_url.val( shareUrl )[ 0 ].select();
}
},
error: function() {
notice('分享失败,可能是当前的环境不支持该操作。');
error: function () {
notice( '分享失败,可能是当前的环境不支持该操作。' );
}
} );
......
......@@ -3,7 +3,7 @@ KM.ui.define( 'dropmenu', {
tmpl: '<ul class="kmui-dropdown-menu" aria-labelledby="dropdownMenu" >' +
'<%if(data && data.length){for(var i=0,ci;ci=data[i++];){%>' +
'<%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>' +
'</li><%}}%>' +
'<%}%>' +
......@@ -106,12 +106,13 @@ KM.ui.define( 'dropmenu', {
},
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%>">' +
'<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>' +
'</li><%}%>';
var html = $.parseTmpl( itemTpl, item );
var $item = $( html ).click( item.click );
this.root().append( $item );
return $item;
},
addSubmenu: function ( label, menu, index ) {
index = index || 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment