Commit 97b7b458 authored by campaign's avatar campaign

Merge remote-tracking branch 'origin/dev' into dev

parents 73960471 fbfcca71
...@@ -21,10 +21,10 @@ if (isset($_REQUEST['content'])) { ...@@ -21,10 +21,10 @@ if (isset($_REQUEST['content'])) {
$filename = "kikyminder"; $filename = "kikyminder";
} }
header("Content-type: application/octet-stream; charset=utf-8; name=".$filename); header("Content-type: application/octet-stream; charset=utf8; name=".urlencode($filename));
header("Accept-Length: ".strlen($content)); header("Accept-Length: ".strlen($content));
header("Content-Length: ".strlen($content)); header("Content-Length: ".strlen($content));
header("Content-Disposition: attachment; filename=".$filename); header("Content-Disposition: attachment; filename=".urlencode($filename));
header('Content-Description: File Transfer'); header('Content-Description: File Transfer');
echo $content; echo $content;
......
...@@ -114,15 +114,15 @@ ...@@ -114,15 +114,15 @@
}); });
km.on('unziperror', function(ev) { km.on('unziperror', function(ev) {
alert('unziperror'); alert('文件解析错误,文件可能已损坏!');
}); });
km.on('parseerror', function(ev) { km.on('parseerror', function(ev) {
alert('parseerror'); alert('文件解析错误,文件可能已损坏!');
}); });
km.on('unknownprotocal', function(ev) { km.on('unknownprotocal', function(ev) {
alert('unknownprotocal'); alert('不支持的文件格式!');
}); });
</script> </script>
......
...@@ -150,7 +150,7 @@ $(function() { ...@@ -150,7 +150,7 @@ $(function() {
menus = menus.concat([{ menus = menus.concat([{
divider: true, divider: true,
}, { }, {
label: '登陆', label: '请登录',
click: login, click: login,
id: 'net-hint-buttom' id: 'net-hint-buttom'
}, { }, {
......
...@@ -4,7 +4,8 @@ ...@@ -4,7 +4,8 @@
var content = url.split(',')[1]; var content = url.split(',')[1];
var $form = $('<form></form>').attr({ var $form = $('<form></form>').attr({
'action': 'download.php', 'action': 'download.php',
'method': 'POST' 'method': 'POST',
'accept-charset': 'utf-8'
}); });
var $content = $('<input />').attr({ var $content = $('<input />').attr({
...@@ -25,6 +26,8 @@ ...@@ -25,6 +26,8 @@
value: filename value: filename
}).appendTo($form); }).appendTo($form);
$('<input name="iehack" value="&#9760;" />').appendTo($form);
$form.appendTo('body').submit().remove(); $form.appendTo('body').submit().remove();
} }
......
...@@ -91,13 +91,19 @@ kity.extendClass(Minder, { ...@@ -91,13 +91,19 @@ kity.extendClass(Minder, {
var stoped = this._fire(new MinderEvent('beforeimport', params, true)); var stoped = this._fire(new MinderEvent('beforeimport', params, true));
if (stoped) return this; if (stoped) return this;
try {
json = params.json || (params.json = protocal.decode(local)); json = params.json || (params.json = protocal.decode(local));
} catch (e) {
return this.fire('parseerror');
}
if (typeof json === 'object' && 'then' in json) { if (typeof json === 'object' && 'then' in json) {
var self = this; var self = this;
json.then(local, function(data) { json.then(function(data) {
params.json = data; params.json = data;
self._doImport(data, params); self._doImport(data, params);
}).error(function() {
self.fire('parseerror');
}); });
} else { } else {
this._doImport(json, params); this._doImport(json, params);
...@@ -124,6 +130,8 @@ kity.extendClass(Minder, { ...@@ -124,6 +130,8 @@ kity.extendClass(Minder, {
return node; return node;
} }
if (!json) return;
this._fire(new MinderEvent('preimport', params, false)); this._fire(new MinderEvent('preimport', params, false));
// 删除当前所有节点 // 删除当前所有节点
......
...@@ -37,7 +37,11 @@ KityMinder.registerModule('DropFile', function() { ...@@ -37,7 +37,11 @@ KityMinder.registerModule('DropFile', function() {
function importMinderFile(minder, file) { function importMinderFile(minder, file) {
if (!file) return; if (!file) return;
var ext = /(.)\w+$/.exec(file.name)[0]; var ext = /(.)\w+$/.exec(file.name);
if (!ext) return alert('不支持导入此类文件!');
ext = ext[0];
if ((/xmind/g).test(ext)) { //xmind zip if ((/xmind/g).test(ext)) { //xmind zip
importSync(minder, file, 'xmind'); importSync(minder, file, 'xmind');
...@@ -50,7 +54,7 @@ KityMinder.registerModule('DropFile', function() { ...@@ -50,7 +54,7 @@ KityMinder.registerModule('DropFile', function() {
} else if (/txt/.test(ext)) { } else if (/txt/.test(ext)) {
importAsync(minder, file, 'plain'); importAsync(minder, file, 'plain');
} else { } else {
alert('不支持文件!'); alert('不支持导入此类文件!');
} }
} }
......
...@@ -28,7 +28,7 @@ KityMinder.registerModule('PriorityModule', function() { ...@@ -28,7 +28,7 @@ KityMinder.registerModule('PriorityModule', function() {
bg = new kity.Rect() bg = new kity.Rect()
.setRadius(3) .setRadius(3)
.setPosition(0, 0) .setPosition(0.5, 0.5)
.setSize(this.width, this.height); .setSize(this.width, this.height);
number = new kity.Text() number = new kity.Text()
......
...@@ -6,66 +6,68 @@ ...@@ -6,66 +6,68 @@
*/ */
KityMinder.registerProtocal( 'freemind', function () { KityMinder.registerProtocal('freemind', function() {
// 标签 map // 标签 map
var markerMap = { var markerMap = {
'full-1' : ['PriorityIcon', 1] 'full-1': ['priority', 1],
,'full-2' : ['PriorityIcon', 2] 'full-2': ['priority', 2],
,'full-3' : ['PriorityIcon', 3] 'full-3': ['priority', 3],
,'full-4' : ['PriorityIcon', 4] 'full-4': ['priority', 4],
,'full-5' : ['PriorityIcon', 5] 'full-5': ['priority', 5],
,'full-6' : null 'full-6': ['priority', 6],
,'full-7' : null 'full-7': ['priority', 7],
,'full-8' : null 'full-8': ['priority', 8]
,'full-9' : null
,'full-0' : null
}; };
function processTopic(topic, obj){ function processTopic(topic, obj) {
//处理文本 //处理文本
obj.data = { text : topic.TEXT }; obj.data = {
text: topic.TEXT
};
var i;
// 处理标签 // 处理标签
if(topic.icon){ if (topic.icon) {
var icons = topic.icon; var icons = topic.icon;
if(icons.length && icons.length > 0){ var type;
for (var i in icons) { if (icons.length && icons.length > 0) {
var type = markerMap[ icons[i]['BUILTIN'] ]; for (i in icons) {
type && (obj.data[ type[0] ] = type[1]); type = markerMap[icons[i].BUILTIN];
if (type) obj.data[type[0]] = type[1];
} }
}else{ } else {
var type = markerMap[ icons['BUILTIN'] ]; type = markerMap[icons.BUILTIN];
type && (obj.data[ type[0] ] = type[1]); if (type) obj.data[type[0]] = type[1];
} }
} }
// 处理超链接 // 处理超链接
if(topic.LINK){ if (topic.LINK) {
obj.data.hyperlink = topic.LINK; obj.data.hyperlink = topic.LINK;
} }
//处理子节点 //处理子节点
if( topic.node ){ if (topic.node) {
var tmp = topic.node; var tmp = topic.node;
if( tmp.length && tmp.length > 0 ){ //多个子节点 if (tmp.length && tmp.length > 0) { //多个子节点
obj.children = []; obj.children = [];
for(var i in tmp){ for (i in tmp) {
obj.children.push({}); obj.children.push({});
processTopic(tmp[i], obj.children[i]); processTopic(tmp[i], obj.children[i]);
} }
}else{ //一个子节点 } else { //一个子节点
obj.children = [{}]; obj.children = [{}];
processTopic(tmp, obj.children[0]); processTopic(tmp, obj.children[0]);
} }
} }
} }
function xml2km(xml){ function xml2km(xml) {
var json = $.xml2json(xml); var json = $.xml2json(xml);
var result = {}; var result = {};
processTopic(json.node, result); processTopic(json.node, result);
...@@ -76,18 +78,11 @@ KityMinder.registerProtocal( 'freemind', function () { ...@@ -76,18 +78,11 @@ KityMinder.registerProtocal( 'freemind', function () {
fileDescription: 'freemind格式文件', fileDescription: 'freemind格式文件',
fileExtension: '.mm', fileExtension: '.mm',
decode: function ( local ) { decode: function(local) {
try{ return xml2km(local);
return xml2km( local );
}catch(e){
km.fire('parseerror');
return undefined;
}
}, },
// recognize: null, // recognize: null,
recognizePriority: -1 recognizePriority: -1
}; };
} ); });
\ No newline at end of file
KityMinder.registerProtocal( 'json', function () { KityMinder.registerProtocal('json', function() {
function filter( key, value ) { function filter(key, value) {
if ( key == 'layout' || key == 'shicon' ) { if (key == 'layout' || key == 'shicon') {
return undefined; return undefined;
} }
return value; return value;
...@@ -9,15 +9,15 @@ KityMinder.registerProtocal( 'json', function () { ...@@ -9,15 +9,15 @@ KityMinder.registerProtocal( 'json', function () {
fileDescription: 'KityMinder', fileDescription: 'KityMinder',
fileExtension: '.km', fileExtension: '.km',
mineType: 'application/json', mineType: 'application/json',
encode: function ( json ) { encode: function(json) {
return JSON.stringify( json, filter ); return JSON.stringify(json, filter);
}, },
decode: function ( local ) { decode: function(local) {
return JSON.parse( local ); return JSON.parse(local);
}, },
recognize: function ( local ) { recognize: function(local) {
return Utils.isString( local ) && local.charAt( 0 ) == '{' && local.charAt( local.length - 1 ) == '}'; return Utils.isString(local) && local.charAt(0) == '{' && local.charAt(local.length - 1) == '}';
}, },
recognizePriority: 0 recognizePriority: 0
}; };
} ); });
\ No newline at end of file \ No newline at end of file
/* global zip:true */
/* /*
http://www.mindjet.com/mindmanager/ http://www.mindjet.com/mindmanager/
mindmanager的后缀为.mmap,实际文件格式是zip,解压之后核心文件是Document.xml mindmanager的后缀为.mmap,实际文件格式是zip,解压之后核心文件是Document.xml
*/ */
KityMinder.registerProtocal('mindmanager', function() {
KityMinder.registerProtocal( 'mindmanager', function () { var successCall, errorCall;
// 标签 map // 标签 map
var markerMap = { var markerMap = {
'urn:mindjet:Prio1': [ 'PriorityIcon', 1 ], 'urn:mindjet:Prio1': ['PriorityIcon', 1],
'urn:mindjet:Prio2': [ 'PriorityIcon', 2 ], 'urn:mindjet:Prio2': ['PriorityIcon', 2],
'urn:mindjet:Prio3': [ 'PriorityIcon', 3 ], 'urn:mindjet:Prio3': ['PriorityIcon', 3],
'urn:mindjet:Prio4': [ 'PriorityIcon', 4 ], 'urn:mindjet:Prio4': ['PriorityIcon', 4],
'urn:mindjet:Prio5': [ 'PriorityIcon', 5 ], 'urn:mindjet:Prio5': ['PriorityIcon', 5],
'0': [ 'ProgressIcon', 1 ], '0': ['ProgressIcon', 1],
'25': [ 'ProgressIcon', 2 ], '25': ['ProgressIcon', 2],
'50': [ 'ProgressIcon', 3 ], '50': ['ProgressIcon', 3],
'75': [ 'ProgressIcon', 4 ], '75': ['ProgressIcon', 4],
'100': [ 'ProgressIcon', 5 ] '100': ['ProgressIcon', 5]
}; };
function processTopic( topic, obj ) { function processTopic(topic, obj) {
//处理文本 //处理文本
obj.data = { obj.data = {
text: topic.Text && topic.Text.PlainText || '' text: topic.Text && topic.Text.PlainText || ''
}; // 节点默认的文本,没有Text属性 }; // 节点默认的文本,没有Text属性
// 处理标签 // 处理标签
if ( topic.Task ) { if (topic.Task) {
var type; var type;
if ( topic.Task.TaskPriority ) { if (topic.Task.TaskPriority) {
type = markerMap[ topic.Task.TaskPriority ]; type = markerMap[topic.Task.TaskPriority];
type && ( obj.data[ type[ 0 ] ] = type[ 1 ] ); if (type) obj.data[type[0]] = type[1];
} }
if ( topic.Task.TaskPercentage ) { if (topic.Task.TaskPercentage) {
type = markerMap[ topic.Task.TaskPercentage ]; type = markerMap[topic.Task.TaskPercentage];
type && ( obj.data[ type[ 0 ] ] = type[ 1 ] ); if (type) obj.data[type[0]] = type[1];
} }
} }
// 处理超链接 // 处理超链接
if ( topic.Hyperlink ) { if (topic.Hyperlink) {
obj.data.hyperlink = topic.Hyperlink.Url; obj.data.hyperlink = topic.Hyperlink.Url;
} }
//处理子节点 //处理子节点
if ( topic.SubTopics && topic.SubTopics.Topic ) { if (topic.SubTopics && topic.SubTopics.Topic) {
var tmp = topic.SubTopics.Topic; var tmp = topic.SubTopics.Topic;
if ( tmp.length && tmp.length > 0 ) { //多个子节点 if (tmp.length && tmp.length > 0) { //多个子节点
obj.children = []; obj.children = [];
for ( var i in tmp ) { for (var i in tmp) {
obj.children.push( {} ); obj.children.push({});
processTopic( tmp[ i ], obj.children[ i ] ); processTopic(tmp[i], obj.children[i]);
} }
} else { //一个子节点 } else { //一个子节点
obj.children = [ {} ]; obj.children = [{}];
processTopic( tmp, obj.children[ 0 ] ); processTopic(tmp, obj.children[0]);
} }
} }
} }
function xml2km( xml ) { function xml2km(xml) {
var json = $.xml2json( xml ); var json = $.xml2json(xml);
var result = {}; var result = {};
processTopic( json.OneTopic.Topic, result ); processTopic(json.OneTopic.Topic, result);
return result; return result;
} }
function onerror(){ function onerror() {
km.fire('unziperror'); errorCall('ziperror');
} }
function getEntries( file, onend ) { function getEntries(file, onend) {
zip.createReader( new zip.BlobReader( file ), function ( zipReader ) { zip.createReader(new zip.BlobReader(file), function(zipReader) {
zipReader.getEntries( onend ); zipReader.getEntries(onend);
}, onerror ); }, onerror);
} }
return { return {
fileDescription: 'mindmanager格式文件', fileDescription: 'mindmanager格式文件',
fileExtension: '.mmap', fileExtension: '.mmap',
decode: function(local) {
decode: function ( local ) {
return { return {
then: function ( local, callback ) { then: function(callback) {
successCall = callback;
getEntries( local, function ( entries ) { getEntries(local, function(entries) {
var hasMainDoc = false; var hasMainDoc = false;
entries.forEach( function ( entry ) { entries.forEach(function(entry) {
if ( entry.filename == 'Document.xml' ) { if (entry.filename == 'Document.xml') {
hasMainDoc = true; hasMainDoc = true;
entry.getData( new zip.TextWriter(), function ( text ) { entry.getData(new zip.TextWriter(), function(text) {
try{ try {
var km = xml2km( $.parseXML( text ) ); var km = xml2km($.parseXML(text));
callback && callback( km ); if (successCall) successCall(km);
}catch(e){ } catch (e) {
km.fire('parseerror'); if (errorCall) errorCall('parseerror');
} }
} ); });
} }
} ); });
!hasMainDoc && km.fire('parseerror'); if (!hasMainDoc && errorCall) errorCall('parseerror');
} ); });
return this;
},
error: function(callback) {
errorCall = callback;
} }
}; };
}, },
// recognize: recognize,
recognizePriority: -1 recognizePriority: -1
}; };
});
} ); \ No newline at end of file
\ No newline at end of file
KityMinder.registerProtocal( "plain", function () { KityMinder.registerProtocal('plain', function() {
var LINE_ENDING = '\n', var LINE_ENDING = '\n',
TAB_CHAR = '\t'; TAB_CHAR = '\t';
function repeat( s, n ) { function repeat(s, n) {
var result = ""; var result = '';
while ( n-- ) result += s; while (n--) result += s;
return result; return result;
} }
function encode( json, level ) { function encode(json, level) {
var local = ""; var local = '';
level = level || 0; level = level || 0;
local += repeat( TAB_CHAR, level ); local += repeat(TAB_CHAR, level);
local += json.data.text + LINE_ENDING; local += json.data.text + LINE_ENDING;
if ( json.children ) { if (json.children) {
json.children.forEach( function ( child ) { json.children.forEach(function(child) {
local += encode( child, level + 1 ); local += encode(child, level + 1);
} ); });
} }
return local; return local;
} }
function isEmpty( line ) { function isEmpty(line) {
return !/\S/.test( line ); return !/\S/.test(line);
} }
function getLevel( line ) { function getLevel(line) {
var level = 0; var level = 0;
while ( line.charAt( level ) === TAB_CHAR ) level++; while (line.charAt(level) === TAB_CHAR) level++;
return level; return level;
} }
function getNode( line ) { function getNode(line) {
return { return {
data: { data: {
text: line.replace( new RegExp( '^' + TAB_CHAR + '*' ), '' ) text: line.replace(new RegExp('^' + TAB_CHAR + '*'), '')
} }
}; };
} }
function decode( local ) { function decode(local) {
var json, var json,
parentMap = {}, parentMap = {},
lines = local.split( LINE_ENDING ), lines = local.split(LINE_ENDING),
line, level, node; line, level, node;
function addChild( parent, child ) { function addChild(parent, child) {
var children = parent.children || ( parent.children = [] ); var children = parent.children || (parent.children = []);
children.push( child ); children.push(child);
} }
for ( var i = 0; i < lines.length; i++ ) { for (var i = 0; i < lines.length; i++) {
line = lines[ i ]; line = lines[i];
if ( isEmpty( line ) ) continue; if (isEmpty(line)) continue;
level = getLevel( line ); level = getLevel(line);
node = getNode( line ); node = getNode(line);
if ( level === 0 ) { if (level === 0) {
if ( json ) { if (json) {
throw new Error( 'Invalid local format' ); throw new Error('Invalid local format');
} }
json = node; json = node;
} else { } else {
if ( !parentMap[ level - 1 ] ) { if (!parentMap[level - 1]) {
throw new Error( 'Invalid local format' ); throw new Error('Invalid local format');
} }
addChild( parentMap[ level - 1 ], node ); addChild(parentMap[level - 1], node);
} }
parentMap[ level ] = node; parentMap[level] = node;
} }
return json; return json;
} }
var lastTry, lastResult; var lastTry, lastResult;
function recognize( local ) { function recognize(local) {
if ( !Utils.isString( local ) ) return false; if (!Utils.isString(local)) return false;
lastTry = local; lastTry = local;
try { try {
lastResult = decode( local ); lastResult = decode(local);
} catch ( e ) { } catch (e) {
lastResult = null; lastResult = null;
} }
return !!lastResult; return !!lastResult;
} }
return { return {
fileDescription: '大纲文本', fileDescription: '大纲文本',
fileExtension: '.txt', fileExtension: '.txt',
mineType: 'text/plain', mineType: 'text/plain',
encode: function ( json ) { encode: function(json) {
return encode( json, 0 ); return encode(json, 0);
}, },
decode: function ( local ) { decode: function(local) {
if ( lastTry == local && lastResult ) { if (lastTry == local && lastResult) {
return lastResult; return lastResult;
} }
return decode( local ); return decode(local);
}, },
recognize: recognize, recognize: recognize,
recognizePriority: -1 recognizePriority: -1
}; };
} ); });
\ No newline at end of file \ No newline at end of file
/* /*
http://www.xmind.net/developer/ http://www.xmind.net/developer/
Parsing XMind file Parsing XMind file
XMind files are generated in XMind Workbook (.xmind) format, an open format
XMind files are generated in XMind Workbook (.xmind) format, an open format that is based on the principles of OpenDocument. It consists of a ZIP compressed archive containing separate XML documents for content and styles, a .jpg image file for thumbnails, and directories for related attachments. that is based on the principles of OpenDocument. It consists of a ZIP
compressed archive containing separate XML documents for content and styles,
a .jpg image file for thumbnails, and directories for related attachments.
*/ */
KityMinder.registerProtocal( 'xmind', function () { KityMinder.registerProtocal('xmind', function() {
// 标签 map // 标签 map
var markerMap = { var markerMap = {
'priority-1' : ['PriorityIcon', 1] 'priority-1': ['priority', 1],
,'priority-2' : ['PriorityIcon', 2] 'priority-2': ['priority', 2],
,'priority-3' : ['PriorityIcon', 3] 'priority-3': ['priority', 3],
,'priority-4' : ['PriorityIcon', 4] 'priority-4': ['priority', 4],
,'priority-5' : ['PriorityIcon', 5] 'priority-5': ['priority', 5],
'priority-6': ['priority', 6],
,'task-start' : ['ProgressIcon', 1] 'priority-7': ['priority', 7],
,'task-quarter' : ['ProgressIcon', 2] 'priority-8': ['priority', 8],
,'task-half' : ['ProgressIcon', 3]
,'task-3quar' : ['ProgressIcon', 4] 'task-start': ['progress', 1],
,'task-done' : ['ProgressIcon', 5] 'task-oct': ['progress', 2],
'task-quarter': ['progress', 3],
,'task-oct' : null 'task-3oct': ['progress', 4],
,'task-3oct' : null 'task-half': ['progress', 5],
,'task-5oct' : null 'task-5oct': ['progress', 6],
,'task-7oct' : null 'task-3quar': ['progress', 7],
'task-7oct': ['progress', 8],
'task-done': ['progress', 9]
}; };
function getAttachedNode( arr ){ return {
for (var i = 0; i < arr.length; i++) { fileDescription: 'xmind格式文件',
if( arr[ i ].type == "attached" ) fileExtension: '.xmind',
return arr[ i ]
} decode: function(local) {
} var successCall, errorCall;
function processTopic(topic, obj){
function processTopic(topic, obj) {
//处理文本 //处理文本
obj.data = { text : topic.title }; obj.data = {
text: topic.title
};
// 处理标签 // 处理标签
if(topic.marker_refs && topic.marker_refs.marker_ref){ if (topic.marker_refs && topic.marker_refs.marker_ref) {
var markers = topic.marker_refs.marker_ref; var markers = topic.marker_refs.marker_ref;
if( markers.length && markers.length > 0 ){ if (markers.length && markers.length > 0) {
for (var i in markers) { for (var i in markers) {
var type = markerMap[ markers[i]['marker_id'] ]; var type = markerMap[markers[i]['marker_id']];
type && (obj.data[ type[0] ] = type[1]); type && (obj.data[type[0]] = type[1]);
} }
}else{ } else {
var type = markerMap[ markers['marker_id'] ]; var type = markerMap[markers['marker_id']];
type && (obj.data[ type[0] ] = type[1]); type && (obj.data[type[0]] = type[1]);
} }
} }
// 处理超链接 // 处理超链接
if(topic['xlink:href']){ if (topic['xlink:href']) {
obj.data.hyperlink = topic['xlink:href']; obj.data.hyperlink = topic['xlink:href'];
} }
//处理子节点 //处理子节点
var topics; var topics = topic.children && topic.children.topics;
if( topic.children && (topics=topic.children.topics) && ( topics.topic || (utils.isArray( topics ) && topics.length>0) ) ){ var subTopics = topics && (topics.topic || topics[0] && topics[0].topic);
var tmp = topics.topic || (getAttachedNode( topics )).topic; if (subTopics) {
if( tmp.length && tmp.length > 0 ){ //多个子节点 var tmp = subTopics;
if (tmp.length && tmp.length > 0) { //多个子节点
obj.children = []; obj.children = [];
for(var i in tmp){ for (var i in tmp) {
obj.children.push({}); obj.children.push({});
processTopic(tmp[i], obj.children[i]); processTopic(tmp[i], obj.children[i]);
} }
}else{ //一个子节点 } else { //一个子节点
obj.children = [{}]; obj.children = [{}];
processTopic(tmp, obj.children[0]); processTopic(tmp, obj.children[0]);
} }
} }
} }
function xml2km(xml){ function xml2km(xml) {
var json = $.xml2json(xml); var json = $.xml2json(xml);
var result = {}; var result = {};
var sheet = json.sheet; var sheet = json.sheet;
...@@ -88,8 +93,8 @@ KityMinder.registerProtocal( 'xmind', function () { ...@@ -88,8 +93,8 @@ KityMinder.registerProtocal( 'xmind', function () {
return result; return result;
} }
function onerror(){ function onerror() {
km.fire('unziperror'); errorCall('ziperror');
} }
function getEntries(file, onend) { function getEntries(file, onend) {
...@@ -97,34 +102,31 @@ KityMinder.registerProtocal( 'xmind', function () { ...@@ -97,34 +102,31 @@ KityMinder.registerProtocal( 'xmind', function () {
zipReader.getEntries(onend); zipReader.getEntries(onend);
}, onerror); }, onerror);
} }
return {
fileDescription: 'xmind格式文件',
fileExtension: '.xmind',
decode: function ( local ) {
return { return {
then : function(local, callback){ then: function(callback) {
getEntries( local, function( entries ) { getEntries(local, function(entries) {
var hasMainDoc = false; var hasMainDoc = false;
entries.forEach(function( entry ) { entries.forEach(function(entry) {
if(entry.filename == 'content.xml'){ if (entry.filename == 'content.xml') {
hasMainDoc = true; hasMainDoc = true;
entry.getData(new zip.TextWriter(), function(text) { entry.getData(new zip.TextWriter(), function(text) {
try{ try {
var km = xml2km($.parseXML(text)); var km = xml2km($.parseXML(text));
callback && callback( km ); callback && callback(km);
}catch(e){ } catch (e) {
km.fire('parseerror'); errorCall && errorCall('parseerror');
} }
}); });
} }
}); });
!hasMainDoc && km.fire('parseerror'); !hasMainDoc && errorCall && errorCall('parseerror');
}); });
return this;
},
error: function(callback) {
errorCall = callback;
} }
}; };
...@@ -133,6 +135,4 @@ KityMinder.registerProtocal( 'xmind', function () { ...@@ -133,6 +135,4 @@ KityMinder.registerProtocal( 'xmind', function () {
recognizePriority: -1 recognizePriority: -1
}; };
} ); });
\ No newline at end of file
...@@ -114,6 +114,7 @@ button#tool-btn { ...@@ -114,6 +114,7 @@ button#tool-btn {
#panel button#tool-btn { #panel button#tool-btn {
padding-right: 20px; padding-right: 20px;
position: relative; position: relative;
overflow: visible;
} }
#panel button#tool-btn.active:before { #panel button#tool-btn.active:before {
...@@ -273,9 +274,17 @@ svg, body { ...@@ -273,9 +274,17 @@ svg, body {
transition: all ease .3s 0.3s; transition: all ease .3s 0.3s;
-webkit-transform: translate(100%); -webkit-transform: translate(100%);
-moz-transform: translate(100%);
-ms-transform: translate(100%);
-o-transform: translate(100%);
transform: translate(100%);
} }
#about:hover { #about:hover, #about:hover #km-cat {
-webkit-transform: translate(0); -webkit-transform: translate(0);
-moz-transform: translate(0);
-ms-transform: translate(0);
-o-transform: translate(0);
transform: translate(0);
} }
#about a { #about a {
color: #eee; color: #eee;
...@@ -286,11 +295,12 @@ svg, body { ...@@ -286,11 +295,12 @@ svg, body {
top: 5px; top: 5px;
transition: all ease 1.3s 0.3s; transition: all ease 1.3s 0.3s;
-webkit-transform: translate(-60px, 0); -webkit-transform: translate(-60px, 0);
-moz-transform: translate(-60px, 0);
-ms-transform: translate(-60px, 0);
-o-transform: translate(-60px, 0);
transform: translate(-60px, 0);
cursor: pointer; cursor: pointer;
} }
#about:hover #km-cat {
-webkit-transform: translate(0);
}
#about #cat-face { #about #cat-face {
fill: #393F4F; fill: #393F4F;
} }
......
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