Index: branches/testa/js/bookmark.js
===================================================================
--- branches/testa/js/bookmark.js	(revision 24)
+++ branches/testa/js/bookmark.js	(revision 25)
@@ -3,13 +3,9 @@
 	this.path = path
 	if( display_name == null ){
-	    this.display_name = path.substr(0, max_display_name_length)
+	    this.display_name = path.substr(-max_display_name_length )
 	}
 	else{
-	    this.display_name = display_name
+	    this.display_name = display_name.substr( -max_display_name_length )
 	}
     }
-
-    display_name() {
-	return this.display_name
-    }
 }
Index: branches/testa/js/bookmarkmgr.js
===================================================================
--- branches/testa/js/bookmarkmgr.js	(revision 24)
+++ branches/testa/js/bookmarkmgr.js	(revision 25)
@@ -6,5 +6,5 @@
     }
 
-    add( path , display_name ){
+    add( path , display_name = null){
 	let result = this.paths.indexOf( path )
 	if( result < 0 ){
@@ -21,4 +21,13 @@
 	    delete this.paths[ result ]
 	}
+    }
+
+    get( path ){
+	let ret = null
+	let result = this.paths.indexOf( path )
+	if( result >= 0 ){
+	    ret = this.items[ path ]
+	}
+	return ret
     }
 
@@ -46,3 +55,11 @@
 	return path.substr( -this.max_display_name_length )
     }
+
+    get_items() {
+	return this.items
+    }
+
+    max_display_name_length(){
+	return this.max_display_name_length
+    }
 }
Index: branches/testa/js/main.js
===================================================================
--- branches/testa/js/main.js	(revision 24)
+++ branches/testa/js/main.js	(revision 25)
@@ -1,24 +1,62 @@
 let Globalx = {};
+let GlobalxInitValue = {
+    editor: null,
+    key_indicate_file: false,
+    key: '/'
+};
 
 function main() {
-      Globalx.num = 0;
-      Globalx.index = 0;
-      Globalx.parts = ["data", "output", "setting"]
+    restore_info_to_globalx()
 
-      Globalx.parts.map( function( value ){
-	  set_globalx_editor(value)
-      } )
-      editor_func("data");
-      make_ul_for_menu('data' , '#data-side')
-      menux( "data" )
+    editor_func("data");
+    make_ul_for_menu('data' , '#data-side')
+    menux( "data" )
+    
+    editor_func("setting");
+    make_ul_for_menu("setting" , '#setting-side')
+    
+    editor_func("output");
+    make_ul_for_menu("output" , '#output-side')
 
-      $('#down-download').on('click', {part: "data"}, handleDownload)
-      $( Globalx['data'].textarea_sel ).val("");
+    tab_init()
+    topmenu_init()
 
-      editor_func("setting");
-      make_ul_for_menu("setting" , '#setting-side')
+    rebuild_bookmark_menu("data")
 
-      editor_func("output");
-      make_ul_for_menu("output" , '#output-side')
+    // LocalStorageにまだ保存していない場合を想定して、ここで保存しておく
+    console.log("call save_info_from_globalx()")
+    save_info_from_globalx()
+
+    part = "data"
+    $('#down-download').on('click', {part: part}, handleDownload)
+    $( Globalx['data'].textarea_sel ).val("");
+    $( '#bookmark_displayname' ).prop( 'maxlength' , Globalx[part].bookmark_displayname_max_length)
+    $('#bookmarkDlg').dialog({
+	autoOpen: false,
+	modal: true,
+	buttons: {
+	    "OK": function() {
+		part = Globalx.parts[ Globalx.index ]
+		path = $( '#bookmark_path' ).val()
+		displayname = $( '#bookmark_displayname' ).val()
+		register_bookmark_( part , path, displayname )
+		$(this).dialog("close")},
+	    "Cancel": function() {
+		bookmark_cb.prop('checked', false)
+		$(this).dialog("close")
+	    }
+	}
+    }) 
+}
+
+function init_globalx() {
+    Globalx.num = 0;
+    Globalx.index = 0;
+    Globalx.parts = ["data", "output", "setting"]
+    
+    Globalx.parts.map( function( part ){
+	console.log("init_globalx part=" + part )
+	set_globalx_editor(part)
+    } )
 }
 
@@ -46,25 +84,8 @@
       Globalx[part].bookmark_mgr = new BookmarkMgr( Globalx[part].bookmark_displayname_max_length )
 
