Changeset 67 for branches/testa-single-bookmark/js
- Timestamp:
- Sep 5, 2019 9:42:27 AM (6 years ago)
- Location:
- branches/testa-single-bookmark/js
- Files:
-
- 4 edited
-
build.js (modified) (3 diffs)
-
main.js (modified) (2 diffs)
-
remotex.js (modified) (1 diff)
-
sidemenu.js (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/testa-single-bookmark/js/build.js
r66 r67 1 1 class Build { 2 2 constructor(){ 3 }4 5 set_anchor_url( part, item_name, href, text , kind){6 if( href === undefined ){7 href = ""8 }9 Globalx.output_url_listx[text] = href10 Globalx[part].sidemenu.set_anchor_down_url( item_name, href, text , kind)11 3 } 12 4 … … 18 10 const content = textarea.val() 19 11 20 this.set_anchor_url( part, Globalx[part].item_name, "", "" , "full") 21 this.set_anchor_url( part, Globalx[part].item_name, "", "" , "partial") 12 let words = Globalx[part].item_name.split('.') 13 let base = words[0] 14 Globalx[part].sidemenu.set_anchor_url( part, base, "", "" , "full") 15 Globalx[part].sidemenu.set_anchor_url( part, base, "", "" , "partial") 22 16 23 17 Globalx.remotex.upload_file( cmd, Globalx.num, part, Globalx[part].key, content , (data) => { … … 27 21 console.log("partial_download_url=" + obj["partial_download_url"]) 28 22 29 this.set_anchor_url( part, Globalx[part].item_name, obj["full_download_url"], Globalx[part].item_name, "full")30 this.set_anchor_url( part, Globalx[part].item_name, obj["partial_download_url"], Globalx[part].item_name, "partial")23 Globalx[part].sidemenu.set_anchor_url( part, base, obj["full_download_url"], Globalx[part].item_name, "full") 24 Globalx[part].sidemenu.set_anchor_url( part, base, obj["partial_download_url"], Globalx[part].item_name, "partial") 31 25 } 32 26 else{ -
branches/testa-single-bookmark/js/main.js
r66 r67 45 45 } 46 46 47 function set_output_url_listx(text){ 48 if( text.match( /{.*}/ ) !== null ){ 49 const obj = JSON.parse( text ) 50 //console.log("update_all_info_on_host text=" + text ) 51 Globalx.output_url_listx = {} 52 obj["htmlfname"].forEach( (item) => { 53 let words = item.full.split('.') 54 let base = words[0] 55 Globalx.output_url_listx[ base ] = {} 56 Globalx.output_url_listx[ base ].full = `${obj["output_url"]}/${item.full}` 57 Globalx.output_url_listx[ base ].partial = `${obj["output_url"]}/${item.partial}` 58 console.log(`${words[0].full}=${ Globalx.output_url_listx[ base ].full }`) 59 console.log(`${words[0].partial}=${ Globalx.output_url_listx[ base ].partial }`) 60 } ) 61 Globalx.storagex.save_as_info_from_globalx() 62 } 63 } 64 47 65 async function update_all_info_on_host_async( ) { 48 await Globalx.remotex.get_output_url_listx( Globalx.num , (text) => { 49 if( text.match( /{.*}/ ) !== null ){ 50 const obj = JSON.parse( text ) 51 //console.log("update_all_info_on_host text=" + text ) 52 Globalx.output_url_listx = obj 53 Globalx.storagex.save_as_info_from_globalx() 54 } 66 await Globalx.remotex.update_output_url_listx( Globalx.num , (text) => { 67 set_output_url_listx(text) 55 68 } ) 56 69 … … 86 99 async function get_output_url_listx_async( num ) { 87 100 await Globalx.remotex.get_output_url_listx( num , (text) => { 88 if( text.match( /{.*}/ ) !== null ){ 89 const obj = JSON.parse( text ) 90 //console.log("update_all_info_on_host text=" + text ) 91 Globalx.output_url_listx = obj 92 Globalx.storagex.save_as_info_from_globalx() 93 } 101 set_output_url_listx(text) 94 102 } ) 95 103 } 104 96 105 async function setup(){ 97 106 await get_output_url_listx_async( Globalx.num ) 98 await get_output_url( Globalx.num )107 // await get_output_url( Globalx.num ) 99 108 } 100 109 -
branches/testa-single-bookmark/js/remotex.js
r66 r67 38 38 async get_output_url_listx( num, func) { 39 39 let param_array = [['cmd', 'get_output_url_listx'] , ['num', num]] 40 await this.fetchx( this.filename , param_array, 2, func ) 41 } 42 43 async update_output_url_listx( num, func) { 44 let param_array = [['cmd', 'update_output_url_listx'] , ['num', num]] 40 45 await this.fetchx( this.filename , param_array, 2, func ) 41 46 } -
branches/testa-single-bookmark/js/sidemenu.js
r66 r67 83 83 Globalx[part].editor.getSession().setValue( "" ); 84 84 85 let words = Globalx[part].item_name.split('.') 86 let base = words[0] 85 87 $( this.textarea_sel ).val( "" ); 86 this.set_anchor_url( part, Globalx[part].item_name, "", "" , "full")87 this.set_anchor_url( part, Globalx[part].item_name, "", "" , "partial")88 this.set_anchor_url( part, base, "", "" , "full") 89 this.set_anchor_url( part, base, "", "" , "partial") 88 90 89 91 if( Globalx[part].key != '/' ){ … … 128 130 129 131 if( jsondata !== undefined && jsondata[Globalx[part].key] !== undefined ){ 132 let words = item_name.split('.') 133 let base = words[0] 130 134 if( jsondata[Globalx[part].key].length == 0 ){ 131 135 Globalx[part].key_indicate_file = true; 132 136 console.log("Globalx[" + part + "].key_indicate_file = " + Globalx[part].key_indicate_file) 133 let url = "" 137 let url = Globalx.output_url_listx[base].full 138 console.log( "item_name="+item_name ) 139 console.log( "base="+base ) 140 console.log( "url="+url ) 134 141 $( Globalx[part].download_url_sel ).val( Globalx[part].key ) 135 142 $( Globalx[part].download_url_sel ).attr('href' , url ) … … 142 149 }); 143 150 144 this.set_anchor_down_url( item_name, Globalx.output_url_listx[item_name], item_name , "full" )145 this.set_anchor_down_url( item_name, Globalx.output_url_listx[item_name], item_name , "partial" )151 this.set_anchor_down_url( base, Globalx.output_url_listx[base].full, item_name , "full" ) 152 this.set_anchor_down_url( base, Globalx.output_url_listx[base].partial, item_name , "partial" ) 146 153 } 147 154 else{ 148 this.set_anchor_url( part, Globalx[part].item_name, "", "" , "full")149 this.set_anchor_url( part, Globalx[part].item_name, "", "" , "partial")155 this.set_anchor_url( part, base, "", "" , "full") 156 this.set_anchor_url( part, base, "", "" , "partial") 150 157 } 151 158 } … … 184 191 } 185 192 186 set_anchor_down_url( item_name, href, text , kind ){ 193 set_anchor_url( part, base, href, text , kind){ 194 if( href === undefined ){ 195 href = "" 196 } 197 if( text === "" ){ 198 Globalx[part].sidemenu.set_anchor_down_url( base, href, text , kind) 199 } 200 else{ 201 let words = text.split('.') 202 let base = words[0] 203 if( Globalx.output_url_listx[base] !== undefined ){ 204 Globalx[part].sidemenu.set_anchor_down_url( base, href, text , kind) 205 } 206 } 207 } 208 209 set_anchor_down_url( base, href, text , kind ){ 187 210 let sel = null 188 211 if( href === undefined ){ 189 212 href = "" 190 213 } 191 Globalx.output_url_listx[item_name] = href 192 214 if( href === "" ){ 215 text = "" 216 } 217 if( text !== "" ){ 218 if( kind == "full" ){ 219 Globalx.output_url_listx[base].full = href 220 } 221 else{ 222 Globalx.output_url_listx[base].partial = href 223 } 224 } 193 225 if( kind === "full" ){ 194 226 sel = this.full_download_url_sel
Note: See TracChangeset
for help on using the changeset viewer.
![(trac.ini の [header_logo] セクションを設定してください)](/python/trac/Flist/chrome/common/trac_logo_mini.png)