Changeset 66 for branches/testa-single-bookmark/js
- Timestamp:
- Sep 4, 2019 11:03:12 AM (6 years ago)
- Location:
- branches/testa-single-bookmark/js
- Files:
-
- 5 edited
-
build.js (modified) (1 diff)
-
main.js (modified) (2 diffs)
-
remotex.js (modified) (2 diffs)
-
sidemenu.js (modified) (4 diffs)
-
storagex.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/testa-single-bookmark/js/build.js
r43 r66 3 3 } 4 4 5 setup(){ 6 let item = $( '#data-build-build' ) 5 set_anchor_url( part, item_name, href, text , kind){ 6 if( href === undefined ){ 7 href = "" 8 } 9 Globalx.output_url_listx[text] = href 10 Globalx[part].sidemenu.set_anchor_down_url( item_name, href, text , kind) 11 } 12 13 setup(part){ 14 let item = $( `#${part}-build-build` ) 7 15 item.on('click' , () => { 8 const part = Globalx.parts[ Globalx.index ]9 16 const cmd = "build_one_html" 10 17 let textarea = $( Globalx[part].textarea_sel ) 11 18 const content = textarea.val() 12 19 20 this.set_anchor_url( part, Globalx[part].item_name, "", "" , "full") 21 this.set_anchor_url( part, Globalx[part].item_name, "", "" , "partial") 22 13 23 Globalx.remotex.upload_file( cmd, Globalx.num, part, Globalx[part].key, content , (data) => { 14 24 if ( data !== undefined ){ 15 let array = null16 let len = null17 25 const obj = JSON.parse(data) 26 console.log("full_download_url=" + obj["full_download_url"]) 27 console.log("partial_download_url=" + obj["partial_download_url"]) 18 28 19 array = obj["full_download_url"].split('/') 20 len = array.length 21 $('#data-down-url').attr('href' , obj["full_download_url"]) 22 23 $('#data-down-url').text( "Full HTML:" + array[len - 1] ) 24 25 array = obj["partial_download_url"].split('/') 26 len = array.length 27 $('#data-partial-down-url').attr('href' , obj["partial_download_url"]) 28 $('#data-partial-down-url').text( "Partial HTML:" + array[len - 1] ) 29 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") 30 31 } 31 32 else{ -
branches/testa-single-bookmark/js/main.js
r59 r66 30 30 Globalx.bookmark_displayname_max_length = 18 31 31 Globalx.output_url = null 32 Globalx.output_url_listx = null 32 33 Globalx.remote_filename = 'php/content3.php' 33 34 Globalx.build = new Build() … … 41 42 Globalx.bookmarkmenu = null 42 43 43 Globalx.build.setup( )44 Globalx.build.setup('data') 44 45 } 45 46 46 async function update_all_filelist( ) { 47 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 } 55 } ) 56 47 57 Globalx.parts.map( ( part ) => { 48 58 Globalx[ part ].sidemenu.update(`#${part}-side`) 49 59 } ) 60 50 61 } 51 62 63 async function get_output_url( num ){ 64 get_output_url_async( num, (str) => { 65 if( str.match( /{.*}/ ) !== null ){ 66 const obj = JSON.parse( str ) 67 //console.log("get_output_url obj=" + obj.output_url) 68 Globalx.output_url = obj.output_url 69 Globalx.storagex.save_as_info_from_globalx() 70 } 71 } ) 72 73 } 52 74 async function get_output_url_async( num, func ){ 53 let realData= Globalx.storagex.get_output_url()75 let output_url = Globalx.storagex.get_output_url() 54 76 55 if( realData === undefined || realData=== null ){77 if( output_url === undefined || output_url === null ){ 56 78 await Globalx.remotex.get_output_url( num, func ) 57 79 } 58 80 else{ 59 const obj = Globalx.storagex.get_output_url( num ) 60 Globalx.output_url = obj.output_url 81 Globalx.output_url = output_url 61 82 Globalx.storagex.save_as_info_from_globalx() 62 83 } 63 84 } 64 85 86 async function get_output_url_listx_async( num ) { 87 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 } 94 } ) 95 } 65 96 async function setup(){ 66 get_output_url_async( Globalx.num, (text) => { 67 let str = text 68 let obj 69 if( str.match( /{.*}/ ) === null ){ 70 obj = {} 71 } 72 else { 73 obj = JSON.parse( str ) 74 } 75 Globalx.storagex.change_cache( obj, this.num , this.part ) 76 } ) 97 await get_output_url_listx_async( Globalx.num ) 98 await get_output_url( Globalx.num ) 77 99 } 78 100 -
branches/testa-single-bookmark/js/remotex.js
r41 r66 5 5 // this.num = num 6 6 // this.part = part 7 }8 9 make_url_params0( arrayx ){10 let params = new URLSearchParams();11 arrayx.reduce(function(acc, element, index, array) {12 acc.append(element[0], element[1]);13 return acc;14 }, params)15 return params.toString();16 7 } 17 8 … … 42 33 async get_output_url(num, func) { 43 34 let param_array = [['cmd', 'get_output_url'], ['num', num ] ] 35 await this.fetchx( this.filename , param_array, 2, func ) 36 } 37 38 async get_output_url_listx( num, func) { 39 let param_array = [['cmd', 'get_output_url_listx'] , ['num', num]] 44 40 await this.fetchx( this.filename , param_array, 2, func ) 45 41 } -
branches/testa-single-bookmark/js/sidemenu.js
r41 r66 7 7 this.textarea_sel = Globalx[part].textarea_sel 8 8 this.bookmark_op_sel = Globalx[part].bookmark_op_sel 9 } 9 this.full_download_url_sel = `#${part}-down-url` 10 this.partial_download_url_sel = `#${part}-partial-down-url` 11 } 12 10 13 set_editor( editor ){ 11 14 this.editor = editor /* Globalx[part].editor */ … … 79 82 this.set_globalx_item_name(part, "") 80 83 Globalx[part].editor.getSession().setValue( "" ); 84 81 85 $( 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 82 89 if( Globalx[part].key != '/' ){ 83 90 let array = Globalx[part].key.split("/") … … 134 141 $( Globalx[part].textarea_sel ).val( content ); 135 142 }); 143 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" ) 146 } 147 else{ 148 this.set_anchor_url( part, Globalx[part].item_name, "", "" , "full") 149 this.set_anchor_url( part, Globalx[part].item_name, "", "" , "partial") 136 150 } 137 151 } … … 168 182 dl.attr('download' , Globalx[part].item_name) 169 183 dl.removeAttr('href') 184 } 185 186 set_anchor_down_url( item_name, href, text , kind ){ 187 let sel = null 188 if( href === undefined ){ 189 href = "" 190 } 191 Globalx.output_url_listx[item_name] = href 192 193 if( kind === "full" ){ 194 sel = this.full_download_url_sel 195 if( text !== "" ){ 196 text = "Full HTML:" + text 197 } 198 } 199 else{ 200 sel = this.partial_download_url_sel 201 if( text !== "" ){ 202 text = "Partial HTML:" + text 203 } 204 } 205 206 $( sel ).attr( "href" , href ) 207 $( sel ).text( text ) 170 208 } 171 209 -
branches/testa-single-bookmark/js/storagex.js
r41 r66 126 126 } 127 127 128 get_filelist(num, part) { 129 return this.restore_from_localstorage(num, part) 130 } 131 128 132 restore_info(){ 129 133 const item_name = "info" … … 208 212 } 209 213 210 get_filelist(num, part) {211 return this.restore_from_localstorage(num, part)212 }213 214 get_output_url() {215 return this._globalStorage.output_url216 }217 218 214 reset_info() { 219 215 reset_localstorage('info')
Note: See TracChangeset
for help on using the changeset viewer.
![(trac.ini の [header_logo] セクションを設定してください)](/python/trac/Flist/chrome/common/trac_logo_mini.png)