导入导出json到blob
当前为
// ==UserScript==
// @name Json2Blob
// @namespace http://firefoxcn.net/
// @description 导入导出json到blob
// @version 0.1
// @author Dniness
// @match https://greasyfork.org/*
// @grant none
// @license GPL License
// ==/UserScript==
(function() {
'use strict';
let e = document.getElementById("install-area");
e&&fetch(e.firstElementChild).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.array = e ;
e = div.fun = e =>{
let x = div.array[e.options[e.selectedIndex].value];
x = new Blob([x], {type: 'text/plain'});
x = URL.createObjectURL(x);
e.outerHTML = '<a href="'+x+'" target="_blank">右键复制</a>';
}
html.unshift('<select onChange="this.parentNode.fun(this)"><option style="display:none">存在数组引用');
div.innerHTML+=html.join('</option><option>');
}).catch(e=>console.log('not objects of json'));
})();