@@ -19,10 +19,13 @@ const css = `body {
1919}
2020#optionBar {
2121 user-select: none;
22- display: block;
2322 position: absolute;
24- top: 13px;
25- right: 15px;
23+ z-index: 10;
24+ top: 8px;
25+ right: 10px;
26+ background: #fff;
27+ box-shadow: 0px 0px 3px 3px #fff;
28+ padding: 5px;
2629}
2730#buttonFormatted,
2831#buttonPlain {
@@ -78,6 +81,7 @@ const css = `body {
7881 padding-left: 20px;
7982 margin-left: -20px;
8083 position: relative;
84+ content-visibility: auto;
8185}
8286#jsonFormatterParsed {
8387 padding-left: 28px;
@@ -226,6 +230,9 @@ a:active {
226230
227231#optionBar {
228232 -webkit-font-smoothing: subpixel-antialiased;
233+
234+ background: #1a1a1a;
235+ box-shadow: 0px 0px 3px 3px #1a1a1a;
229236}
230237
231238#jsonFormatterParsed {
@@ -466,17 +473,6 @@ const resultPromise = (async (): Promise<{
466473 const rootEntry = buildDom ( parsedJsonRootStruct , false )
467474 await Promise . resolve ( )
468475 parsedJsonContainer . append ( rootEntry )
469-
470- // Export parsed JSON for easy access in console - DISABLED; doesn't work with manifest v3 - maybe re-enable later via background worker somehow
471- // @ts -ignore
472- // window.json = parsedJsonValue
473- // Object.defineProperty(window, 'json', {
474- // value: parsedJsonValue,
475- // configurable: true,
476- // enumerable: false, // keep it tidy in console auto-complete
477- // writable: false,
478- // })
479- // console.log('JSON Formatter: Type "json" to inspect.')
480476 }
481477
482478 // hide the pretty-print bar
@@ -493,28 +489,9 @@ const resultPromise = (async (): Promise<{
493489 }
494490
495491 function collapse ( elements : HTMLElement [ ] | HTMLCollection ) {
496- let el , i , blockInner
497-
498- for ( i = elements . length - 1 ; i >= 0 ; i -- ) {
499- el = elements [ i ]
500- el . classList . add ( 'collapsed' )
501-
502- // (CSS hides the contents and shows an ellipsis.)
503-
504- // Add a count of the number of child properties/items
505- // if (!el.id) {
506- // // TODO why is this id check needed?
507- // // Find the blockInner
508- // blockInner = el.firstElementChild
509- // while (blockInner && !blockInner.classList.contains('blockInner')) {
510- // blockInner = blockInner.nextElementSibling
511- // }
512- // if (!blockInner) continue // ???
513- // // ??? this continue has no effect, as the for-loop conitinues after this anyway, right?
514- // // >>> so what is the point of this entire `if (!el.id)` block?
515- // // original comment says "Add a count of the number of child properties/items"
516- // // but that feature seems to be working fine, despite this block doing nothing
517- // }
492+ for ( let i = elements . length - 1 ; i >= 0 ; i -- ) {
493+ const el = elements [ i ]
494+ el . classList . add ( 'collapsed' ) // hides contents and shows an ellipsis
518495 }
519496 }
520497
0 commit comments