|
26 | 26 | <script src='https://cdn.jsdelivr.net/npm/markdown-it/dist/markdown-it.min.js'></script> |
27 | 27 | <link rel=stylesheet href='/css/github-markdown-light.css'> |
28 | 28 |
|
| 29 | + <link rel=stylesheet href='https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css'> |
| 30 | + <link rel=stylesheet href='https://cdn.jsdelivr.net/npm/wunderbaum@0/dist/wunderbaum.min.css'> |
| 31 | + <script src='https://cdn.jsdelivr.net/npm/wunderbaum@0/dist/wunderbaum.umd.min.js'></script> |
| 32 | + |
29 | 33 |
|
30 | 34 | <script src='https://libs.ext-code.com/js/dom/component/component.js?init'></script> |
31 | 35 |
|
32 | 36 | <script> |
33 | 37 |
|
34 | | - |
35 | | - async function init(){ |
| 38 | + var df=true,did='html' |
| 39 | + ; |
36 | 40 |
|
| 41 | + var ace; |
| 42 | + var md; |
| 43 | + var snippet; |
| 44 | + var editor; |
37 | 45 |
|
| 46 | + |
| 47 | + async function init(){ |
| 48 | + console.log('init'); |
| 49 | + |
| 50 | + md = markdownit(); |
| 51 | + |
| 52 | + await load(); |
| 53 | + |
| 54 | + |
| 55 | + snippet = mod['snippet-html-console']; |
| 56 | + editor = mod['web-editor']; |
| 57 | + |
38 | 58 | await mod.auto(); |
39 | 59 |
|
40 | 60 |
|
| 61 | + initdom(); |
| 62 | + |
41 | 63 |
|
42 | 64 | }//init |
43 | 65 |
|
44 | 66 |
|
| 67 | + async function load(){ |
| 68 | + |
| 69 | + txt = await fetch('readme.md').then(res=>res.text()); |
| 70 | + |
| 71 | + }//load |
| 72 | + |
| 73 | + |
45 | 74 | </script> |
46 | 75 |
|
47 | 76 | <style> |
48 | 77 |
|
| 78 | + |
| 79 | + html |
| 80 | + {height:100%;font-family:arial} |
| 81 | + |
| 82 | + |
| 83 | + body |
| 84 | + {height:calc(100% - 40px);display:flex;flex-direction:column;gap:20px;align-items:center;margin:20px;padding-bottom:200px} |
| 85 | + |
| 86 | + |
| 87 | + body>* |
| 88 | + {max-width:1400px;width:100%;padding:0 20px;} |
| 89 | + |
| 90 | + [component],config |
| 91 | + {display:none} |
| 92 | + |
| 93 | + input |
| 94 | + {font-size:16px;padding:5px 10px} |
| 95 | + input[type=button] |
| 96 | + {cursor:pointer} |
| 97 | + input[type=checkbox] |
| 98 | + {width:15px;height:15px;margin:0} |
| 99 | + |
| 100 | + |
| 101 | + #demo-tree |
| 102 | + {margin:50px 0;height:auto !important;border:none !important;overflow:visible;box-sizing:border-box;outline:none} |
| 103 | + |
| 104 | + |
49 | 105 | </style> |
50 | 106 |
|
51 | 107 | </head> |
52 | 108 |
|
53 | 109 | <body> |
54 | 110 |
|
55 | | - <div id=output class=markdown-body> |
| 111 | + |
| 112 | + <html-components-hdr component=grp1> |
| 113 | + <h2 class=title style='top:10px'>web-console</h2> |
| 114 | + <time slot=date datetime=2026-01-04>04 Jan 2026</time> |
| 115 | + </html-components-hdr> |
| 116 | + |
| 117 | + |
| 118 | + <div id=readme class=markdown-body></div> |
| 119 | + |
| 120 | + <section> |
| 121 | + |
| 122 | + <h3> |
| 123 | + files |
| 124 | + </h3> |
| 125 | + |
| 126 | + <div id=demo-tree class='wb-skeleton wb-initializing wb-fade-expander'></div> |
| 127 | + |
| 128 | + </section> |
| 129 | + |
| 130 | + <div id=view style='display:none'> |
| 131 | + <snippet-html-console component></snippet-html-console> |
| 132 | + <web-editor component></web-editor> |
56 | 133 | </div> |
57 | 134 |
|
58 | 135 |
|
|
61 | 138 | <script> |
62 | 139 |
|
63 | 140 |
|
| 141 | + var txt; |
| 142 | + |
| 143 | + |
| 144 | + //: |
| 145 | + |
| 146 | + |
64 | 147 | function initdom(){ |
| 148 | + debug('initdom'); |
| 149 | + |
| 150 | + var html = md.render(txt); |
| 151 | + $('#readme').innerHTML = html; |
| 152 | + |
| 153 | + |
| 154 | + var node = $('#demo-tree'); |
| 155 | + var tree = new mar10.Wunderbaum({ |
| 156 | + element:node, |
| 157 | + source: files, |
| 158 | + init:e=>{e.tree.setFocus()}, |
| 159 | + activate:show |
| 160 | + }); |
| 161 | + |
| 162 | + |
65 | 163 | }//initdom |
66 | 164 |
|
67 | 165 |
|
| 166 | + //: |
| 167 | + |
| 168 | + |
| 169 | + function show(e){ |
| 170 | + |
| 171 | + var depth = e=>{ |
| 172 | + |
| 173 | + var c = 0; |
| 174 | + var node = e.node; |
| 175 | + |
| 176 | + while(node.parent){ |
| 177 | + |
| 178 | + c++; |
| 179 | + node = node.parent; |
| 180 | + |
| 181 | + }//while |
| 182 | + return c; |
| 183 | + |
| 184 | + }//depth |
| 185 | + |
| 186 | + var d = depth(e); |
| 187 | + console.log(d,e.node.title); |
| 188 | + console.log(`Thank you for activating ${e.node}.`); |
| 189 | + |
| 190 | + |
| 191 | + }//show |
| 192 | + |
| 193 | + |
68 | 194 | </script> |
69 | 195 |
|
70 | 196 |
|
71 | 197 | <script> |
72 | 198 |
|
73 | | - var data = { |
74 | | - }; |
| 199 | + |
| 200 | + |
| 201 | + |
| 202 | + var files = [ |
| 203 | + |
| 204 | + { |
| 205 | + title: 'source', |
| 206 | + expanded: true, |
| 207 | + children: [ |
| 208 | + {title:'latest'}, |
| 209 | + {title:'v2.0'} |
| 210 | + ], |
| 211 | + }, |
| 212 | + |
| 213 | + { |
| 214 | + title: 'examples', |
| 215 | + expanded:true, |
| 216 | + children:[ |
| 217 | + {title:'simple example'} |
| 218 | + ] |
| 219 | + }, |
| 220 | + |
| 221 | + ]; |
| 222 | + |
75 | 223 |
|
76 | | - data.readme = ` |
77 | | - `; |
78 | 224 |
|
79 | 225 | </script> |
| 226 | + |
80 | 227 | </html> |
81 | 228 |
|
82 | 229 |
|
0 commit comments