- Timestamp:
- Aug 21, 2019 7:44:47 PM (6 years ago)
- Location:
- branches/testa
- Files:
-
- 1 added
- 11 edited
-
css/menu.css (modified) (3 diffs)
-
index.php (modified) (4 diffs)
-
js/bookmark.js (modified) (1 diff)
-
js/bookmarkmgr.js (modified) (3 diffs)
-
js/main.js (modified) (4 diffs)
-
js/menux.js (modified) (5 diffs)
-
js/remote.js (modified) (5 diffs)
-
js/storage.js (modified) (2 diffs)
-
js/tab.js (modified) (2 diffs)
-
js/topmenu.js (added)
-
php/content.php (modified) (4 diffs)
-
settings.yml (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/testa/css/menu.css
r23 r25 15 15 height: 40px; 16 16 text-align: center; 17 color: #fff; 17 /* color: #fff;*/ 18 color: HighlightText; 18 19 font-size: 14px; 19 20 line-height: 2.8; 20 background: #9fb7d4; 21 /* background: #9fb7d4;*/ 22 background: #9f9f90; 21 23 text-decoration: none; 22 24 border-right: 1px solid #eee; … … 26 28 27 29 .nav > li:hover > a {/*layer-1*/ 28 color: orange; 30 /* color: orange; 31 background: #afc6e2;*/ 32 color: MenuText 33 /* background: Menu*/ 29 34 background: #afc6e2; 30 35 } … … 42 47 z-index: var(--menu-z-index); 43 48 44 hight: 30px; 49 /* hight: 30px; */ 45 50 } 46 51 -
branches/testa/index.php
r24 r25 13 13 <link rel="stylesheet" href="css/style-3.css"> 14 14 <link rel="stylesheet" href="css/tab.css"> 15 <link rel="stylesheet" href="css/menu.css ">15 <link rel="stylesheet" href="css/menu.css?3"> 16 16 <link href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" rel="stylesheet" /> 17 17 <script src="https://code.jquery.com/jquery-3.2.1.min.js"></script> 18 18 <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script> 19 19 <script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.5/ace.js"></script> 20 <script src="js/remote.js"></script> 21 <script src="js/menux.js"></script> 22 <script src="js/storage.js"></script> 23 <script src="js/bookmarkmgr.js"></script> 24 <script src="js/bookmark.js"></script> 20 <script src="js/storage.js?0"></script> 21 <script src="js/remote.js?9"></script> 22 <script src="js/menux.js?9"></script> 23 <script src="js/bookmark.js?0>"></script> 24 <script src="js/bookmarkmgr.js?9"></script> 25 <script src="js/tab.js?9"></script> 26 <script src="js/topmenu.js?2"></script> 27 <script src="js/main.js?9"></script> 25 28 26 29 <!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.ui-contextmenu/1.18.1/jquery.ui-contextmenu.min.js" integrity="sha256-cI6Q7epHX696CtqUt0dJouTIkNh0w67o5YOhUZygI/s=" crossorigin="anonymous"></script> --> … … 56 59 </ul> 57 60 </li> 61 <li><a href="#">Bookmark</a> 62 <ul id="data-bookmark"> 63 </ul> 64 </li> 58 65 <li><a href="#">Build</a> 59 66 <ul> … … 68 75 </ul> 69 76 70 <li><a href="#">Bookmark</a> 71 <ul id="data-bookmark"> 77 <li><a href="#">config</a> 78 <ul> 79 <li><a href="#" onclick="save_info_from_globalx()">Save info</a></li> 80 <li><a href="#" onclick="reset_info()">Reset Info</a></li> 81 <li><a href="#" onclick="clear_localstorage()">Clear local</a></li> 72 82 </ul> 73 83 </li> … … 128 138 129 139 </div> 130 <script src="js/main.js"></script>131 <script src="js/tab.js"></script>132 <script src="js/topmenu.js"></script>140 <script> 141 main() 142 </script> 133 143 </body> 134 144 </html> -
branches/testa/js/bookmark.js
r23 r25 3 3 this.path = path 4 4 if( display_name == null ){ 5 this.display_name = path.substr( 0, max_display_name_length)5 this.display_name = path.substr(-max_display_name_length ) 6 6 } 7 7 else{ 8 this.display_name = display_name 8 this.display_name = display_name.substr( -max_display_name_length ) 9 9 } 10 10 } 11 12 display_name() {13 return this.display_name14 }15 11 } -
branches/testa/js/bookmarkmgr.js
r23 r25 6 6 } 7 7 8 add( path , display_name ){8 add( path , display_name = null){ 9 9 let result = this.paths.indexOf( path ) 10 10 if( result < 0 ){ … … 21 21 delete this.paths[ result ] 22 22 } 23 } 24 25 get( path ){ 26 let ret = null 27 let result = this.paths.indexOf( path ) 28 if( result >= 0 ){ 29 ret = this.items[ path ] 30 } 31 return ret 23 32 } 24 33 … … 46 55 return path.substr( -this.max_display_name_length ) 47 56 } 57 58 get_items() { 59 return this.items 60 } 61 62 max_display_name_length(){ 63 return this.max_display_name_length 64 } 48 65 } -
branches/testa/js/main.js
r24 r25 1 1 let Globalx = {}; 2 let GlobalxInitValue = { 3 editor: null, 4 key_indicate_file: false, 5 key: '/' 6 }; 2 7 3 8 function main() { 4 Globalx.num = 0; 5 Globalx.index = 0; 6 Globalx.parts = ["data", "output", "setting"] 9 restore_info_to_globalx() 7 10 8 Globalx.parts.map( function( value ){ 9 set_globalx_editor(value) 10 } ) 11 editor_func("data"); 12 make_ul_for_menu('data' , '#data-side') 13 menux( "data" ) 11 editor_func("data"); 12 make_ul_for_menu('data' , '#data-side') 13 menux( "data" ) 14 15 editor_func("setting"); 16 make_ul_for_menu("setting" , '#setting-side') 17 18 editor_func("output"); 19 make_ul_for_menu("output" , '#output-side') 14 20 15 $('#down-download').on('click', {part: "data"}, handleDownload)16 $( Globalx['data'].textarea_sel ).val("");21 tab_init() 22 topmenu_init() 17 23 18 editor_func("setting"); 19 make_ul_for_menu("setting" , '#setting-side') 24 rebuild_bookmark_menu("data") 20 25 21 editor_func("output"); 22 make_ul_for_menu("output" , '#output-side') 26 // LocalStorageにまだ保存していない場合を想定して、ここで保存しておく 27 console.log("call save_info_from_globalx()") 28 save_info_from_globalx() 29 30 part = "data" 31 $('#down-download').on('click', {part: part}, handleDownload) 32 $( Globalx['data'].textarea_sel ).val(""); 33 $( '#bookmark_displayname' ).prop( 'maxlength' , Globalx[part].bookmark_displayname_max_length) 34 $('#bookmarkDlg').dialog({ 35 autoOpen: false, 36 modal: true, 37 buttons: { 38 "OK": function() { 39 part = Globalx.parts[ Globalx.index ] 40 path = $( '#bookmark_path' ).val() 41 displayname = $( '#bookmark_displayname' ).val() 42 register_bookmark_( part , path, displayname ) 43 $(this).dialog("close")}, 44 "Cancel": function() { 45 bookmark_cb.prop('checked', false) 46 $(this).dialog("close") 47 } 48 } 49 }) 50 } 51 52 function init_globalx() { 53 Globalx.num = 0; 54 Globalx.index = 0; 55 Globalx.parts = ["data", "output", "setting"] 56 57 Globalx.parts.map( function( part ){ 58 console.log("init_globalx part=" + part ) 59 set_globalx_editor(part) 60 } ) 23 61 } 24 62 … … 46 84 Globalx[part].bookmark_mgr = new BookmarkMgr( Globalx[part].bookmark_displayname_max_length ) 47 85 48 $( '#bookmark_displayname' ).prop( 'maxlength' , Globalx[part].bookmark_displayname_max_length)49 $('#bookmarkDlg').dialog({50 autoOpen: false,51 modal: true,52 buttons: {53 "OK": function() {54 part = Globalx.parts[ Globalx.index ]55 56 Globalx[part].bookmark_mgr.add( $( '#bookmark_path' ).val() , $( '#bookmark_displayname' ).val() )57 $(this).dialog("close")},58 "Cancel": function() {59 $(this).dislog("close")60 }61 }62 })63 86 } 64 87 65 88 function editor_func(part) { 66 console.log(`Globalx[#{name}].editor_id=` + Globalx[part].editor_id )67 89 let editor = ace.edit( Globalx[part].editor_id ) 68 console.log( editor )69 90 editor.setTheme("ace/theme/monokai"); 70 91 editor.setFontSize(14); … … 74 95 Globalx[part].editor = editor; 75 96 let textarea = $( Globalx[part].textarea_sel ); 76 console.log( "textarea=" + textarea )77 97 Globalx[part].textarea = textarea; 78 98 editor.getSession().on("change", function () { … … 81 101 } 82 102 83 main() -
branches/testa/js/menux.js
r23 r25 12 12 13 13 function menu_action( part, item_name , up_flag = false ) { 14 if( Globalx[part].key != '/' ){ 15 16 } 17 14 18 let realData = get_filelist( Globalx.num ) 15 19 Globalx[part].key_indicate_file = false; … … 121 125 function bookmark_op(part) { 122 126 if( $( Globalx[part].bookmark_op_sel ).is(':checked') == true ){ 123 console.log( Globalx[part].key +" add_bookmark" )124 127 add_bookmark(part) 125 128 } 126 129 else{ 127 console.log( Globalx[part].key +" remove_bookmark")128 130 remove_bookmark(part) 129 131 } … … 131 133 132 134 function add_bookmark( part ) { 133 Globalx[part].bookmark_mgr.add( Globalx[part].key )134 rebuild_bookmark_menu( part )135 135 $( '#bookmark_displayname' ).val( Globalx[part].bookmark_mgr.get_restricted_display_name( Globalx[part].key ) ) 136 136 $( '#bookmark_path' ).val( Globalx[part].key ) 137 137 $('#bookmarkDlg').dialog("open") 138 138 } 139 140 function register_bookmark_( part , path, displayname ) { 141 Globalx[part].bookmark_mgr.add( path , displayname ) 142 rebuild_bookmark_menu( part ) 139 143 } 140 144 … … 162 166 return 163 167 } 168 if(key === Globalx[part].key){ 169 return 170 } 171 164 172 let realData = get_filelist( Globalx.num ) 165 173 Globalx[part].key = key … … 176 184 }); 177 185 } 186 else{ 187 Globalx[part].key_indicate_file = false 188 Globalx[part].editor.getSession().setValue( "" ); 189 $( Globalx[part].textarea_sel ).val( "" ); 190 } 178 191 const bookmark_cb = $( Globalx[part].bookmark_op_sel ) 179 192 bookmark_cb.prop('checked', true) 193 194 $( Globalx[part].menu_sel ).empty() 195 196 make_menu_item_list(part, realData) 180 197 } 198 -
branches/testa/js/remote.js
r23 r25 78 78 79 79 function get_content(path , func) { 80 console.log( "path:" + path )81 80 let param_array = [['cmd', 'get_content'], ['num', Globalx.num ], ['path', path]]; 82 81 let params = make_url_params( param_array ); … … 88 87 } 89 88 90 //91 //92 function restore_filelist(num, key){93 const data = get_filelist(num);94 if( data !== null ){95 // display_filelist( data, '#filelist' );96 // console.log( data['/'] );97 // console.log( data['/rtk'] );98 // console.log( data['/rtk/fmp_kernel'] );99 // console.log( data['/rtk/fmp_kernel/data'] );100 // console.log( data['/rtk/fmp_kernel/data/fmp-kernel.md'] );101 console.log( data[key] );102 }103 else{104 console.log("null returned!");105 }106 }107 89 function handleDownload(e) { 108 90 let dl = document.getElementById("down-download") 109 91 if( Globalx[ e.data.part ].key_indicate_file === true ){ 110 console.log("handleDownload-file")111 console.log(Globalx[ e.data.part ])112 92 113 93 get_content( Globalx[ e.data.part ].key , function(content) { … … 116 96 if (window.navigator.msSaveBlob) { 117 97 window.navigator.msSaveBlob(blob, Globalx[ e.data.part ].item_name); 118 console.log("handleDownload=" + Globalx[ e.data.part ].item_name)119 98 120 99 // msSaveOrOpenBlobの場合はファイルを保存せずに開ける 121 100 window.navigator.msSaveOrOpenBlob(blob, Globalx[ e.data.part ].item_name); 122 101 } else { 123 console.log( "handleDownLoad-1-2" )124 console.log("handleDownload=" + Globalx[ e.data.part ].item_name)125 102 dl.download = Globalx[ e.data.part ].item_name 126 103 dl.href = window.URL.createObjectURL(blob); … … 130 107 else{ 131 108 e.preventDefault() 132 console.log("handleDownload-Not file")133 109 dl.href = "" 134 110 dl.download = "" … … 138 114 function download_cmd(part) { 139 115 if( Globalx[part].key_indicate_file === true ){ 140 console.log("download_cmd filename=" + Globalx[part].filename)141 142 116 let dl = $( Globalx[part].download_sel ) 143 144 console.log( dl.attr('download') )145 117 dl.trigger('click') 146 118 } -
branches/testa/js/storage.js
r23 r25 1 1 let _globalStorage = {} 2 3 const _items = ["num", "index", "parts"] 4 5 function storage_test(){ 6 console.log(_items); 7 } 8 9 function save_info_from_globalx(){ 10 save_info_from_globalx_with_items(_items) 11 } 12 13 function convert_to_array_from_bookmark_mgr(mgr){ 14 return { 15 paths: mgr.get_paths(), 16 items: mgr_to_array(mgr), 17 max_display_name_length: mgr.max_display_name_length() 18 } 19 } 20 21 function save_info_from_globalx_with_items(items){ 22 let info = {} 23 24 copy_object( info, Globalx, items ) 25 /* 26 info.num = Globalx.num 27 info.index = Globalx.index 28 info.parts = Globalx.parts 29 */ 30 Globalx.parts.map( function (part) { 31 save_info_from_globalx_part(info , part) 32 } ) 33 34 save_info_to_local_storage(info) 35 } 36 function convert_to_plain_object_from_bookmark_mgr(mgr){ 37 // console.log( "mgr=" + mgr ) 38 // console.log( "mgr.items()=" + mgr.items ) 39 const paths = mgr.get_paths() 40 const new_bk_items = paths.map( function( path ){ 41 let ret = { 42 path: "", 43 display_name: "" 44 } 45 item = mgr.get(path) 46 if( item != null ){ 47 ret.path = path 48 ret.display_name = item.display_name 49 } 50 return ret 51 } ) 52 53 return { 54 max_display_name_length: mgr.max_display_name_length, 55 items: new_bk_items 56 } 57 } 58 59 function save_info_from_globalx_part(info, part){ 60 info[part] = {} 61 copy_obj_with_part(info, Globalx, part) 62 63 info[part].bookmark_mgr = convert_to_plain_object_from_bookmark_mgr(Globalx[part].bookmark_mgr) 64 } 65 66 function copy_obj_with_part(to_obj, from_obj, part){ 67 /* const items = ["editor_id", "editor", "textarea_sel" , "menu_id", "bookmark_id", "bookmark_op_id", "item_name", "bookmarks", "bookmark_displayname_max_length", "key_indicate_file", "key", "key_sel", "download_sel", "menu_sel", "bookmark_sel", "bookmark_op_sel", "bookmark_mgr" ]*/ 68 const items = ["editor_id", "textarea_sel" , "menu_id", "bookmark_id", "bookmark_op_id", "item_name", "bookmarks", "bookmark_displayname_max_length", "key_sel", "download_sel", "menu_sel", "bookmark_sel", "bookmark_op_sel", "bookmark_mgr" ] 69 const init_value_items = ["editor", "key_indicate_file", "key"] 70 71 if( to_obj[part] === undefined ){ 72 to_obj[part] = {} 73 } 74 copy_object( to_obj[part], from_obj[part], items ) 75 copy_object( to_obj[part], GlobalxInitValue, init_value_items ) 76 } 77 78 function copy_object( to_obj, from_obj, items ){ 79 let x = null 80 items.map( function(item) { 81 x = from_obj[item] 82 to_obj[item] = x 83 } ) 84 } 85 86 function restore_info_to_globalx(){ 87 const info = restore_info() 88 if( info === undefined ){ 89 console.log("call init_globalx()") 90 init_globalx() 91 } 92 else { 93 console.log("call restore_info_to_globalx_with_items") 94 restore_info_to_globalx_with_items(info, _items) 95 } 96 } 97 98 function convert_to_bookmark_mgr_from_plain_object(mgr) { 99 let new_mgr = new BookmarkMgr( mgr.max_display_name_length ) 100 101 const bk_items = mgr.items 102 bk_items.map( function(bk_item) { 103 return new_mgr.add( bk_item.path , bk_item.display_name) 104 }) 105 return new_mgr 106 } 107 108 function restore_info_to_globalx_with_items(info, items){ 109 110 copy_object( Globalx, info, items ) 111 112 info.parts.map( function (part) { 113 restore_info_to_globalx_part(info , part) 114 } ) 115 } 116 117 function restore_info_to_globalx_part(info , part){ 118 info[part].bookmark_mgr = convert_to_bookmark_mgr_from_plain_object(info[part].bookmark_mgr) 119 copy_obj_with_part(Globalx, info, part) 120 } 2 121 3 122 function save_info_to_local_storage(info){ … … 18 137 function get_filelist(num) { 19 138 let num_s = num + '' 20 if( _globalStorage[num_s] === undefined ){ 21 oldData = localStorage.getItem(num_s) 139 return restore_from_localstorage(num_s) 140 } 141 142 143 function restore_info(){ 144 const item_name = "info" 145 return restore_from_localstorage(item_name) 146 } 147 148 function restore_from_localstorage(item_name){ 149 if( _globalStorage[item_name] === undefined ){ 150 oldData = localStorage.getItem(item_name) 22 151 if( oldData ){ 23 _globalStorage[ num_s] = JSON.parse(oldData)152 _globalStorage[item_name] = JSON.parse(oldData) 24 153 } 25 154 } 26 return _globalStorage[ num_s]155 return _globalStorage[item_name] 27 156 } 28 157 158 function reset_info(){ 159 let item_name = 'info' 160 reset_localstorage(item_name) 161 } 162 163 function reset_localstorage(item_name){ 164 delete _globalStorage[item_name] 165 localStorage.removeItem(item_name) 166 } 167 168 function clear_localstorage(){ 169 let keys = Object.keys(_globalStorage) 170 keys.map( (v) => { delete _globalStorage[v] } ) 171 172 localStorage.clear() 173 } -
branches/testa/js/tab.js
r23 r25 1 jQuery(function($){1 function tab_init(){ 2 2 $('.tab').click(function(){ 3 3 $('.is-active').removeClass('is-active'); … … 10 10 // クリックしたタブと同じインデックス番号をもつコンテンツを表示 11 11 $('.panel').eq(index).addClass('is-show'); 12 }) ;13 } );12 }) 13 } -
branches/testa/php/content.php
r23 r25 9 9 require_once( dirname(__FILE__) . '/NorthernCross/ns/PathInfo.php'); 10 10 require_once( dirname(__FILE__) . "/spyc-0.5/spyc.php"); // ★の部分にはspyc.phpを置いたパスを入れます 11 12 11 13 12 function get_url_data_array() … … 123 122 function cmdx(){ 124 123 $filelist_filename = "filelist.json"; 124 $setting_filelist_filename = "setting-filelist.json"; 125 125 $storage_dir = dirname(__FILE__) . '/../storage'; 126 126 … … 132 132 133 133 switch ($cmd) { 134 case 'get_setting_filelist': 135 $path = ensure_storage_dir( $storage_dir , $num, $setting_filelist_filename ); 136 if( file_exists($path) ){ 137 $content = input_file( $path ); 138 } 139 else { 140 $content = get_path_info( $num ); 141 output_file( $path , $content ); 142 } 143 break; 144 case 'build': 145 break; 134 146 case 'get_content': 135 147 if (isset($_GET['path'])) { … … 146 158 $path = ensure_storage_dir( $storage_dir , $num, $filelist_filename ); 147 159 if( file_exists($path) ){ 148 $content = input_file( $ filename);160 $content = input_file( $path ); 149 161 } 150 162 else { -
branches/testa/settings.yml
r23 r25 2 2 url: https://toppers.jp 3 3 path: /var/www/vhosts/devconf.northern-cross.info/httpdocs/a/tmp/devconf-guest-4/tmp/md2site-x/_xtest/wtjx/t12/src 4 setting_path: /var/www/vhosts/devconf.northern-cross.info/httpdocs/a/tmp/devconf-guest-4/tmp/md2site-x/_xtest/wtjx/t12/conf 4 5 - 5 6 url: https://toppers.jp 6 7 path: /var/www/vhosts/devconf.northern-cross.info/httpdocs/a/tmp/devconf-guest-4/tmp/md2site-x/_xtest/wtjx/t12/src 8 setting_path: /var/www/vhosts/devconf.northern-cross.info/httpdocs/a/tmp/devconf-guest-4/tmp/md2site-x/_xtest/wtjx/t12/c
Note: See TracChangeset
for help on using the changeset viewer.
![(trac.ini の [header_logo] セクションを設定してください)](/python/trac/Flist/chrome/common/trac_logo_mini.png)