Skip to content

Commit cddc145

Browse files
committed
init
0 parents  commit cddc145

24 files changed

+1295
-0
lines changed

.gitignore

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Dependencies
2+
node_modules/
3+
package-lock.json
4+
yarn.lock
5+
pnpm-lock.yaml
6+
7+
# Build outputs
8+
dist/
9+
dist.zip
10+
build/
11+
.output/
12+
.nuxt/
13+
.cache/
14+
15+
# IDE and editor files
16+
.idea/
17+
.vscode/
18+
*.swp
19+
*.swo
20+
.DS_Store
21+
Thumbs.db
22+
23+
# Environment files
24+
.env
25+
.env.*
26+
!.env.example
27+
28+
# Logs
29+
logs/
30+
*.log
31+
npm-debug.log*
32+
yarn-debug.log*
33+
yarn-error.log*
34+
35+
# Testing
36+
coverage/
37+
.nyc_output/
38+
39+
# Temporary files
40+
*.tmp
41+
*.temp
42+
.tmp/
43+
temp/
44+
45+
# Browser Extensions
46+
*.crx
47+
*.pem
48+
*.zip
49+
50+
# Optional
51+
.history/
52+
.eslintcache

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 - 7 Angle
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

PRIVACY.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Privacy Policy for JSON Pilot
2+
3+
Last updated: 1-May-2025
4+
5+
## Introduction
6+
7+
This Privacy Policy describes how JSON Pilot ("we", "us", or "our") collects, uses, and handles your information when you use our browser extension. We are committed to protecting your privacy and ensuring you understand how your data is handled.
8+
9+
## Information We Collect
10+
11+
### JSON Data Viewing
12+
- The extension processes JSON content that appears in your browser
13+
- This processing happens entirely locally within your browser
14+
- We do not collect, store, or transmit any of the JSON data you view
15+
16+
### User Preferences
17+
- We store your theme preference (light/dark mode) locally in your browser's storage
18+
- These preferences are only used to enhance your user experience
19+
- No user preferences are transmitted to external servers
20+
21+
## Data Storage
22+
23+
### Local Storage
24+
- All data processing occurs locally in your browser
25+
- User preferences are stored using the browser's local storage mechanism
26+
- No data is stored on external servers
27+
28+
### Browser Permissions
29+
The extension requires the following permissions:
30+
- `scripting`: To inject the JSON viewer interface
31+
- `storage`: To save your theme preferences locally
32+
- `host_permissions`: To detect and format JSON content on web pages
33+
34+
## Data Transmission
35+
36+
### No External Communication
37+
- The extension operates entirely offline
38+
- No data is sent to external servers
39+
- No analytics or tracking mechanisms are implemented
40+
41+
## Third-Party Services
42+
43+
- This extension does not integrate with any third-party services
44+
- No third-party analytics or tracking tools are used
45+
- No user data is shared with any external parties
46+
47+
## Your Rights
48+
49+
You have the right to:
50+
- Use the extension without providing any personal information
51+
- Clear your local storage at any time through your browser settings
52+
- Uninstall the extension at any time
53+
54+
## Children's Privacy
55+
56+
- This extension does not knowingly collect any personal information from children
57+
- All data processing is limited to JSON content viewing and formatting
58+
59+
## Changes to This Privacy Policy
60+
61+
We may update this Privacy Policy from time to time. We will notify you of any changes by posting the new Privacy Policy on our GitHub repository. You are advised to review this Privacy Policy periodically for any changes.
62+
63+
## Contact Us
64+
65+
If you have any questions about this Privacy Policy, please contact us:
66+
- GitHub: [https://github.com/7angle/json-pilot](https://github.com/7angle/json-pilot)
67+
- Email: hello@7angle.com
68+
69+
## Compliance
70+
71+
This Privacy Policy is designed to be compliant with major privacy regulations and to be transparent about our data handling practices. We are committed to protecting your privacy and ensuring the security of your data.

README.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# JSON Viewer Browser Extension
2+
3+
A powerful browser extension for viewing, formatting, and exploring JSON content in your browser. Works with both Chrome and Firefox.
4+
5+
## Features
6+
7+
- 🎨 Automatic JSON detection and formatting
8+
- 🌳 Collapsible and expandable JSON tree view
9+
- 🔍 Search within JSON content
10+
- 📋 Copy JSON paths and values
11+
- 🎭 Light/Dark theme support
12+
- 🗺️ Optional minimap for navigation
13+
- 🔧 Customizable initial expansion depth
14+
- ⚡ Performance optimized for large JSON files
15+
16+
## Installation
17+
18+
### Chrome
19+
1. Clone this repository
20+
2. Open Chrome and navigate to `chrome://extensions`
21+
3. Enable "Developer mode" in the top right
22+
4. Click "Load unpacked" and select the extension directory
23+
24+
### Firefox
25+
1. Clone this repository
26+
2. Open Firefox and navigate to `about:debugging`
27+
3. Click "This Firefox" in the sidebar
28+
4. Click "Load Temporary Add-on" and select the `manifest.json` file
29+
30+
## Development
31+
32+
### Prerequisites
33+
- Modern web browser (Chrome 88+ or Firefox 109+)
34+
- Basic understanding of web technologies
35+
36+
### Project Structure
37+
```
38+
json-viewer/
39+
├── manifest.json # Extension manifest
40+
├── background.js # Background script
41+
├── content.js # Content script
42+
├── viewer.html # JSON viewer interface
43+
├── viewer.css # Styles for the viewer
44+
├── viewer.js # Viewer functionality
45+
└── icons/ # Extension icons
46+
```
47+
48+
### Building
49+
No build step required! The extension can be loaded directly into browsers in development mode.
50+
51+
## Usage
52+
53+
1. Navigate to any URL that returns JSON content
54+
2. The extension will automatically detect and format the JSON
55+
3. Use the toolbar to:
56+
- Expand/collapse nodes
57+
- Search within the JSON
58+
- Copy JSON paths
59+
- Toggle dark/light theme
60+
- Show/hide minimap
61+
4. Click on any value to copy it
62+
5. Hover over objects to see their full path
63+
64+
## Contributing
65+
66+
1. Fork the repository
67+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
68+
3. Commit your changes (`git commit -m 'feat: add amazing feature'`)
69+
4. Push to the branch (`git push origin feature/amazing-feature`)
70+
5. Open a Pull Request
71+
72+
## License
73+
74+
This project is licensed under the MIT License - see the LICENSE file for details.

background.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Listen for web requests to detect JSON content
2+
chrome.scripting.registerContentScripts([{
3+
id: 'json-viewer',
4+
matches: ['<all_urls>'],
5+
js: ['content.js'],
6+
runAt: 'document_start'
7+
}]).catch(console.error);
8+
9+
// Store user preferences
10+
const defaultSettings = {
11+
theme: 'light',
12+
initialDepth: 2,
13+
showMinimap: true
14+
};
15+
16+
// Initialize settings on installation
17+
chrome.runtime.onInstalled.addListener(() => {
18+
chrome.storage.local.set({ settings: defaultSettings });
19+
console.log('JSON Viewer extension installed');
20+
});
21+
22+
// Listen for content script messages
23+
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
24+
if (request.type === 'getExtensionUrl') {
25+
sendResponse({ url: chrome.runtime.getURL(request.path) });
26+
}
27+
return true;
28+
});

