Ignore:
Timestamp:
Aug 26, 2019 6:15:44 PM (6 years ago)
Author:
anonymous
Message:

hide unused menu by css

File:
1 edited

Legend:

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

    r29 r36  
    33    constructor( filename ){
    44        this.filename = filename
    5 //      this.num = num
    6 //      this.part = part
     5        //      this.num = num
     6        //      this.part = part
    77    }
    88
     
    1717
    1818    async get_filelist_from_remote( num, part, func ) {
    19 console.log("remotex get_filelist_from_remote num=" + num + " part=" + part )
     19        console.log("remotex get_filelist_from_remote num=" + num + " part=" + part )
    2020        let param_array = [['cmd', 'get_filelistx'], ['num', num ], ['part', part ]]
    2121        await this.fetchx( this.filename , param_array, func )
     
    2323
    2424    async update_filelist( num, part, func ) {
    25 console.log("remotex update_filelist num=" + num + " part=" + part )
     25        console.log("remotex update_filelist num=" + num + " part=" + part )
    2626        let param_array = [['cmd', 'update_filelistx'], ['num', num ], ['part', part ]]
    2727        await this.fetchx( this.filename , param_array, func )
     
    2929
    3030    async get_content(num, part, path , func) {
    31 console.log("remotex get_content num=" + num + " part=" + part )
     31        console.log("remotex get_content num=" + num + " part=" + part )
    3232        console.log("part=" + part)
    3333        let param_array = [['cmd', 'get_content'], ['num', num ], ['part', part ], ['path', path]]
     
    3535    }
    3636
     37    async get_output_url(num, func) {
     38console.log("get_output_url")
     39        console.log("remotex get_output_url num=" + num )
     40        let param_array = [['cmd', 'get_output_url'], ['num', num ] ]
     41        await this.fetchx( this.filename , param_array, func )
     42    }
     43
    3744    async fetchx( filename, param_array, func) {
     45console.log("fetchx func" + func)
    3846        let params = this.make_url_params( param_array )
    3947        fetch(`${filename}?${params}`)
    4048            .then((response) => response.text())
    41             .then((text) => { console.log(func) ; func(text)})
     49            .then((text) => { console.log(func) ; if( func !== undefined ){func(text)} else { console.log("func=undefined")} })
     50            .catch((error) => console.log(error));
     51    }
     52
     53    upload_to_host(part) {
     54        if( Globalx[part].key_indicate_file === true ){
     55            let textarea = $( Globalx[part].textarea_sel )
     56            upload_content(Globalx.num, part, Globalx[part].key, textarea.val())
     57        }
     58    }
     59
     60    upload_content(num, part, path, content) {
     61        let form = document.createElement('form');
     62        let req_content = document.createElement('input');
     63        let req_path = document.createElement('input');
     64        let req_cmd = document.createElement('input');
     65        let req_num = document.createElement('input');
     66
     67        document.body.appendChild(form);
     68        req_content.type = 'hidden';
     69        req_content.name = 'mytext';
     70        req_content.value = content;
     71       
     72        req_path.type = 'hidden';
     73        req_path.name = 'path';
     74        req_path.value = path;
     75       
     76        req_cmd.type = 'hidden';
     77        req_cmd.name = 'cmd';
     78        req_cmd.value = 'upload_content';
     79       
     80        req_num.type = 'hidden';
     81        req_num.name = 'num';
     82        req_num.value = num + '';
     83       
     84        form.appendChild(req_content);
     85        form.appendChild(req_path);
     86        form.appendChild(req_cmd);
     87        form.appendChild(req_num);
     88       
     89        // FormDataオブジェクトを作成する
     90        var form_data = new FormData(form);
     91
     92        fetch('php/content.php', {
     93            method: 'POST',
     94            mode: 'same-origin', /* 'no-cors' 'cors' 'same-origin' */
     95            body: form_data
     96        })
     97            .then((response) => response.text())
     98            .then((data) => console.log(data))
    4299            .catch((error) => console.log(error));
    43100    }
    44101
    45102    handleDownload(e) {
    46         let dl = document.getElementById("data-down-download")
     103        let dl = document.getElementById(`${e.data.part}-down-download`)
    47104
    48105        if( Globalx[ e.data.part ].key_indicate_file === true ){
Note: See TracChangeset for help on using the changeset viewer.