您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
A simple way to save objects as .json files or to save blobs as files from the console.
// ==UserScript== // @name console.save // @namespace http://bgrins.github.io/ // @version 0.2.0 // @description A simple way to save objects as .json files or to save blobs as files from the console. // @author Devtools Snippets // @match http://*/* // @match https://*/* // @grant none // ==/UserScript== (function () { 'use strict'; window.console.save = function (data, filename) { if (!data) { console.error('Console.save: No data') return; } if (!filename) { console.error('Console.save: No filename') return } var blob if (Object.prototype.toString.call(data) === '[object Blob]') { blob = data } else { if (typeof data === "object") { data = JSON.stringify(data, undefined, 4) } blob = new Blob([data], { type: 'text/json' }) } var e = document.createEvent('MouseEvents') var a = document.createElement('a') a.download = filename a.href = window.URL.createObjectURL(blob) a.dataset.downloadurl = ['text/json', a.download, a.href].join(':') e.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null) a.dispatchEvent(e) } })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址