-      $( '#bookmark_displayname' ).prop( 'maxlength' , Globalx[part].bookmark_displayname_max_length)
-	  $('#bookmarkDlg').dialog({
-	      autoOpen: false,
-	      modal: true,
-	      buttons: {
-		  "OK": function() {
-		      part = Globalx.parts[ Globalx.index ]
-
-		      Globalx[part].bookmark_mgr.add( $( '#bookmark_path' ).val() , $( '#bookmark_displayname' ).val() )
-		      $(this).dialog("close")},
-		  "Cancel": function() {
-		      $(this).dislog("close")
-		  }
-	      }
-	  }) 
 }
 
 function editor_func(part) {
-    console.log(`Globalx[#{name}].editor_id=` + Globalx[part].editor_id )
       let editor = ace.edit( Globalx[part].editor_id )
-    console.log( editor )
       editor.setTheme("ace/theme/monokai");
       editor.setFontSize(14);
@@ -74,5 +95,4 @@
       Globalx[part].editor = editor;
       let textarea = $( Globalx[part].textarea_sel );
-    console.log( "textarea=" + textarea )
       Globalx[part].textarea = textarea;
       editor.getSession().on("change", function () {
@@ -81,3 +101,2 @@
 }
 
-main()
Index: branches/testa/js/menux.js
===================================================================
--- branches/testa/js/menux.js	(revision 24)
+++ branches/testa/js/menux.js	(revision 25)
@@ -12,4 +12,8 @@
 
 function menu_action( part, item_name , up_flag = false ) {
+    if( Globalx[part].key != '/' ){
+	
+    }
+
     let realData = get_filelist( Globalx.num )
     Globalx[part].key_indicate_file = false;
@@ -121,9 +125,7 @@
 function bookmark_op(part) {
     if( $( Globalx[part].bookmark_op_sel ).is(':checked') == true ){
-	console.log( Globalx[part].key +" add_bookmark" )
 	add_bookmark(part)
     }
     else{
-	console.log( Globalx[part].key +" remove_bookmark")
 	remove_bookmark(part)
     }
@@ -131,10 +133,12 @@
 
 function add_bookmark( part ) {
-    Globalx[part].bookmark_mgr.add( Globalx[part].key )
-    rebuild_bookmark_menu( part )
     $( '#bookmark_displayname' ).val( Globalx[part].bookmark_mgr.get_restricted_display_name( Globalx[part].key ) )
     $( '#bookmark_path' ).val( Globalx[part].key )
     $('#bookmarkDlg').dialog("open")
-    
+}
+
+function register_bookmark_( part , path, displayname ) {
+    Globalx[part].bookmark_mgr.add( path , displayname )
+    rebuild_bookmark_menu( part )
 }
 
@@ -162,4 +166,8 @@
 	return
     }
+    if(key === Globalx[part].key){
+	return
+    }
+
     let realData = get_filelist( Globalx.num )
     Globalx[part].key = key
@@ -176,5 +184,15 @@
 	});
     }
+    else{
+	Globalx[part].key_indicate_file = false
+	Globalx[part].editor.getSession().setValue( "" );
+	$( Globalx[part].textarea_sel ).val( "" );
+    }
     const bookmark_cb = $( Globalx[part].bookmark_op_sel )
     bookmark_cb.prop('checked', true)
+
+    $( Globalx[part].menu_sel ).empty()
+
+    make_menu_item_list(part, realData)
 }
+
Index: branches/testa/js/remote.js
===================================================================
--- branches/testa/js/remote.js	(revision 24)
+++ branches/testa/js/remote.js	(revision 25)
@@ -78,5 +78,4 @@
 
 function get_content(path , func) {
-    console.log( "path:" + path )
     let param_array = [['cmd', 'get_content'], ['num', Globalx.num ], ['path', path]];
     let params = make_url_params( param_array );
@@ -88,26 +87,7 @@
 }
 
