@@ -18,10 +18,10 @@ define(['jquery', 'jqueryUI', 'config', 'handlebars', 'text!templates/tyto/colum
1818 return new tyto ( ) ;
1919 }
2020 config = options !== undefined ? options : config ;
21- this . config = config ;
21+ this . config = window . localStorage . tyto !== undefined ? JSON . parse ( window . localStorage . tyto ) : config ;
2222 this . modals = { } ;
2323 this . undo = { } ;
24- this . _autoSave = config . autoSave ;
24+ this . _autoSave = this . config . autoSave ;
2525 this . _bindPageEvents ( ) ;
2626 if ( config . showIntroModalOnLoad && config . introModalId ) {
2727 this . modals . introModal = $ ( '#' + config . introModalId ) ;
@@ -157,8 +157,6 @@ define(['jquery', 'jqueryUI', 'config', 'handlebars', 'text!templates/tyto/colum
157157 } ) ;
158158 } ;
159159 if ( window . localStorage && window . localStorage . tyto ) {
160- tyto . config = JSON . parse ( window . localStorage . tyto ) ;
161- tyto . _loadBarnJSON ( JSON . parse ( window . localStorage . tyto ) ) ;
162160 setUpLS ( ) ;
163161 } else if ( window . localStorage ) {
164162 $ ( '#cookie-banner' ) . removeClass ( 'hide' ) . find ( '[data-action="cookie-close"]' ) . on ( 'click' , function ( e ) {
@@ -471,10 +469,11 @@ define(['jquery', 'jqueryUI', 'config', 'handlebars', 'text!templates/tyto/colum
471469 $ ( '[data-action="toggleautosave"] i' ) . toggleClass ( 'fa-check-square-o fa-square-o' ) ;
472470 tyto . _autoSave = ! tyto . _autoSave ;
473471 if ( tyto . _autoSave ) {
474- return tyto . notify ( 'auto-save: ON' , 2000 ) ;
472+ tyto . notify ( 'auto-save: ON' , 2000 ) ;
475473 } else {
476- return tyto . notify ( 'auto-save: OFF' , 2000 ) ;
474+ tyto . notify ( 'auto-save: OFF' , 2000 ) ;
477475 }
476+ return window . localStorage . setItem ( 'tyto' , JSON . stringify ( tyto . _createBarnJSON ( ) ) ) ;
478477 } ;
479478 tyto . prototype . _resizeColumns = function ( ) {
480479 var correctWidth ;
@@ -510,10 +509,12 @@ define(['jquery', 'jqueryUI', 'config', 'handlebars', 'text!templates/tyto/colum
510509 items = [ ] ;
511510 columnitems = $ ( column ) . find ( '.tyto-item' ) ;
512511 $ . each ( columnitems , function ( index , item ) {
512+ var isCollapsed ;
513+ isCollapsed = item . querySelector ( '.action-icons .collapser' ) . className . indexOf ( 'plus' ) !== - 1 ? true : false ;
513514 return items . push ( {
514515 content : item . querySelector ( '.tyto-item-content' ) . innerHTML . toString ( ) . trim ( ) ,
515516 title : item . querySelector ( '.tyto-item-title' ) . innerHTML . toString ( ) . trim ( ) ,
516- collapsed : item . querySelector ( '.action-icons .collapser' ) . className . contains ( 'plus' )
517+ collapsed : isCollapsed
517518 } ) ;
518519 } ) ;
519520 return itemboardJSON . columns . push ( {
0 commit comments