content.js

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
function isJSONContentType() {
2+
const contentType = document.contentType || '';
3+
return contentType.toLowerCase().includes('application/json');
4+
}
5+
6+
function isValidJSON(str) {
7+
try {
8+
JSON.parse(str);
9+
return true;
10+
} catch (e) {
11+
return false;
12+
}
13+
}
14+
15+
function getExtensionURL(path) {
16+
return chrome.runtime.getURL(path);
17+
}
18+
19+
async function injectViewer(jsonContent) {
20+
// Create iframe for the viewer
21+
const iframe = document.createElement('iframe');
22+
iframe.style.cssText = 'position: fixed; top: 0; left: 0; right: 0; bottom: 0; width: 100%; height: 100%; border: none; background: white; z-index: 2147483647;';
23+
iframe.src = getExtensionURL('index.html');
24+
25+
// Add iframe to page
26+
document.documentElement.innerHTML = '';
27+
document.body.appendChild(iframe);
28+
29+
// Wait for viewer to be ready
30+
window.addEventListener('message', function(event) {
31+
// Only accept messages from our viewer
32+
if (event.data === 'viewer-ready') {
33+
// Send JSON data to viewer
34+
iframe.contentWindow.postMessage({
35+
type: 'json-data',
36+
content: jsonContent
37+
}, '*');
38+
}
39+
});
40+
}
41+
42+
function processJSON() {
43+
const bodyText = document.body.textContent;
44+
45+
if (isValidJSON(bodyText)) {
46+
// If valid JSON is found, inject the viewer
47+
injectViewer(bodyText);
48+
}
49+
}
50+
51+
// Run on page load
52+
if (document.readyState === 'loading') {
53+
document.addEventListener('DOMContentLoaded', processJSON);
54+
} else {
55+
processJSON();
56+
}

icons/icon128.png

21 KB
Loading

icons/icon16.png

766 Bytes
Loading

icons/icon32.png

2.11 KB
Loading

icons/icon48.png

4.01 KB
Loading

0 commit comments

Comments
 (0)