Changeset 41 for branches/testa-single-bookmark/js/sidemenu.js
- Timestamp:
- Aug 30, 2019 7:54:52 AM (6 years ago)
- File:
-
- 1 edited
-
branches/testa-single-bookmark/js/sidemenu.js (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/testa-single-bookmark/js/sidemenu.js
r36 r41 12 12 } 13 13 14 async setup(top_sel){ 15 console.log("SideMenu setup menu_sel=" + this.menu_sel) 16 let content = `<ul id="${this.menu_id}"></ul>` 17 $(top_sel).append( content ) 18 this.get_filelist_async( this.num , this.part , (text) => { 19 console.log("SideMenu setup text=" + text) 20 let str = text 21 let obj 22 if( str.match( /{.*}/ ) === null ){ 23 obj = {} 24 console.log("sidemenu setup 1 num=" + this.num + " part=" + this.part) 25 } 26 else { 27 obj = JSON.parse( str ) 28 console.log("sidemenu setup 2 num=" + this.num + " part=" + this.part + " str="+str) 29 } 30 console.log( "sidemenu setup this.num=" + this.num + " this.part=" + this.part ) 31 Globalx.storagex.change_cache( obj, this.num , this.part ) 32 33 this.make_menu_item_list( obj , Globalx[this.part].key) 34 $( this.menu_sel ).menu({ 14 display_menu( text ) { 15 let str = text 16 let obj 17 if( str.match( /{.*}/ ) === null ){ 18 console.log("sidemenu 1 num="+ this.num + " part="+ this.part +" str="+str) 19 obj = {} 20 } 21 else { 22 console.log("sidemenu 2 num="+ this.num +" part="+ this.part +" str="+str) 23 obj = JSON.parse( str ) 24 } 25 Globalx.storagex.change_cache( obj, this.num , this.part ) 26 27 this.setup_menu(obj) 28 } 29 30 setup_menu(obj){ 31 this.make_menu_item_list( obj , Globalx[this.part].key) 32 if( Globalx[this.part].menu === null ){ 33 Globalx[this.part].menu = $( this.menu_sel ).menu({ 35 34 classes: { 36 35 "ui-menu": "highlight" 37 36 } 38 37 }) 39 }) 38 } 39 } 40 41 menu_init( top_sel ){ 42 $( top_sel ).empty() 43 let content = `<ul id="${this.menu_id}"></ul>` 44 $( top_sel ).append( content ) 45 } 46 47 async setup( top_sel ){ 48 this.menu_init( top_sel ) 49 this.get_filelist_async( this.num , this.part , (text) => { 50 this.display_menu(text) 51 } ) 52 } 53 54 async update( top_sel ){ 55 this.menu_init( top_sel ) 56 await Globalx.remotex.update_filelist( this.num, this.part, (text) => { 57 this.display_menu(text) 58 } ) 40 59 } 41 60 42 61 async get_filelist_async( num , part , func){ 43 if( part == "setting" ){44 console.log( "get_filelist_async START part="+ part)45 }46 62 let realData = Globalx.storagex.get_filelist( num , part ) 47 63 48 if( part == "setting" ){49 console.log( "get_filelist_async 2 part=" + part)50 }51 64 if( realData === undefined || realData === null ){ 52 if( part == "setting" ){53 console.log( "get_filelist_async 3 part=" + part)54 }55 65 await Globalx.remotex.get_filelist_from_remote( num, part, func ) 56 if( part == "setting" ){57 console.log( "get_filelist_async 4 part=" + part)58 }59 66 } 60 67 else{ 61 68 const obj = Globalx.storagex.get_filelist( num , part ) 62 this.make_menu_item_list( obj , Globalx[this.part].key) 63 $( this.menu_sel ).menu({ 64 classes: { 65 "ui-menu": "highlight" 66 } 67 }) 69 this.setup_menu( obj ) 68 70 } 69 71 } … … 121 123 if( jsondata[Globalx[part].key].length == 0 ){ 122 124 Globalx[part].key_indicate_file = true; 125 console.log("Globalx[" + part + "].key_indicate_file = " + Globalx[part].key_indicate_file) 123 126 let url = "" 124 127 $( Globalx[part].download_url_sel ).val( Globalx[part].key ) … … 128 131 $( Globalx[part].download_partial_url_sel ).attr('href' , url ) 129 132 Globalx.remotex.get_content( this.num, this.part, Globalx[part].key , (content) => { 130 //console.log("content=" + content)131 133 Globalx[part].editor.getSession().setValue( content ); 132 134 $( Globalx[part].textarea_sel ).val( content ); … … 143 145 let name = '..(Up)' 144 146 content = `<li class="ui-menu-item"><div class="ui-menu-item-wrapper hasmenu">${name}</div></li>`; 145 // content = `<li class="ui-menu-item"><div class="ui-menu-item-wrapper hasmenu" onclick="menu_action( '${this.part}', '${this.name}', true)">${name}</div></li>`;146 // content = `<li class="ui-menu-item"><div class="ui-menu-item-wrapper hasmenu" onclick="this.menu_action_2">${name}</div></li>`;147 147 $( this.menu_sel ).append(content); 148 item = $( this.menu_sel ). last()148 item = $( this.menu_sel ).children().last() 149 149 item.on('click' , () => { 150 150 this.menu_action( key , true ) … … 154 154 ary.map( ( item_name ) => { 155 155 content = `<li class="ui-menu-item"><div class="ui-menu-item-wrapper hasmenu">${item_name}</div></li>`; 156 // content = `<li class="ui-menu-item"><div class="ui-menu-item-wrapper hasmenu" onclick="menu_action( '${this.part}', '${item_name}' , false)">${item_name}</div></li>`;157 // content = `<li class="ui-menu-item"><div class="ui-menu-item-wrapper hasmenu" onclick="this.menu_action_2">${item_name}</div></li>`;158 156 $( this.menu_sel ).append(content); 159 item = $( this.menu_sel ). last()157 item = $( this.menu_sel ).children().last() 160 158 item.on('click' , () => { 161 159 this.menu_action( item_name ) … … 165 163 } 166 164 167 set_globalx_item_name( item_name ) {168 Globalx[ this.part].item_name = item_name169 let dl = $( Globalx[ this.part ].download_sel )170 dl.attr('download' , Globalx[ this.part].item_name)165 set_globalx_item_name( part , item_name ) { 166 Globalx[part].item_name = item_name 167 let dl = $( Globalx[ part ].download_sel ) 168 dl.attr('download' , Globalx[part].item_name) 171 169 dl.removeAttr('href') 172 170 } … … 190 188 } 191 189 192 /*193 function menu_action(part, item_name , up_flag = false) {194 Globalx[part].sidemenu.menu_action(item_name , up_flag)195 }196 */
Note: See TracChangeset
for help on using the changeset viewer.
![(trac.ini の [header_logo] セクションを設定してください)](/python/trac/Flist/chrome/common/trac_logo_mini.png)