Skip to content

Commit a4cdfd4

Browse files
save file
1 parent 1f03b2c commit a4cdfd4

File tree

1 file changed

+4
-243
lines changed

1 file changed

+4
-243
lines changed

html-components/list/snippet-console/snippet-console.html

Lines changed: 4 additions & 243 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,17 @@
1515

1616
<meta name=description content=''>
1717

18-
<base href='https://ext-code.com/html-components/list/snippet-console/snippet-console.html'>
19-
<link rel=canonical href='https://ext-code.com/html-components/list/snippet-console/snippet-console.html'>
20-
18+
<base href='https://ext-code.com/html-components/list/dir-tree/dir-tree.html'>
19+
<link rel=canonical href='https://ext-code.com/html-components/list/web-editor/web-editor.html'>
2120
<meta name=viewport content='width=device-width, initial-scale=1'>
22-
<link rel=icon href='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAMAAAAM7l6QAAAAaVBMVEVHcExfpvhYpPxapPtZo/lZpfxYpPtZpfxjp/Rxsv1ZpPpZpPtZpPpZpfxbpPheqPxcpvxorf1jqvxoputao/lbpPhmrP1ZpPtYo/tZo/hZpPtZpPqcyf+Rw/6Xxv+KwP6EvP53tf19uf1CLkbiAAAAHHRSTlMADp1YNLp7swf+YpU/wizc0vrpAiIX84VvHKlK4cmJ4wAAAVdJREFUKM+1ktmShCAMRVU2ARFxb5tF/f+PHIK92j1vM6myKuQYkns1y/4i8mEof6dlobX4hWHc09GtzfVSDZ/0qlvNg/Wr0SO7nOmlWb2zEN55Lj+WUsFat3O+ems3+g2HViLBuLfbdKaz8X5EkMnNBl2961tMsOuSanXr7N6iHOL+klqt3Y8r8yZuwRtGCCPyxgl3di0ODdrZYGgdA5H8wLXk1rUVpBQykeqY5Q/dcXgjajyNcfRNN2Z9P3TJbhKnB96OWzSHzzesCSGyThOjodEyeOxWpJZsEHioKcGxW4zc7LEzbCNv8KtoCit3SFwX40NLq7l+8wSRu3fEGLC7r/p07mDxYXl8gZ7RWBGKKXEcJ0GJzB8XFdH2SuESK/AAN5Ocri/2A5Yga5ZJ9+nPi7hk0FgBebr2xN2S8NJ9wxIhBZtShRCi5IRREQO2FpAUc5n9e/wA3jcXGxBAlmMAAAAASUVORK5CYII='>
23-
24-
25-
<script src='https://ajaxorg.github.io/ace-builds/src-noconflict/ace.js'></script>
26-
<script src='https://cdn.jsdelivr.net/npm/markdown-it/dist/markdown-it.min.js'></script>
27-
<link rel=stylesheet href='/css/github-markdown-light.css'>
2821

2922

3023
<script src='https://libs.ext-code.com/js/dom/component/v3.0/component.js?hdr'></script>
3124

3225
<script>
3326

34-
35-
var base = 'https://libs.ext-code.com/html/';
3627
var component = 'snippet-console';
28+
var date = '2026-02-17';
3729
var files = {
3830
'source' : {
3931
'latest' : null,
@@ -44,247 +36,16 @@
4436
},
4537
};
4638

47-
48-
var df=true,did='html'
49-
;
50-
51-
var ace;
52-
var md;
53-
var dirtree;
54-
var snippet;
55-
var editor;
56-
var log;
57-
58-
59-
async function init(){
60-
debug('init');
61-
62-
md = markdownit({
63-
html : true,
64-
breaks : false,
65-
linkify : true,
66-
linkTarget : '_blank',
67-
});
68-
69-
70-
dirtree = mod['dir-tree'];
71-
snippet = mod['snippet-html-console'];
72-
editor = mod['web-editor'];
73-
log = mod['log-mod'];
74-
75-
76-
await Promise.all([
77-
load(),
78-
mod.auto()
79-
]);
80-
81-
82-
initdom();
83-
84-
85-
}//init
86-
87-
88-
async function load(){
89-
90-
var {error,txt} = await get(base+component+'/readme.md');
91-
92-
if(error){
93-
md_txt = error;
94-
}else{
95-
md_txt = txt;
96-
}
97-
98-
}//load
99-
100-
10139
</script>
10240

