Created
August 19, 2016 21:32
-
-
Save jr-codes/2a3b0fd3eb3610555bddc382340e5dfa 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