@zjy4fun/json-open 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.html +5 -23
- package/package.json +1 -1
package/index.html
CHANGED
|
@@ -477,11 +477,10 @@
|
|
|
477
477
|
<div class="panel panel-left" id="panel-left">
|
|
478
478
|
<div class="panel-header">
|
|
479
479
|
<span class="label">Input</span>
|
|
480
|
-
<button id="btn-format" class="primary"
|
|
481
|
-
<button id="btn-copy"
|
|
482
|
-
<button id="btn-sample">Sample</button>
|
|
480
|
+
<button id="btn-format" class="primary">✨ Format</button>
|
|
481
|
+
<button id="btn-copy">📋 Copy</button>
|
|
483
482
|
<button id="btn-clear">Clear</button>
|
|
484
|
-
<button id="btn-share"
|
|
483
|
+
<button id="btn-share">🔗 Share</button>
|
|
485
484
|
</div>
|
|
486
485
|
<textarea class="input-area" id="json-input" placeholder="Paste or type JSON here..." spellcheck="false"></textarea>
|
|
487
486
|
</div>
|
|
@@ -664,7 +663,6 @@
|
|
|
664
663
|
var viewer = document.getElementById('viewer')
|
|
665
664
|
var btnFormat = document.getElementById('btn-format')
|
|
666
665
|
var btnCopy = document.getElementById('btn-copy')
|
|
667
|
-
var btnSample = document.getElementById('btn-sample')
|
|
668
666
|
var btnClear = document.getElementById('btn-clear')
|
|
669
667
|
var btnShare = document.getElementById('btn-share')
|
|
670
668
|
var btnExpandAll = document.getElementById('expand-all')
|
|
@@ -740,27 +738,11 @@
|
|
|
740
738
|
if (!text) return
|
|
741
739
|
navigator.clipboard.writeText(text).then(function () {
|
|
742
740
|
var orig = btnCopy.textContent
|
|
743
|
-
btnCopy.textContent = 'Copied!'
|
|
741
|
+
btnCopy.textContent = '✅ Copied!'
|
|
744
742
|
setTimeout(function () { btnCopy.textContent = orig }, 1500)
|
|
745
743
|
})
|
|
746
744
|
})
|
|
747
745
|
|
|
748
|
-
btnSample.addEventListener('click', function () {
|
|
749
|
-
jsonInput.value = JSON.stringify({
|
|
750
|
-
name: 'json-open',
|
|
751
|
-
version: '0.2.1',
|
|
752
|
-
description: 'Open JSON in browser with interactive tree view',
|
|
753
|
-
features: ['collapsible tree', 'search & highlight', 'dark theme', 'auto-parse nested JSON'],
|
|
754
|
-
author: { name: 'zjy4fun', github: 'https://github.com/zjy4fun' },
|
|
755
|
-
stats: { stars: 42, forks: 7, issues: 3 },
|
|
756
|
-
tags: ['json', 'viewer', 'cli', 'browser'],
|
|
757
|
-
nested_json: '{"deeply": {"embedded": "json string"}}',
|
|
758
|
-
active: true,
|
|
759
|
-
license: 'MIT'
|
|
760
|
-
}, null, 2)
|
|
761
|
-
doFormat()
|
|
762
|
-
})
|
|
763
|
-
|
|
764
746
|
btnClear.addEventListener('click', function () {
|
|
765
747
|
jsonInput.value = ''
|
|
766
748
|
viewer.innerHTML = '<div class="empty-state"><div class="icon">{ }</div><div>Paste JSON on the left and click <b>Format</b></div><div style="font-size:12px">or press Ctrl+Enter</div></div>'
|
|
@@ -793,7 +775,7 @@
|
|
|
793
775
|
var url = location.origin + location.pathname + '#json=' + encoded
|
|
794
776
|
navigator.clipboard.writeText(url).then(function () {
|
|
795
777
|
var orig = btnShare.textContent
|
|
796
|
-
btnShare.textContent = 'Link copied!'
|
|
778
|
+
btnShare.textContent = '✅ Link copied!'
|
|
797
779
|
statusInfo.textContent = 'Share link copied (' + formatBytes(url.length) + ')'
|
|
798
780
|
setTimeout(function () { btnShare.textContent = orig }, 2000)
|
|
799
781
|
})
|