103-
104-
<link rel=stylesheet href='../css/component.css' crossorigin=anonymous>
105-
106-
<style>
107-
</style>
108-
10941
</head>
11042

11143
<body>
11244

113-
114-
<html-components-hdr v2.0 component=grp1>
115-
<h2 slot=title>
116-
snippet-console
117-
</h2>
118-
<time slot=date datetime=2026-02-10>
119-
10 Feb 2026
120-
</time>
121-
</html-components-hdr>
122-
123-
124-
<div id=readme class=markdown-body></div>
125-
126-
<hr>
127-
128-
<section>
129-
130-
<h3>
131-
files
132-
</h3>
133-
<div>
134-
( click to view )
135-
</div>
136-
137-
<dir-tree component></dir-tree>
138-
139-
</section>
140-
141-
<div id=view-hdr>
142-
</div>
143-
144-
<div id=view style='display:none'>
145-
<snippet-html-console component></snippet-html-console>
146-
<web-editor component fullsize></web-editor>
147-
</div>
148-
149-
150-
<log-mod component></log-mod>
45+
<page-html v1.0 component=grp style='display:block'></page-html>
15146

15247
</body>
15348

154-
<script>
155-
156-
157-
var md_txt;
158-
var cache = {};
159-
160-
161-
var callback = {};
162-
var show = {};
163-
164-
165-
166-
//:
167-
168-
169-
async function initdom(){
170-
debug('initdom');
171-
172-
var html = md.render(md_txt);
173-
$('#readme').innerHTML = html;
174-
175-
176-
files = dirtree.build(files);
177-
dirtree.display(files,{callback});
178-
179-
180-
await show.examples();
181-
$('#view').style.display = '';
182-
183-
184-
}//initdom
185-
186-
187-
//:
188-
189-
190-
callback.file = function(name,o){
191-
192-
var par = o.parent.name;
193-
debug(par,name);
194-
switch(par){
195-
196-
case 'source' : show.source(name); break;
197-
case 'examples' : show.examples(name); break;
198-
199-
}//switch
200-
201-
}//show
202-
203-
204-
show.source = async function(file){
205-
206-
$('#view-hdr').textContent = 'source : '+file;
207-
$('web-editor').style.display = '';
208-
$('snippet-html-console').style.display = 'none';
209-
210-
var url = base+component+'/';
211-
if(file=='latest'){
212-
url += `${component}.html`;
213-
}else{
214-
url += `${file}/${component}-${file}.html`;
215-
}
216-
217-
var {txt} = await get(url);
218-
if(!txt)return;
219-
editor.setvalue(txt);
220-
editor.filename(file);
221-
222-
}//source
223-
224-
225-
show.examples = async function(file){
226-
227-
if(!file){
228-
file = files[1].list[0].name;
229-
}
230-
231-
$('#view-hdr').textContent = 'examples : '+file;
232-
$('web-editor').style.display = 'none';
233-
$('snippet-html-console').style.display = '';
234-
235-
var url = base+component+'/examples/'+file;
236-
var {txt} = await get(url);
237-
if(!txt)return;
238-
239-
snippet.editor.setvalue(txt);
240-
snippet.editor.filename(file);
241-
snippet.clear();
242-
243-
}//example
244-
245-
246-
async function get(url){
247-
debug('get',url);
248-
if(cache[url]){
249-
debug('cache');
250-
return {txt:cache[url]};
251-
}
252-
253-
var err;
254-
try{
255-
256-
var res = await fetch(url);
257-
258-
}//try
259-
catch(err2){
260-
261-
err = err2;
262-
263-
}//catch
264-
if(err){
265-
var error = err.toString();
266-
log.red(error);
267-
return {error};
268-
}
269-
if(!res.ok){
270-
var error = await res.text();
271-
log.red(error);
272-
return {error};
273-
}
274-
275-
var txt = await res.text();
276-
cache[url] = txt;
277-
return {txt};
278-
279-
}//get
280-
281-
282-
283-
284-
285-
286-
</script>
287-
28849
</html>
28950

29051

0 commit comments

Comments
 (0)