Ignore:
Timestamp:
Sep 5, 2019 9:42:27 AM (6 years ago)
Author:
anonymous
Message:

full, partial

Location:
branches/testa-single-bookmark/js
Files:
4 edited

Legend:

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

    r66 r67  
    11class Build {
    22    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] = href
    10         Globalx[part].sidemenu.set_anchor_down_url( item_name, href, text , kind)
    113    }
    124
     
    1810            const content = textarea.val()
    1911
    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")
    2216
    2317            Globalx.remotex.upload_file( cmd, Globalx.num, part, Globalx[part].key, content , (data) => {
     
    2721                    console.log("partial_download_url=" + obj["partial_download_url"])
    2822
    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")
    3125                }
    3226                else{
  • branches/testa-single-bookmark/js/main.js

    r66 r67  
    4545}
    4646
     47function 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
    4765async 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)
    5568    } )
    5669
     
    8699async function get_output_url_listx_async( num ) {
    87100    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)
    94102    } )
    95103}
     104
    96105async function setup(){
    97106    await get_output_url_listx_async( Globalx.num )
    98     await get_output_url( Globalx.num )
     107//    await get_output_url( Globalx.num )
    99108}
    100109
  • branches/testa-single-bookmark/js/remotex.js

    r66 r67  
    3838    async get_output_url_listx( num, func) {
    3939        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]]
    4045        await this.fetchx( this.filename , param_array, 2, func )
    4146    }
  • branches/testa-single-bookmark/js/sidemenu.js

    r66 r67  
    8383            Globalx[part].editor.getSession().setValue( "" );
    8484
     85            let words = Globalx[part].item_name.split('.')
     86            let base = words[0]
    8587            $( 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")
    8890
    8991            if( Globalx[part].key != '/' ){
     
    128130
    129131        if( jsondata !== undefined && jsondata[Globalx[part].key] !== undefined ){
     132            let words = item_name.split('.')
     133            let base = words[0]
    130134            if( jsondata[Globalx[part].key].length == 0 ){
    131135                Globalx[part].key_indicate_file = true;
    132136console.log("Globalx[" + part + "].key_indicate_file = " + Globalx[part].key_indicate_file)
    133                 let url = ""
     137                let url = Globalx.output_url_listx[base].full
     138console.log( "item_name="+item_name )
     139console.log( "base="+base )
     140console.log( "url="+url )
    134141                $( Globalx[part].download_url_sel ).val( Globalx[part].key )
    135142                $( Globalx[part].download_url_sel ).attr('href' , url )
     
    142149                });
    143150
    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" )
    146153            }
    147154            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")
    150157            }
    151158        }
     
    184191    }
    185192
    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 ){
    187210        let sel = null
    188211        if( href === undefined ){
    189212            href = ""
    190213        }
    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        }
    193225        if( kind === "full" ){
    194226            sel = this.full_download_url_sel
Note: See TracChangeset for help on using the changeset viewer.