Changeset 66


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

set_anchor_url

Location:
branches/testa-single-bookmark
Files:
7 edited

Legend:

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

    r43 r66  
    33    }
    44
    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` )
    715        item.on('click' , () => {
    8             const part = Globalx.parts[ Globalx.index ]
    916            const cmd = "build_one_html"
    1017            let textarea = $( Globalx[part].textarea_sel )
    1118            const content = textarea.val()
    1219
     20            this.set_anchor_url( part, Globalx[part].item_name, "", "" , "full")
     21            this.set_anchor_url( part, Globalx[part].item_name, "", "" , "partial")
     22
    1323            Globalx.remotex.upload_file( cmd, Globalx.num, part, Globalx[part].key, content , (data) => {
    1424                if ( data !== undefined ){
    15                     let array = null
    16                     let len = null
    1725                    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"])
    1828
    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")
    3031                }
    3132                else{
  • 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
  • branches/testa-single-bookmark/js/remotex.js

    r41 r66  
    55        //      this.num = num
    66        //      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();
    167    }
    178
     
    4233    async get_output_url(num, func) {
    4334        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]]
    4440        await this.fetchx( this.filename , param_array, 2, func )
    4541    }
  • branches/testa-single-bookmark/js/sidemenu.js

    r41 r66  
    77        this.textarea_sel = Globalx[part].textarea_sel
    88        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
    1013    set_editor( editor ){
    1114        this.editor = editor /* Globalx[part].editor */
     
    7982            this.set_globalx_item_name(part, "")
    8083            Globalx[part].editor.getSession().setValue( "" );
     84
    8185            $( 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
    8289            if( Globalx[part].key != '/' ){
    8390                let array = Globalx[part].key.split("/")
     
    134141                    $( Globalx[part].textarea_sel ).val( content );
    135142                });
     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")
    136150            }
    137151        }
     
    168182        dl.attr('download' , Globalx[part].item_name)
    169183        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 )
    170208    }
    171209
  • branches/testa-single-bookmark/js/storagex.js

    r41 r66  
    126126    }
    127127
     128    get_filelist(num, part) {
     129        return this.restore_from_localstorage(num, part)
     130    }
     131
    128132    restore_info(){
    129133        const item_name = "info"
     
    208212    }
    209213
    210     get_filelist(num, part) {
    211         return this.restore_from_localstorage(num, part)
    212     }
    213 
    214     get_output_url() {
    215         return this._globalStorage.output_url
    216     }
    217 
    218214    reset_info() {
    219215        reset_localstorage('info')
  • branches/testa-single-bookmark/tmp/tmp.txt

    r38 r66  
    44    <meta charset="UTF-8">
    55    <meta name="viewport" content="width=device-width, initial-scale=1">
    6     <title>md2site</title>
     6    <title>md2site-web</title>
    77<!-- AREA-START -->
    88    <link rel="stylesheet" href="./css/style.css" />
    99    <link href='https://fonts.googleapis.com/css?family=Varela+Round' rel='stylesheet' type='text/css'>
    10     <link rel="stylesheet" href="css/style-3.css?132">
    11     <link rel="stylesheet" href="css/tab.css?132">
    12     <link rel="stylesheet" href="css/menu.css?132">
     10    <link rel="stylesheet" href="css/style-3.css?146">
     11    <link rel="stylesheet" href="css/tab.css?146">
     12    <link rel="stylesheet" href="css/menu.css?146">
    1313    <link href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" rel="stylesheet" />
    1414    <script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
    1515    <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script>
    1616    <script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.5/ace.js"></script>
    17     <script src="js/storagex.js?132>"></script>
    18     <script src="js/sidemenu.js?132>"></script>
    19     <script src="js/bookmark.js?132>"></script>
    20     <script src="js/bookmarkmgr.js?132"></script>
    21     <script src="js/bookmarkmenu.js?132"></script>
    22     <script src="js/tab.js?132"></script>
    23     <script src="js/topmenu.js?132"></script>
    24     <script src="js/remotex.js?132"></script>
    25     <script src="js/build.js?132"></script>
    26     <script src="js/main.js?132"></script>
     17    <script src="js/storagex.js?146>"></script>
     18    <script src="js/sidemenu.js?146>"></script>
     19    <script src="js/bookmark.js?146>"></script>
     20    <script src="js/bookmarkmgr.js?146"></script>
     21    <script src="js/bookmarkmenu.js?146"></script>
     22    <script src="js/tab.js?146"></script>
     23    <script src="js/topmenu.js?146"></script>
     24    <script src="js/remotex.js?146"></script>
     25    <script src="js/build.js?146"></script>
     26    <script src="js/main.js?146"></script>
    2727
    2828<!-- AREA-END -->
     
    3535      <li class="tab is-active">data</li>
    3636      <li class="tab">output</li>
    37       <li class="tab">setting</li>
     37      <li class="tab">conf</li>
    3838    </ul>
    3939    <div id="all" class="panel-group">
     
    4444              <ul>
    4545                <li><a id="data-file-upload" onclick="upload_to_host('data')">Save on host</a></li>
    46                 <li><a id="data-file-download" onclick="download_cmd('part')">Download</a></li>
     46                <li><a id="data-file-download" class="disabled" >X Download</a></li>
    4747                <li><a id="data-file-rename" class="disabled" >X Rename</a></li>
    4848                <li><a id="data-file-move"class="disabled" >X Move</a></li>
     
    5252            </li>
    5353            <li id="data-menu-dir" class="disabled"><a href="#">Dir</a>
    54               <ul class="disabled">
    55                 <li id="data-dir-create" class="disabled"><a class="disabled" href="#">X Create</a></li>
    56                 <li id="data-dir-rename" class="disabled"><a href="#">X Rename</a></li>
    57                 <li id="data-dir-move" class="disabled"><a class="disabled" href="#">X Move</a></li>
    58                 <li id="data-dir-delete" class="disabled"><a class="disabled" href="#">X Delete</a></li>
    59                 <li id="data-dir-duplicate" class="disabled"><a class="disabled" href="#">X Duplicate</a></li>
    60               </ul>
    61             </li>
    62             <li><a href="#">Bookmark</a>
     54              <ul>
     55                <li id="data-dir-create"><a href="#">X Create</a></li>
     56                <li id="data-dir-rename"><a href="#">X Rename</a></li>
     57                <li id="data-dir-move"><a href="#">X Move</a></li>
     58                <li id="data-dir-delete"><a href="#">X Delete</a></li>
     59                <li id="data-dir-duplicate"><a href="#">X Duplicate</a></li>
     60              </ul>
     61            </li>
     62            <li class="disabled"><a href="#">Bookmark</a>
    6363              <ul id="data-bookmark">
    6464              </ul>
     
    6767              <ul>
    6868                <li><a id="data-build-build" href="#">Build</a></li>
    69                 <li><a id="data-build-get-filelist" href="#" onclick="get_filelist()">Get FileList</a></li>
    70                 <li><a id="data-build-forced-to-get-filelist" href="#" onclick="update_filelist()">Forced to get FileList</a></li>
    71                 <li><a id="data-build-restore-filelist" href="#" onclick="restore_filelist(0, '/rtk/fmp_kernel')">Restore FileList</a></li>
    7269              </ul>
    7370            </li>
    7471            <li><a href="#">config</a>
    7572              <ul>
    76                 <li><a id="data-host-update-all" onclick="update_all_filelist()">Update all on host</a></li>
    77                 <li><a id="data-host-update" onclick="Globalx.remotex.update('data')">Update on host</a></li>
     73                <li><a id="data-host-update-all" onclick="update_all_info_on_host_async()">Update all on host</a></li>
     74<!--            <li><a id="data-host-update" onclick="Globalx.remotex.update('data')">Update on host</a></li> -->
    7875                <li><a href="#" onclick="Globalx.storagex.save_info_from_globalx()">Save info</a></li>
    7976                <li><a href="#" onclick="Globalx.storagex.reset_info()">Reset Info</a></li>
     
    8178                <li><a href="#" onclick="Globalx.storagex.show_localstorage()">Show localstorage</a></li>
    8279                <li><a href="#" onclick="Globalx.storagex.show_globalx()">Show globalx</a></li>
     80                <li><a id="data-build-get-filelist" href="#" onclick="get_filelist()">Get FileList</a></li>
     81                <li><a id="data-build-forced-to-get-filelist" href="#" onclick="update_filelist()">Forced to get FileList</a></li>
     82                <li><a id="data-build-restore-filelist" href="#" onclick="restore_filelist(0, '/rtk/fmp_kernel')">Restore FileList</a></li>
    8383              </ul>
    8484            </li>
     
    9696
    9797          <input type="text" id="data-filelist_key" value="/" />
    98           <label id="data-bookmark_label">
    99             <input type="checkbox" id="data-bookmark_op" >
     98          <label id="data-bookmark_label" class="disabled">
     99            <input type="checkbox" id="data-bookmark_op"  class="disabled">
    100100            BK
    101101          </label>
    102           <a id="data-down-download" class="xxbutton" role="button" download="some.txt" >DL</a>
     102          <a id="data-down-download" class="xxbutton" role="button" download="some.txt" class="disabled"><!--DL --></a>
    103103          <a id="data-down-url"></a>
    104104          <a id="data-partial-down-url"></a>
     
    131131            </ul>
    132132          </li>
    133           <li><a href="#">Bookmark</a>
     133          <li class="disabled"><a href="#">Bookmark</a>
    134134            <ul id="output-bookmark">
    135135            </ul>
     
    150150
    151151          <input type="text" id="output-filelist_key" value="/" />
    152           <label id="output-bookmark_label">
    153             <input type="checkbox" id="output-bookmark_op">
     152          <label id="output-bookmark_label" class="disabled">
     153            <input type="checkbox" id="output-bookmark_op" class="disabled">
    154154            BK
    155155          </label>
    156           <a id="output-down-download" class="xxbutton" role="button" download="some.txt" >DL</a>
     156          <a id="output-down-download" class="xxbutton" role="button" download="some.txt"  class="disabled"><!--DL --></a>
    157157          <a id="output-down-url"></a>
    158158          <a id="output-partial-down-url"></a>
     
    165165        </div>
    166166      </div>
    167       <div id="area-setting" class="panel">
    168         <div id="setting-menubar"></div>
     167      <div id="area-conf" class="panel">
     168        <div id="conf-menubar"></div>
    169169        <ul class="nav">
    170170          <li><a href="#">File</a>
    171171            <ul>
    172               <li><a id="setting-file-upload" onclick="upload_to_host('setting')">Save on host</a></li>
    173               <li><a id="setting-file-download" onclick="download_cmd('data')">Download</a></li>
    174               <li><a id="setting-file-rename" class="disabled" >-Rename</a></li>
    175               <li><a id="setting-file-move" class="disabled" >-Move</a></li>
    176               <li><a id="setting-file-delete" class="disabled" >-Delete</a></li>
    177               <li><a id="setting-file-duplicate" class="disabled" >-Duplicate</a></li>
     172              <li><a id="conf-file-upload" onclick="upload_to_host('conf')">Save on host</a></li>
     173<!--          <li><a id="conf-file-download" onclick="download_cmd('data')">Download</a></li> -->
     174              <li><a id="conf-file-rename" class="disabled" >-Rename</a></li>
     175              <li><a id="conf-file-move" class="disabled" >-Move</a></li>
     176              <li><a id="conf-file-delete" class="disabled" >-Delete</a></li>
     177              <li><a id="conf-file-duplicate" class="disabled" >-Duplicate</a></li>
    178178            </ul>
    179179          </li>
    180180          <li class="disabled"><a href="#">Dir</a>
    181181            <ul>
    182               <li><a id="setting-dir-create" class="disabled" href="#">-Create</a></li>
    183               <li><a id="setting-dir-rename" class="disabled" href="#">-Rename</a></li>
    184               <li><a id="setting-dir-move" class="disabled" href="#">-Move</a></li>
    185               <li><a id="setting-dir-delete" class="disabled" href="#">-Delete</a></li>
    186               <li><a id="setting-dir-duplicate" class="disabled" href="#">-Duplicate</a></li>
    187             </ul>
    188           </li>
    189           <li><a href="#">Bookmark</a>
    190             <ul id="setting-bookmark">
     182              <li><a id="conf-dir-create" class="disabled" href="#">-Create</a></li>
     183              <li><a id="conf-dir-rename" class="disabled" href="#">-Rename</a></li>
     184              <li><a id="conf-dir-move" class="disabled" href="#">-Move</a></li>
     185              <li><a id="conf-dir-delete" class="disabled" href="#">-Delete</a></li>
     186              <li><a id="conf-dir-duplicate" class="disabled" href="#">-Duplicate</a></li>
     187            </ul>
     188          </li>
     189          <li class="disabled"><a href="#">Bookmark</a>
     190            <ul id="conf-bookmark">
    191191            </ul>
    192192          </li>
     
    199199          </li>
    200200        </ul>
    201         <div id="setting-bar">
    202           <select id="setting-select-host">
     201        <div id="conf-bar">
     202          <select id="conf-select-host">
    203203          </select>
    204204
    205           <textarea id="setting-editor-t" name="setting-editor-t"></textarea>
    206 
    207           <input type="text" id="setting-filelist_key" value="/" />
    208           <label id="setting-bookmark_label">
    209             <input type="checkbox" id="setting-bookmark_op" >
     205          <textarea id="conf-editor-t" name="conf-editor-t"></textarea>
     206
     207          <input type="text" id="conf-filelist_key" value="/" />
     208          <label id="conf-bookmark_label" class="disabled">
     209            <input type="checkbox" id="conf-bookmark_op"  class="disabled">
    210210            BK
    211211          </label>
    212           <a id="setting-down-download" class="xxbutton" role="button" download="some.txt" >DL</a>
    213           <a id="setting-down-url"></a>
    214           <a id="setting-partial-down-url"></a>
    215         </div>
    216         <div id="setting-side">
    217         </div>
    218         <div id="setting-work">
    219           <div id="setting-editor" style="height: 600px">
     212          <a id="conf-down-download" class="xxbutton" role="button" download="some.txt"  class="disabled"><!-- DL --></a>
     213          <a id="conf-down-url"></a>
     214          <a id="conf-partial-down-url"></a>
     215        </div>
     216        <div id="conf-side">
     217        </div>
     218        <div id="conf-work">
     219          <div id="conf-editor" style="height: 600px">
    220220          </div>
    221221        </div>
Note: See TracChangeset for help on using the changeset viewer.