您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
format the page content if it is JSON
// ==UserScript== // @name JSON foramt // @namespace http://tampermonkey.net/ // @version 0.1 // @description format the page content if it is JSON // @author Yunser // @match */* // @icon // @grant none // ==/UserScript== (function () { 'use strict'; const body = document.querySelector('body') if (body && body.children.length && body.children[0] && body.children[0].nodeName == 'PRE') { const pre = body.children[0] console.log('pre.innerHTML', pre.innerHTML) if (pre.innerHTML) { try { pre.innerHTML = JSON.stringify(JSON.parse(pre.innerHTML), null, 4) } catch (e) { console.error(e) } } } // Your code here... })()