Ignore:
Timestamp:
Sep 4, 2019 11:03:12 AM (6 years ago)
Author:
anonymous
Message:

set_anchor_url

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/testa-single-bookmark/js/main.js

    r59 r66  
    3030    Globalx.bookmark_displayname_max_length = 18
    3131    Globalx.output_url = null
     32    Globalx.output_url_listx = null
    3233    Globalx.remote_filename = 'php/content3.php'
    3334    Globalx.build = new Build()
     
    4142    Globalx.bookmarkmenu = null
    4243
    43     Globalx.build.setup()
     44    Globalx.build.setup('data')
    4445}
    4546
    46 async function update_all_filelist( ) {
     47async 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
    4757    Globalx.parts.map( ( part ) => {
    4858        Globalx[ part ].sidemenu.update(`#${part}-side`)
    4959    } )
     60
    5061}
    5162
     63async 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}
    5274async function get_output_url_async( num, func ){
    53     let realData = Globalx.storagex.get_output_url()
     75    let output_url = Globalx.storagex.get_output_url()
    5476
    55     if( realData === undefined || realData === null ){
     77    if( output_url === undefined || output_url === null ){
    5678        await Globalx.remotex.get_output_url( num, func )
    5779    }
    5880    else{
    59         const obj = Globalx.storagex.get_output_url( num )
    60         Globalx.output_url = obj.output_url
     81        Globalx.output_url = output_url
    6182        Globalx.storagex.save_as_info_from_globalx()
    6283    }
    6384}
    6485
     86async 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}
    6596async 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 )
    7799}
    78100
Note: See TracChangeset for help on using the changeset viewer.