-//
-//
-function restore_filelist(num, key){
-    const data = get_filelist(num);
-    if( data !== null ){
-//	display_filelist( data, '#filelist' );
-//	console.log( data['/'] );
-//	console.log( data['/rtk'] );
-//	console.log( data['/rtk/fmp_kernel'] );
-//	console.log( data['/rtk/fmp_kernel/data'] );
-//	console.log( data['/rtk/fmp_kernel/data/fmp-kernel.md'] );
-	console.log( data[key] );
-    }
-    else{
-	console.log("null returned!");
-    }
-}
 function handleDownload(e) {
     let dl = document.getElementById("down-download")
     if( Globalx[ e.data.part ].key_indicate_file === true ){
-	console.log("handleDownload-file")
-	console.log(Globalx[ e.data.part ])
 
 	get_content( Globalx[ e.data.part ].key , function(content) {
@@ -116,11 +96,8 @@
 	    if (window.navigator.msSaveBlob) { 
 		window.navigator.msSaveBlob(blob, Globalx[ e.data.part ].item_name); 
-		console.log("handleDownload=" + Globalx[ e.data.part ].item_name)
 		
 		// msSaveOrOpenBlobの場合はファイルを保存せずに開ける
 		window.navigator.msSaveOrOpenBlob(blob, Globalx[ e.data.part ].item_name); 
 	    } else {
-		console.log( "handleDownLoad-1-2" )
-		console.log("handleDownload=" + Globalx[ e.data.part ].item_name)
 		dl.download = Globalx[ e.data.part ].item_name
 		dl.href = window.URL.createObjectURL(blob);
@@ -130,5 +107,4 @@
     else{
 	e.preventDefault()
-	console.log("handleDownload-Not file")
 	dl.href = ""
 	dl.download = ""
@@ -138,9 +114,5 @@
 function download_cmd(part) {
     if( Globalx[part].key_indicate_file === true ){
-	console.log("download_cmd filename=" + Globalx[part].filename)
-
 	let dl = $( Globalx[part].download_sel )
-
-	console.log( dl.attr('download') )
 	dl.trigger('click')
     }
Index: branches/testa/js/storage.js
===================================================================
--- branches/testa/js/storage.js	(revision 24)
+++ branches/testa/js/storage.js	(revision 25)
@@ -1,3 +1,122 @@
 let _globalStorage = {}
+
+const _items = ["num", "index", "parts"]
+
+function storage_test(){
+    console.log(_items);
+}
+
+function save_info_from_globalx(){
+    save_info_from_globalx_with_items(_items)
+}
+
+function convert_to_array_from_bookmark_mgr(mgr){
+	return {
+	    paths: mgr.get_paths(),
+	    items: mgr_to_array(mgr),
+	    max_display_name_length: mgr.max_display_name_length()
+	}
+}
+
+function save_info_from_globalx_with_items(items){
+    let info = {}
+
+    copy_object( info, Globalx, items )
+    /*	
+	info.num = Globalx.num
+	info.index = Globalx.index
+	info.parts = Globalx.parts
+    */
+    Globalx.parts.map( function (part) {
+	save_info_from_globalx_part(info , part)
+    } )
+
+    save_info_to_local_storage(info)
+}
+function convert_to_plain_object_from_bookmark_mgr(mgr){
+//    console.log( "mgr=" + mgr )
+//    console.log( "mgr.items()=" + mgr.items )
+    const paths = mgr.get_paths()
+    const new_bk_items = paths.map( function( path ){
+	let ret = {
+	    path: "",
+	    display_name: ""
+	}
+	item = mgr.get(path)
+	if( item != null ){
+	    ret.path = path
+	    ret.display_name = item.display_name
+	}
+	return ret
+    } )
+
+    return {
+	max_display_name_length: mgr.max_display_name_length,
+	items: new_bk_items
+    }
+}
+
+function save_info_from_globalx_part(info, part){
+    info[part] = {}
+    copy_obj_with_part(info, Globalx, part)
+
+    info[part].bookmark_mgr = convert_to_plain_object_from_bookmark_mgr(Globalx[part].bookmark_mgr)
+}
+
+function copy_obj_with_part(to_obj, from_obj, part){
+/*    const items = ["editor_id", "editor", "textarea_sel" , "menu_id", "bookmark_id", "bookmark_op_id", "item_name", "bookmarks", "bookmark_displayname_max_length", "key_indicate_file", "key", "key_sel", "download_sel", "menu_sel", "bookmark_sel", "bookmark_op_sel", "bookmark_mgr" ]*/
+    const items = ["editor_id", "textarea_sel" , "menu_id", "bookmark_id", "bookmark_op_id", "item_name", "bookmarks", "bookmark_displayname_max_length", "key_sel", "download_sel", "menu_sel", "bookmark_sel", "bookmark_op_sel", "bookmark_mgr" ]
+    const init_value_items = ["editor", "key_indicate_file", "key"]
+
+    if( to_obj[part] === undefined ){
+	to_obj[part] = {}
+    }
+    copy_object( to_obj[part], from_obj[part], items )
+    copy_object( to_obj[part], GlobalxInitValue, init_value_items )
+}
+
+function copy_object( to_obj, from_obj, items ){
+    let x = null
+    items.map( function(item) {
+	x = from_obj[item]
+	to_obj[item] = x
+    } )
+}
+
+function restore_info_to_globalx(){
+    const info = restore_info()
+    if( info === undefined ){
+	console.log("call init_globalx()")
+	init_globalx()
+    }
+    else {
+	console.log("call restore_info_to_globalx_with_items")
+	restore_info_to_globalx_with_items(info, _items)
+    }
+}
+
+function convert_to_bookmark_mgr_from_plain_object(mgr) {
+    let new_mgr = new BookmarkMgr( mgr.max_display_name_length )
+    
+    const bk_items = mgr.items
+    bk_items.map( function(bk_item) {
+	return new_mgr.add( bk_item.path , bk_item.display_name)
+    })
+    return new_mgr
+}
+
+function restore_info_to_globalx_with_items(info, items){
+    
+    copy_object( Globalx, info, items )
+
+    info.parts.map( function (part) {
+	restore_info_to_globalx_part(info , part)
+    } )
+}
+
+function restore_info_to_globalx_part(info , part){
+    info[part].bookmark_mgr = convert_to_bookmark_mgr_from_plain_object(info[part].bookmark_mgr)
+    copy_obj_with_part(Globalx, info, part)
+}
 
 function save_info_to_local_storage(info){
@@ -18,11 +137,37 @@
 function get_filelist(num) {
     let num_s = num + ''
-    if( _globalStorage[num_s] === undefined ){
-	oldData = localStorage.getItem(num_s)
+    return restore_from_localstorage(num_s)
+}
+
+
+function restore_info(){
+    const item_name = "info"
+    return restore_from_localstorage(item_name)
+}
+
+function restore_from_localstorage(item_name){
+   if( _globalStorage[item_name] === undefined ){
+	oldData = localStorage.getItem(item_name)
 	if( oldData ){
-	    _globalStorage[num_s] = JSON.parse(oldData)
+	    _globalStorage[item_name] = JSON.parse(oldData)
 	}
     }
-    return _globalStorage[num_s]
+    return _globalStorage[item_name]
 }
 
+function reset_info(){
+    let item_name = 'info'
+    reset_localstorage(item_name)
+}
+
+function reset_localstorage(item_name){
+    delete _globalStorage[item_name]
+    localStorage.removeItem(item_name)
+}
+
+function clear_localstorage(){
+    let keys = Object.keys(_globalStorage)
+    keys.map( (v) => { delete _globalStorage[v] } )
+
+    localStorage.clear()
+}
Index: branches/testa/js/tab.js
===================================================================
--- branches/testa/js/tab.js	(revision 24)
+++ branches/testa/js/tab.js	(revision 25)
@@ -1,3 +1,3 @@
-jQuery(function($){
+function tab_init(){
     $('.tab').click(function(){
         $('.is-active').removeClass('is-active');
@@ -10,4 +10,4 @@
         // クリックしたタブと同じインデックス番号をもつコンテンツを表示
         $('.panel').eq(index).addClass('is-show');
-    });
-});
+    })
+}
Index: branches/testa/js/topmenu.js
===================================================================
--- branches/testa/js/topmenu.js	(revision 25)
+++ branches/testa/js/topmenu.js	(revision 25)
@@ -0,0 +1,20 @@
+function topmenu_init0() {
+    const nav = $('.nav');
+    $('li', nav)
+	.mouseover(function(e) {
+	    $('ul', this).stop().slideDown('fast');
+	})
+	.mouseout(function(e) {
+	    $('ul', this).stop().slideUp('fast');
+	})
+}
+function topmenu_init() {
+    const nav = $('.nav');
+    $('li', nav)
+	.mouseover(function(e) {
+	    $('ul', this).stop().show();
+	})
+	.mouseout(function(e) {
+	    $('ul', this).stop().hide();
+	})
+}
