Skip to content

Commit 5d2d6c8

Browse files
save file
1 parent 091a7a1 commit 5d2d6c8

File tree

1 file changed

+66
-63
lines changed

1 file changed

+66
-63
lines changed

utils/editors/js-console/html/output-console/output-console.html

Lines changed: 66 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,34 @@
55
<template shadowrootmode=open>
66

77
<style>
8-
8+
99
:host
1010
{font-family:arial}
11-
11+
1212
#root
1313
{height:100%;display:flex;flex-direction:column}
1414
#hdr
1515
{display:flex;align-items:center;margin:0;margin-bottom:5px}
16-
16+
1717
#spc
1818
{flex:1}
19-
19+
2020
.ext-button
2121
{border:1px solid lightgray;padding:2px 5px;cursor:pointer;display:flex;align-items:center;margin-right:10px}
2222
.ext-button [type=checkbox]
2323
{margin:0;margin-left:5px;cursor:pointer}
24-
24+
2525
button
2626
{font-size:16px;margin-right:10px}
27-
27+
2828
#output
2929
{flex:1;
3030
overflow:auto;border:2px solid lightgray;box-sizing:border-box;
3131
padding:10px;margin:0;
3232
word-break:break-all;
3333
font-size:16px;line-height:1.5;
3434
}
35-
35+
3636
</style>
3737

3838
<div id=root>
@@ -58,23 +58,23 @@
5858
var obj = {
5959
version : 'v2.0',
6060
};
61-
62-
61+
62+
6363
var ext,$
6464
;
6565

6666
obj.initmod = function(params){
67-
67+
6868
ext = params.ext;
6969
$ = params.$;
7070

7171
}//initmod
7272

7373

7474
//vars:-
75-
76-
var inspect;
7775

76+
var inspect;
77+
7878
var con = {};
7979
con.log = console.log;
8080
con.clear = console.clear;
@@ -89,33 +89,33 @@
8989

9090
var iframe;
9191
obj.iframe;
92-
93-
92+
93+
9494

9595
var chk = {};
9696
var btn = {};
97-
97+
9898

9999
//:
100-
100+
101101

102102
obj.init = async function(){
103103

104104
await libs();
105105

106106
}//init
107-
108-
107+
108+
109109
async function libs(){
110-
110+
111111
[inspect] = await ext.load.libs('js/string/inspect.js');
112112
console.log(inspect);
113113

114114
}//libs
115-
115+
116116

117117
//:
118-
118+
119119

120120
obj.initdom = function(rootnode){
121121

@@ -131,23 +131,23 @@
131131

132132
output = $(shadow,'#output');
133133
cur.root = output;
134-
135-
134+
135+
136136
wrap(chk.wrap.checked);
137-
137+
138138

139139
}//initdom
140140

141141

142142
btn.kill = function(){
143-
143+
144144
kill();
145145

146146
}//kill
147147

148148

149149
btn.clear = function(){
150-
150+
151151
clear();
152152

153153
}//clear
@@ -162,7 +162,7 @@
162162
}
163163

164164
}//wrap
165-
165+
166166

167167
obj.run = async function(js,params={}){
168168
console.log('run');
@@ -179,7 +179,7 @@
179179
console.groupEnd = window.console.groupEnd.bind(window.console);
180180
console.trace = window.console.trace.bind(window.console);
181181
console.info = window.console.info.bind(window.console);
182-
182+
183183

184184
async function run(js){
185185

@@ -202,7 +202,7 @@
202202

203203

204204
return run;
205-
205+
206206
})();
207207

208208
var result = await sandbox(js);
@@ -216,7 +216,7 @@
216216
//console.error = con.error;
217217

218218

219-
219+
220220
}//run
221221

222222

@@ -238,13 +238,13 @@
238238

239239

240240
async function onload(){
241-
241+
242242
setTimeout(complete,100);
243243

244244
}//onload
245245

246246
async function complete(){
247-
247+
248248
var win = iframe.contentWindow;
249249
win.focus();
250250
win.console.log = log;
@@ -272,16 +272,16 @@
272272
obj.kill = function(){return kill()}
273273

274274
function kill(){
275-
275+
276276
if(!iframe)return;
277277
iframe.remove();
278278

279279
}//kill
280-
281-
282-
280+
281+
282+
283283
obj.set = function(root){
284-
284+
285285
if(root){
286286
cur.root = root;
287287
}else{
@@ -290,15 +290,15 @@
290290

291291
}//set
292292

293-
293+
294294
//:
295295

296296

297-
297+
298298
obj.clear = function(){return clear()}
299299

300300
function clear(){
301-
301+
302302
if(chk.log.checked){
303303
con.clear.call(window.console);
304304
}
@@ -311,33 +311,36 @@
311311
obj.log = function(){return log.apply(log,arguments)};
312312

313313
function log(){
314-
314+
315315
if(chk.log.checked){
316-
con.log.apply(window.console,arguments);
316+
//con.log.apply(window.console,arguments);
317+
window.console.groupCollapsed.apply(window.console,arguments);
318+
window.console.trace();
319+
window.console.groupEnd();
317320
}
318-
321+
319322
var txt = build(arguments);
320323
var div = document.createElement('div');
321324
div.textContent = txt;
322325
cur.root.append(div);
323326

324327
cur.node = div;
325-
328+
326329
if(txt==''){
327330
div.style.height = '16px';
328331
}
329332

330333
cur.root.scrollTop = 999999999;
331334

332335
return div;
333-
336+
334337
}//log
335-
336-
338+
339+
337340
obj.error = function(){return error.apply(null,arguments)}
338341

339342
function error(){
340-
343+
341344
if(chk.log.checked){
342345
con.error.apply(window.console,arguments);
343346
}
@@ -353,7 +356,7 @@
353356
obj.node = function(){return node.apply(null,arguments)}
354357

355358
function node(node){
356-
359+
357360
node = create(node);
358361

359362
cur.root.append(node);
@@ -367,7 +370,7 @@
367370
obj.write = function(){return write.apply(null,arguments)}
368371

369372
function write(){
370-
373+
371374
var txt = build(arguments);
372375

373376
var span = document.createElement('span');
@@ -382,12 +385,12 @@
382385

383386
}//write
384387

385-
388+
386389
//:
387390

388391

389392
function build(args){
390-
393+
391394
var str = '';
392395
var args = [...args];
393396
args = args.map(v=>{
@@ -407,25 +410,25 @@
407410

408411
var txt = args.join(' ');
409412
return txt;
410-
413+
411414
}//build
412-
413-
415+
416+
414417
function create(node){
415-
418+
416419
var type = datatype(node);
417420
switch(type){
418-
421+
419422
case 'string' : node = create.string(node); break;
420423

421424
}//switch
422-
return node;
425+
return node;
423426

424427
}//create
425428

426429

427430
create.string = function(str){
428-
431+
429432
var node = document.createElement(str);
430433
return node;
431434

@@ -436,20 +439,20 @@
436439

437440

438441
obj.horiz = function(){
439-
442+
440443
host.style.width = '100%';
441444
host.style.height = '50%';
442445

443446
}//horiz
444447

445448

446449
obj.vert = function(){
447-
450+
448451
host.style.width = '50%';
449452
host.style.height = '100%';
450453

451454
}//vert
452-
455+
453456

454457
//:
455458

@@ -458,7 +461,7 @@
458461
return obj;
459462

460463
})//output_console
461-
464+
462465
</script>
463466

464467
</output-console>

0 commit comments

Comments
 (0)