-
-
Save dinh/fa340de398d3bfbc093103bd46c34636 to your computer and use it in GitHub Desktop.
Userscript for opening JSON in the Chrome JSON Viewer extension
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Open JSON | |
// @version 1.0.0 | |
// @description Opens JSON in a json-viewer window | |
// @match http://*/* | |
// @match https://*/* | |
// ==/UserScript== | |
const exec = fn => { | |
const script = document.createElement('script'); | |
script.textContent = `(${fn})()`; | |
document.head.appendChild(script); | |
}; | |
const main = () => { | |
window.openJSON = obj => { | |
const url = 'chrome-extension://gbmdgpbipfallnflgajpaliibnhdgobh/pages/omnibox.html'; | |
const json = JSON.stringify(obj); | |
window.open(`${url}?json=${encodeURIComponent(json)}`, '_blank'); | |
}; | |
}; | |
exec(main); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment