Skip to content

Commit a70e645

Browse files
save file
1 parent 560b94d commit a70e645

File tree

1 file changed

+2
-255
lines changed

1 file changed

+2
-255
lines changed

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

Lines changed: 2 additions & 255 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,14 @@
1919
<link rel=canonical href='https://ext-code.com/html-components/list/snippet-html-console/snippet-html-console.html'>
2020

2121
<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'>
2822

2923

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

3226
<script>
3327

34-
3528
var component = 'snippet-html-console';
36-
var date = '2026-02-10';
29+
var date = '2026-02-17';
3730
var files = {
3831
'source' : {
3932
'v2.0' : null,
@@ -45,262 +38,16 @@
4538
},
4639
};
4740

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

107-
108-
<link rel=stylesheet href='../css/component.css' crossorigin=anonymous>
109-
110-
<style>
111-
</style>
112-
11343
</head>
11444

11545
<body>
11646

117-
118-
<html-components-hdr v2.0 component=grp1>
119-
<h2 slot=title>
120-
snippet-html-console
121-
</h2>
122-
<time slot=date datetime=2026-02-10>
123-
10 Feb 2026
124-
</time>
125-
</html-components-hdr>
126-
127-
<script>
128-
/*
129-
{
130-
let hdr = document.querySelector('html-components-hdr');
131-
hdr.querySelector('h2').textContent = component;
132-
hdr.querySelector('time').setAttribute('datetime',date);
133-
let d = new Date(date);
134-
let formatted = d.toLocaleDateString('en-GB',{day:'2-digit',month:'short',year:'numeric'});
135-
hdr.querySelector('time').textContent = formatted;
136-
}
137-
*/
138-
</script>
139-
140-
141-
<div id=readme class=markdown-body></div>
142-
143-
<hr>
144-
145-
<section>
146-
147-
<h3>
148-
files
149-
<span style='font-size:16px;font-weight:normal'>
150-
( click to view )
151-
</span>
152-
</h3>
153-
154-
<dir-tree component></dir-tree>
155-
156-
</section>
157-
158-
<div id=view-hdr>
159-
</div>
160-
161-
<div id=view style='display:none'>
162-
<snippet-html-console component></snippet-html-console>
163-
<web-editor component fullsize></web-editor>
164-
</div>
165-
166-
167-
<log-mod component></log-mod>
47+
<page-html v1.0 component=grp style='display:block'></page-html>
16848

16949
</body>
17050

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

30653

0 commit comments

Comments
 (0)