@@ -14,14 +14,14 @@ var FilesMindMap = {
14
14
var self = this ;
15
15
if ( ! Array . isArray ( objs ) ) {
16
16
objs = [ objs ] ;
17
- } ;
17
+ }
18
18
objs . forEach ( function ( obj ) {
19
19
self . _extensions . push ( obj ) ;
20
20
} ) ;
21
21
} ,
22
22
23
23
getExtensionByMime : function ( mime ) {
24
- for ( i = 0 ; i < this . _extensions . length ; i ++ ) {
24
+ for ( var i = 0 ; i < this . _extensions . length ; i ++ ) {
25
25
var obj = this . _extensions [ i ] ;
26
26
if ( obj . mimes . indexOf ( mime ) >= 0 ) {
27
27
return obj ;
@@ -159,9 +159,9 @@ var FilesMindMap = {
159
159
return ;
160
160
}
161
161
162
- plugin . encode ( data ) . then ( function ( data ) {
162
+ plugin . encode ( data ) . then ( function ( data2 ) {
163
163
var putObject = {
164
- filecontents : data ,
164
+ filecontents : data2 ,
165
165
path : path
166
166
} ;
167
167
@@ -296,6 +296,7 @@ var FilesMindMap = {
296
296
if ( context . dir === '/' ) {
297
297
fullName = '/' + fileName ;
298
298
}
299
+ this . _file . fullName = fullName ;
299
300
this . show ( ) ;
300
301
} ,
301
302
@@ -468,9 +469,9 @@ FilesMindMap.Extensions.XMind = {
468
469
if ( tmp . length && tmp . length > 0 ) { //多个子节点
469
470
obj . children = [ ] ;
470
471
471
- for ( var i in tmp ) {
472
+ for ( var ii in tmp ) {
472
473
obj . children . push ( { } ) ;
473
- this . processTopic ( tmp [ i ] , obj . children [ i ] ) ;
474
+ this . processTopic ( tmp [ ii ] , obj . children [ ii ] ) ;
474
475
}
475
476
476
477
} else { //一个子节点
@@ -495,7 +496,7 @@ FilesMindMap.Extensions.XMind = {
495
496
if ( contentFile != null ) {
496
497
contentFile . async ( 'text' ) . then ( function ( text ) {
497
498
try {
498
- json = self . toKm ( text ) ;
499
+ var json = self . toKm ( text ) ;
499
500
resolve ( json ) ;
500
501
} catch ( e ) {
501
502
reject ( e ) ;
@@ -544,8 +545,6 @@ FilesMindMap.Util = {
544
545
if ( ! node ) return null ;
545
546
var self = this ;
546
547
var txt = '' , obj = null , att = null ;
547
- var nt = node . nodeType , nn = this . jsVar ( node . localName || node . nodeName ) ;
548
- var nv = node . text || node . nodeValue || '' ;
549
548
550
549
if ( node . childNodes ) {
551
550
if ( node . childNodes . length > 0 ) {
@@ -561,7 +560,7 @@ FilesMindMap.Util = {
561
560
else if ( cnt == 3 || cnt == 4 || ! cnn ) {
562
561
if ( cnv . match ( / ^ \s + $ / ) ) {
563
562
return ;
564
- } ;
563
+ }
565
564
txt += cnv . replace ( / ^ \s + / , '' ) . replace ( / \s + $ / , '' ) ;
566
565
} else {
567
566
obj = obj || { } ;
@@ -574,11 +573,11 @@ FilesMindMap.Util = {
574
573
obj [ cnn ] . push ( self . parseNode ( cn , true ) ) ;
575
574
} else {
576
575
obj [ cnn ] = self . parseNode ( cn ) ;
577
- } ;
578
- } ;
576
+ }
577
+ }
579
578
} ) ;
580
- } ;
581
- } ;
579
+ }
580
+ }
582
581
if ( node . attributes && node . tagName != 'title' ) {
583
582
if ( node . attributes . length > 0 ) {
584
583
att = { } ; obj = obj || { } ;
@@ -588,27 +587,25 @@ FilesMindMap.Util = {
588
587
att [ atn ] = atv ;
589
588
if ( obj [ atn ] ) {
590
589
obj [ cnn ] = this . toArray ( obj [ cnn ] ) ;
591
-
592
590
obj [ atn ] [ obj [ atn ] . length ] = atv ;
593
- obj [ atn ] . length = obj [ atn ] . length ;
594
591
}
595
592
else {
596
593
obj [ atn ] = atv ;
597
- } ;
594
+ }
598
595
} ) ;
599
- } ;
600
- } ;
596
+ }
597
+ }
601
598
if ( obj ) {
602
599
obj = Object . assign ( { } , ( txt != '' ? new String ( txt ) : { } ) , obj || { } ) ;
603
600
txt = ( obj . text ) ? ( [ obj . text || '' ] ) . concat ( [ txt ] ) : txt ;
604
601
if ( txt ) obj . text = txt ;
605
602
txt = '' ;
606
- } ;
603
+ }
607
604
var out = obj || txt ;
608
605
return out ;
609
606
} ,
610
607
parseXML : function ( xml ) {
611
- root = ( xml . nodeType == 9 ) ? xml . documentElement : xml ;
608
+ var root = ( xml . nodeType == 9 ) ? xml . documentElement : xml ;
612
609
return this . parseNode ( root , true ) ;
613
610
} ,
614
611
xml2json : function ( str ) {
0 commit comments