// ==UserScript==
// @name Json2Blob
// @namespace http://firefoxcn.net/
// @description 导入导出json到blob
// @version 1.0
// @author Dniness
// @match https://greasyfork.org/*
// @grant none
// @license GPL License
// @downloadURL https://update.greasyfork.icu/scripts/451464/Json2Blob.user.js
// @updateURL https://update.greasyfork.icu/scripts/451464/Json2Blob.meta.js
// ==/UserScript==
(function() {
'use strict';
let e = document.getElementById("install-area");
e&&!e.Json2BlobFun&&fetch(e.Json2BlobFun = e.firstElementChild.href)
.then(e=>e.text()).then(e=>{
let div = document.getElementById("install-area");
e = eval(e);
let html = Object.keys(e);
html.forEach(c=>{e[c]=JSON.stringify(e[c])});
div.Json2BlobArray = e ;
e = div.Json2BlobFun = e =>{
let c = e.options[e.selectedIndex].value;
let x = div.Json2BlobArray[c];
x = new Blob([x], {type: 'text/plain'});
x = URL.createObjectURL(x);
e.outerHTML = '右键复制';
}
html.unshift('