Json2Blob

导入导出json到blob

当前为 2022-09-16 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Json2Blob
// @namespace    http://firefoxcn.net/
// @description  导入导出json到blob
// @version      0.2
// @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'));
return {
HeaderEditorCORS:{
	"request": [
		{
			"enable": true,
			"name": "跨域js外链式",
			"ruleType": "redirect",
			"matchType": "prefix",
			"pattern": "https://0.0.0.0/fetch.js?",
			"exclude": "",
			"group": "跨域length128",
			"isFunction": true,
			"action": "redirect",
			"code": "return `data:,(${o=>{\nconst fetch = o.fetch;\no.fetch = (url,opt='')=>(opt.headers = {\n\t\tAccept:(e=>\n\t\t\te.forEach((a,i)=>\n\t\t\t\te[i]=a.join(';')\n\t\t\t)||'-X;-'+e.join(';-')\n\t\t)(Object.entries(opt.headers||''))\n\t})&&fetch(url,opt||opt.o)\n}})(${val.split('?').pop()||'this'})`;"
		}
	],
	"sendHeader": [
		{
			"enable": true,
			"name": "复杂跨域绕过预检",
			"ruleType": "modifySendHeader",
			"matchType": "all",
			"pattern": "",
			"exclude": "",
			"group": "跨域length128",
			"isFunction": true,
			"code": "val.forEach(e=>\ne.name.toLowerCase() === 'accept'&&\ne.value.startsWith('-X;-')?(e.value=\ne.value.split(';-').slice(1).forEach(e=>{let i = e.indexOf(';');\nval.push({\"name\": e.slice(0,i), \"value\": e.slice(1+i)})})||' */*; q=0.01'):\ne.name.toLowerCase() === 'referer'?(e.value=''):\ne.name.toLowerCase() === 'origin'?(e.name = \"H-Referer-Origin\"):0);"
		}
	],
	"receiveHeader": [
		{
			"enable": true,
			"name": "跨域访问许可",
			"ruleType": "modifyReceiveHeader",
			"matchType": "all",
			"pattern": "",
			"exclude": "",
			"group": "跨域length128",
			"isFunction": true,
			"code": "const H={name:\"H-Referer-Origin\"};\ndetail.originUrl&&((S = new Set())=>{ top[H.name]  = S ; H.value = \nS.has(detail.id)?'null':detail.originUrl.split('/').slice(0,3).join('/');\nS[(detail.statusCode&0740)===0440?'add':'delete'](detail.id);\n})(top[H.name] );\n(detail.Referer= (detail.requestHeaders||[H]).find(e=>e.name==H.name))&&\n!val.forEach(e=>e.name.toLowerCase()===\"location\"?e.value[4]==':'&&\n(e.value = detail.url.split(':')[0]+e.value.slice(4)):\n(e.name.toLowerCase().startsWith(\"access-control-allow-\")&&e).name+=\"-X\")&&\nval.push({\"name\": \"Access-Control-Allow-Origin\", \"value\":detail.Referer.value})&&\nval.push({\"name\": \"Access-Control-Allow-Credentials\", \"value\": \"true\"})&&\nval.push({\"name\": \"Access-Control-Allow-Headers\", \"value\":detail.Referer.name})&&\nval.push({\"name\": \"Access-Control-Allow-Methods\", \"value\": \"POST,GET,OPTIONS,DELETE\"}); "
		}
	],
	"receiveBody": []
}
}
})();