|
126 | 126 | {font-family:monospace;font-size:16px} |
127 | 127 |
|
128 | 128 | #item, #item2 |
129 | | - {margin:20px 0;border:1px solid lightgray;padding:10px;overflow:auto;display:flex;flex-direction:column;gap:10px} |
| 129 | + {margin:20px 0;border:1px solid lightgray;padding:10px;display:flex;flex-direction:column;gap:10px} |
| 130 | + |
| 131 | + |
| 132 | + #item #values, #item2 #values |
| 133 | + {display:grid;grid-template-columns:300px 300px 1fr;gap:0.5rem 1rem} |
| 134 | + |
| 135 | + #item:hover, #item2:hover |
| 136 | + {background: #f7f7f7} |
| 137 | + |
| 138 | + #item #name, #item2 #name |
| 139 | + {font-weight:bold} |
| 140 | + |
| 141 | + #item #type, #item2 #type |
| 142 | + {} |
| 143 | + |
| 144 | + #item #desc, #item2 #desc |
| 145 | + {line-height:1.4} |
| 146 | + |
| 147 | + |
130 | 148 |
|
131 | 149 |
|
132 | | -.#item, #item2 { |
133 | | - display: grid; |
134 | | - grid-template-columns: 120px 0 300px 1fr; |
135 | | - gap: 0.5rem 1rem; |
136 | | - padding: 0.75rem; |
137 | | - border-bottom: 1px solid #ddd; |
138 | | - text-decoration: none; |
139 | | - color: inherit; |
140 | | -} |
141 | | - |
142 | | -.#item:hover, #item2:hover { |
143 | | - background: #f7f7f7; |
144 | | -} |
145 | | - |
146 | | -.#item #name, #item2 #name |
147 | | - {} |
148 | | - |
149 | | -.#item #type, #item2 #type { |
150 | | - font-weight: bold; |
151 | | - color: #555; |
152 | | - font-family: monospace; |
153 | | - font-size:16px; |
154 | | -} |
155 | | - |
156 | | -.#item #desc, #item2 #desc { |
157 | | - line-height: 1.4; |
158 | | -} |
159 | | - |
160 | | - |
161 | | - |
162 | | - |
163 | 150 | #url |
164 | 151 | {font-weight:bold} |
165 | 152 |
|
|
331 | 318 | var values = $('#values'); |
332 | 319 | values.remove(); |
333 | 320 | var nvalues; |
334 | | - var clone = ()=>(nvalues=values.cloneNode(true),nitem.append(nvalues)); |
| 321 | + var clone = ()=>(nvalues=values.cloneNode(true),nitem.append(nvalues),nvalues); |
335 | 322 | output.append(nitem); |
336 | 323 |
|
337 | 324 | var iframe = document.createElement('iframe'); |
@@ -389,21 +376,29 @@ <h3> |
389 | 376 | console.log(arguments); |
390 | 377 | var afterKeys = new Set(Object.keys(win)); |
391 | 378 | var added = [...afterKeys].filter(k=>!beforeKeys.has(k)); |
392 | | - |
| 379 | + //console.log('New globals :', added); |
393 | 380 | var str = ''; |
394 | 381 | added.forEach(key=>{ |
395 | 382 |
|
396 | 383 | clone(); |
397 | 384 |
|
398 | | - var s1 = tostring(win[key]); |
399 | | - $(nvalues,'#name').textContent |
| 385 | + var dtype = datatype(win[key]); |
| 386 | + var type = typeof win[key]; |
| 387 | + var desc = tostring(win[key]); |
| 388 | + |
| 389 | + $(nvalues,'#name').textContent = key; |
| 390 | + $(nvalues,'#type').textContent = dtype + `( ${type} )`; |
| 391 | + $(nvalues,'#desc').textContent = desc; |
| 392 | + |
| 393 | + /* |
400 | 394 | var str = `window.${key} [ ${typeof win[key]} ] : ${s1}`+'\n'; |
401 | 395 | |
402 | 396 | nvalues.textContent = str; |
403 | 397 | console.log(`window.${key} =`,win[key]); |
| 398 | + */ |
| 399 | + |
404 | 400 | }); |
405 | 401 |
|
406 | | - console.log('New globals :', added); |
407 | 402 | }//onload |
408 | 403 |
|
409 | 404 | }//onload |
@@ -614,17 +609,20 @@ <h3> |
614 | 609 | var isNode = /process\.|__dirname|require\(/.test(code); |
615 | 610 | var isBrowser = /window\.|document\.|navigator\./.test(code); |
616 | 611 |
|
| 612 | + |
617 | 613 | var type = 'Unknown'; |
618 | 614 | if (isESM){ |
619 | 615 | type = 'ESM'; |
620 | | - }else if(isCommonJS){ |
| 616 | + } |
| 617 | + if(isCommonJS){ |
621 | 618 | type = 'CommonJS'; |
622 | 619 | } |
623 | 620 |
|
624 | 621 | if(isNode){ |
625 | | - type += ' (Node.js)'; |
626 | | - }else if(isBrowser){ |
627 | | - type += ' (Browser)'; |
| 622 | + type += ' ( Node.js )'; |
| 623 | + } |
| 624 | + if(isBrowser){ |
| 625 | + type += ' ( Browser )'; |
628 | 626 | } |
629 | 627 |
|
630 | 628 | return type; |
|
0 commit comments