@zjy4fun/json-open 0.3.1 → 0.3.3
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 -36
- package/package.json +1 -1
package/index.html
CHANGED
|
@@ -477,11 +477,9 @@
|
|
|
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-
|
|
483
|
-
<button id="btn-clear">Clear</button>
|
|
484
|
-
<button id="btn-share">Share</button>
|
|
480
|
+
<button id="btn-format" class="primary">✨ Format</button>
|
|
481
|
+
<button id="btn-copy">📋 Copy</button>
|
|
482
|
+
<button id="btn-share">🔗 Share</button>
|
|
485
483
|
</div>
|
|
486
484
|
<textarea class="input-area" id="json-input" placeholder="Paste or type JSON here..." spellcheck="false"></textarea>
|
|
487
485
|
</div>
|
|
@@ -664,8 +662,6 @@
|
|
|
664
662
|
var viewer = document.getElementById('viewer')
|
|
665
663
|
var btnFormat = document.getElementById('btn-format')
|
|
666
664
|
var btnCopy = document.getElementById('btn-copy')
|
|
667
|
-
var btnSample = document.getElementById('btn-sample')
|
|
668
|
-
var btnClear = document.getElementById('btn-clear')
|
|
669
665
|
var btnShare = document.getElementById('btn-share')
|
|
670
666
|
var btnExpandAll = document.getElementById('expand-all')
|
|
671
667
|
var btnCollapseAll = document.getElementById('collapse-all')
|
|
@@ -740,38 +736,11 @@
|
|
|
740
736
|
if (!text) return
|
|
741
737
|
navigator.clipboard.writeText(text).then(function () {
|
|
742
738
|
var orig = btnCopy.textContent
|
|
743
|
-
btnCopy.textContent = 'Copied!'
|
|
739
|
+
btnCopy.textContent = '✅ Copied!'
|
|
744
740
|
setTimeout(function () { btnCopy.textContent = orig }, 1500)
|
|
745
741
|
})
|
|
746
742
|
})
|
|
747
743
|
|
|
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
|
-
btnClear.addEventListener('click', function () {
|
|
765
|
-
jsonInput.value = ''
|
|
766
|
-
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>'
|
|
767
|
-
statusInfo.textContent = 'Ready'
|
|
768
|
-
statusSize.textContent = ''
|
|
769
|
-
toggleWrap.classList.add('hidden')
|
|
770
|
-
currentParsed = null
|
|
771
|
-
currentDeepParsed = null
|
|
772
|
-
clearSearch()
|
|
773
|
-
})
|
|
774
|
-
|
|
775
744
|
// ===== Share =====
|
|
776
745
|
btnShare.addEventListener('click', function () {
|
|
777
746
|
var input = jsonInput.value.trim()
|
|
@@ -793,7 +762,7 @@
|
|
|
793
762
|
var url = location.origin + location.pathname + '#json=' + encoded
|
|
794
763
|
navigator.clipboard.writeText(url).then(function () {
|
|
795
764
|
var orig = btnShare.textContent
|
|
796
|
-
btnShare.textContent = 'Link copied!'
|
|
765
|
+
btnShare.textContent = '✅ Link copied!'
|
|
797
766
|
statusInfo.textContent = 'Share link copied (' + formatBytes(url.length) + ')'
|
|
798
767
|
setTimeout(function () { btnShare.textContent = orig }, 2000)
|
|
799
768
|
})
|