wrj_bmgl/public/static/index1.html

1112 lines
38 KiB
HTML
Raw Normal View History

2024-09-26 17:09:43 +08:00
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>OpenAPI definition</title>
<link rel="stylesheet" href="https://unpkg.com/ant-design-vue@1.4.10/dist/antd.min.css" />
<link rel="stylesheet" href="../../../antd.min.css" />
<style>
.content-line {
height: 25px;
line-height: 25px;
}
.content-line-count {
height: 35px;
line-height: 35px;
}
.title {
margin-top: 25px;
}
.knife4j-description {
/* width: 90%;
margin: 15px auto; */
margin-top: 5px;
}
.divider {
margin: 4px 0;
}
.divider-count {
margin: 8px 0;
}
.knife4j-document {
margin-top: 30px;
}
.api-tab {
margin-top: 15px;
.ant-tag {
height: 32px;
line-height: 32px;
}
}
.knife4j-menu-api-deprecated {
text-decoration: line-through;
}
.knife4j-api-title {
margin-top: 10px;
margin-bottom: 5px;
font-size: 16px;
font-weight: 600;
color: #616368;
height: 35px;
line-height: 35px;
}
.knife4j-api-row {
height: 45px;
line-height: 45px;
}
.knife4j-api-summary {
border-color: #49cc90;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
padding: 2px;
cursor: pointer;
}
.knife4j-api-summary-method {
font-size: 14px;
font-weight: 700;
min-width: 80px;
padding: 6px 15px;
text-align: center;
border-radius: 3px;
text-shadow: 0 1px 0 rgba(0, 0, 0, 0.1);
font-family: Titillium Web, sans-serif;
color: #fff;
}
.knife4j-api-summary-path {
font-size: 14px;
display: flex;
-webkit-box-flex: 0;
-ms-flex: 0 3 auto;
flex: 0 3 auto;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
word-break: break-all;
padding: 0 32px;
}
.knife4j-api-post {
border-color: #49cc90;
background: rgba(73, 204, 144, 0.1);
}
.knife4j-api-post .knife4j-api-summary-method {
background: #49cc90;
}
.knife4j-api-get {
border-color: #61affe;
background: rgba(97, 175, 254, 0.1);
}
.knife4j-api-get .knife4j-api-summary-method {
background: #61affe;
}
.knife4j-api-head {
border-color: #9012fe;
background: rgba(144, 18, 254, 0.1);
}
.knife4j-api-head .knife4j-api-summary-method {
background: #9012fe;
}
.knife4j-api-put {
border-color: #fca130;
background: rgba(252, 161, 48, 0.1);
}
.knife4j-api-put .knife4j-api-summary-method {
background: #fca130;
}
.knife4j-api-delete {
border-color: #f93e3e;
background: rgba(249, 62, 62, 0.1);
}
.knife4j-api-delete .knife4j-api-summary-method {
background: #f93e3e;
}
.knife4j-api-options {
border-color: #0d5aa7;
background: rgba(13, 90, 167, 0.1);
}
.knife4j-api-options .knife4j-api-summary-method {
background: #0d5aa7;
}
.knife4j-api-patch {
border-color: #50e3c2;
background: rgba(80, 227, 194, 0.1);
}
.knife4j-api-patch .knife4j-api-summary-method {
background: #50e3c2;
}
#knife4jDoc ul {
padding-left: 10px;
list-style: none;
counter-reset: ordered;
}
#knife4jDoc ul li:before {
counter-increment: ordered;
content: counters(ordered, ".")" ";
color: #1890ff;
}
.api-basic {
padding: 11px;
}
.api-basic-title {
font-size: 14px;
font-weight: 700;
}
.api-basic-body {
font-size: 14px;
font-family: -webkit-body;
}
.knife4j-api-editor-show {
margin: 15px 0;
font: 100 12px/18px monaco, andale mono, courier new;
padding: 10px 12px;
border: #ccc 1px solid;
border-left-width: 4px;
background-color: #fefefe;
box-shadow: 0 0 4px #eee;
word-break: break-all;
word-wrap: break-word;
color: #444;
}
.knife4j-api-editor-show .string {
color: green;
}
/*字符串的样式*/
.knife4j-api-editor-show .number {
color: darkorange;
}
/*数字的样式*/
.knife4j-api-editor-show .boolean {
color: blue;
}
/*布尔型数据的样式*/
.knife4j-api-editor-show .null {
color: magenta;
}
/*null值的样式*/
.knife4j-api-editor-show .key {
color: red;
}
/*key值的样式*/
.api-description {
border-left: 4px solid #ddd;
line-height: 30px;
}
.api-body-desc {
padding: 10px;
min-height: 35px;
box-sizing: border-box;
border: 1px solid #e8e8e8;
}
.ant-card-body {
padding: 5px;
}
.api-title {
margin-top: 10px;
margin-bottom: 5px;
font-size: 16px;
font-weight: 600;
height: 30px;
line-height: 30px;
border-left: 4px solid #00ab6d;
text-indent: 8px;
}
.content-line {
height: 25px;
line-height: 25px;
}
.content-line-count {
height: 35px;
line-height: 35px;
}
.divider {
margin: 4px 0;
}
.knife4j-doc-m {
position: fixed;
height: 500px;
width: 400px;
border: 1px solid #b7b4b4;
overflow-y: auto;
right: 12px;
top: 40px;
z-index: 9999;
background: #fcfafa;
}
</style>
</head>
<body>
<div id="knife4jDocument" class="resume_preview_page" style="margin:10px auto;width:88%">
<div class="htmledit_views">
<a-row>
<!--分组API信息-->
<!--遍历tags-->
<a-row v-for="tag in tags" :key="tag.name">
<h1 :id="tag.name">{{tag.name}}</h1>
<div class="knife4j-document" v-for="api in tag.childrens">
<!--接口基本信息-->
<a-row>
<a-row :id="api.operationId" class="knife4j-api-title">
<span v-if="api.deprecated" class="knife4j-menu-api-deprecated">
{{ api.summary }}
</span>
<span v-else>
{{ api.summary }}
</span>
</a-row>
<a-row :class="'knife4j-api-' + api.methodType.toLowerCase()">
<div class="knife4j-api-summary">
<span class="knife4j-api-summary-method">{{ api.methodType }}</span>
<span class="knife4j-api-summary-path">{{ api.showUrl }}</span>
</div>
</a-row>
<a-row class="knife4j-api-row">
<a-col :span="12">
<a-row>
<a-col class="api-basic-title" :span="6">请求数据类型</a-col>
{{ api.consumes }}
</a-row>
</a-col>
<a-col :span="12">
<a-row>
<a-col class="api-basic-title" :span="6">响应数据类型</a-col>
{{ api.produces }}
</a-row>
</a-col>
</a-row>
</a-row>
<div v-if="api.author">
<div class="api-title">
开发者
</div>
<div v-if="api.author" v-html="api.author" class="api-body-desc"></div>
</div>
<!--接口描述-->
<div v-if="api.description">
<div class="api-title">
接口描述
</div>
<div v-if="api.description" v-html="api.description" class="api-body-desc"></div>
</div>
<!--请求示例-->
<div v-if="api.requestValue">
<div class="api-title">
请求示例
</div>
<pre class="knife4j-api-editor-show" v-html="formaterJson(api.requestValue)"></pre>
</div>
<div class="api-title">
请求参数
</div>
<a-table default-expand-all-rows :columns="columns" :data-source="api.reqParameters"
:row-key="genUnionTableKey" size="small" :pagination="page">
<template slot="requireTemplate" slot-scope="text">
<span v-if="text" style="color:red">{{ text.toLocaleString() }}</span>
<span v-else>{{ text.toLocaleString() }}</span>
</template>
<template slot="typeTemplate" slot-scope="text">
<span :class="'knife4j-request-' + text">{{ text }}</span>
</template>
<template slot="datatypeTemplate" slot-scope="text, record">
<data-type :text="text" :record="record"></data-type>
</template>
</a-table>
<!--响应状态-->
<div class="api-title">
响应状态
</div>
<a-table :columns="responseStatuscolumns" :data-source="api.responseCodes" row-key="code" size="small"
:pagination="page">
<template slot="descriptionTemplate" slot-scope="text">
<div v-html="text"></div>
</template>
</a-table>
<!--响应参数-->
<!--响应参数需要判断是否存在多个code-schema的情况-->
<div v-if="api.multipartResponseSchema">
<!--多个响应编码code的情况在离线文档中需要单独遍历分开-->
<a-tabs v-for="resp in api.multipCodeDatas" :key="resp.code">
<a-tab-pane :tab="resp.code">
<!--判断响应头-->
<div v-if="resp.responseHeaderParameters">
<div class="api-title">
响应Header
</div>
<a-table :columns="responseHeaderColumns" :data-source="resp.responseHeaderParameters" row-key="id"
size="small" :pagination="page">
</a-table>
</div>
<!--响应参数-->
<div class="api-title">
响应参数
</div>
<a-table :columns="responseParametersColumns" :data-source="resp.data" row-key="id" size="small"
:pagination="page">
</a-table>
<div class="api-title">
响应示例
</div>
<div class="api-editor-show" v-if="resp.responseBasicType">
{{ resp.responseText }}
</div>
<pre class="knife4j-api-editor-show" v-else v-html="formaterJson(resp.responseValue)"></pre>
<!-- <editor-show :value="resp.responseBasicType ? resp.responseText : resp.responseValue"></editor-show> -->
<!-- <editor :value="resp.responseBasicType ? resp.responseText : resp.responseValue" @init="multiResponseSampleEditorInit" lang="json" theme="eclipse" width="100%" :height="editorMultiHeight"></editor> -->
</a-tab-pane>
</a-tabs>
</div>
<div v-else>
<!--判断响应头-->
<div v-if="api.responseHeaderParameters">
<div class="api-title">
响应Header
</div>
<a-table :columns="responseHeaderColumns" :data-source="api.responseHeaderParameters" row-key="id"
size="small" :pagination="page">
</a-table>
</div>
<!--响应参数-->
<div class="api-title">
响应参数
</div>
<a-table :columns="responseParametersColumns" :data-source="api.multipData.data" row-key="id" size="small"
:pagination="page">
</a-table>
<div class="api-title">
响应示例
</div>
<div class="api-editor-show" v-if="api.multipData.responseBasicType">
{{ api.multipData.responseText }}
</div>
<pre class="knife4j-api-editor-show" v-else v-html="formaterJson(api.multipData.responseValue)"></pre>
</div>
<!--接口遍历结束-->
</div>
</a-row>
</a-row>
</div>
</div>
<script src="../../../../upload/vue.js"></script>
<script src="https://cdn.jsdelivr.net/npm/ant-design-vue@1.4.10/dist/antd.min.js"></script>
<script type="text/javascript">
function getData() {
var datas = {
"tags": [
{
"name": "开放接口",
"description": null,
"order": 2147483647,
"author": null,
"childrens": [
{
"id": "63c699bfacc44e6d5ad63539dace68f5",
"operationId": "exportPatentInformationEntity",
"deprecated": false,
"summary": "专利信息",
"methodType": "POST",
"showUrl": "https://nbys.ydool.com/xzht/api/openApi/patentInformation/pageList",
"consumes": [
"application/x-www-form-urlencoded",
"application/json"
],
"produces": [
"*/*"
],
"author": null,
"description": "",
"requestValue": "{\n \"page\": 0,\n \"size\": 0,\n \"key\": \"\",\n \"type\": \"\",\n \"status\": \"\",\n \"year\": \"\"\n}",
"reqParameters": [
{ "name": "AccessToken", "children": null, "description": "接口调用令牌", "in": "header", "require": true, "type": "string", "schemaValue": null },
{
"name": "patentInformationRequestBody",
"children": [
{
"name": "page",
"children": null,
"description": "当前页,默认1",
"in": null,
"require": false,
"type": "integer(int32)",
"schemaValue": null
},
{
"name": "size",
"children": null,
"description": "每页条数,默认20",
"in": null,
"require": false,
"type": "integer(int32)",
"schemaValue": null
},
{
"name": "key",
"children": null,
"description": "关键字(模糊查询范围,专利名,公司名,公司信用代码,类别名,公开(公布)号,公开(公告)日,申请号)",
"in": null,
"require": false,
"type": "string",
"schemaValue": null
},
{
"name": "type",
"children": null,
"description": "专利类型(发明专利:invent,实用新型:utility_model,外观专利:design patent)",
"in": null,
"require": false,
"type": "string",
"schemaValue": null
},
{
"name": "status",
"children": null,
"description": "专利状态(专利权的放弃:abandonment of patent rights,专利权部分失效:partial patent rights invalidation,专利权的转移:patent rights assignment,专利权全部失效:complete patent rights invalidation,授权:authorized,专利撤回:patent withdrawal,专利申请权的转移:transfer of patent application rights,公开:public,实质审查:under_examination,专利驳回:rejected,专利权的终止:terminated)",
"in": null,
"require": false,
"type": "string",
"schemaValue": null
},
{
"name": "year",
"children": null,
"description": "年份(根据公开(公告)日)",
"in": null,
"require": false,
"type": "string",
"schemaValue": null
}
],
"description": "PatentInformationRequestBody",
"in": "body",
"require": true,
"type": "PatentInformationRequestBody",
"schemaValue": "PatentInformationRequestBody"
}
],
"responseCodes": [
{
"code": "200",
"description": "OK",
"schema": "ResultPagePatentInformationDto"
},
{
"code": "401",
"description": "Unauthorized",
"schema": "Result"
}
],
"multipartResponseSchema": true,
"multipCodeDatas": [
{
"code": "200",
"responseHeaderParameters": null,
"data": [
{
"name": "code",
"children": null,
"description": "响应码",
"id": "param1214",
"type": "integer(int32)",
"schemaValue": "integer(int32)"
},
{
"name": "success",
"children": null,
"description": "是否成功",
"id": "param1215",
"type": "boolean",
"schemaValue": null
},
{
"name": "data",
"children": [
{
"name": "records",
"children": [
{
"name": "id",
"children": null,
"description": "id",
"id": "param1311",
"type": "string",
"schemaValue": null
},
{
"name": "companyId",
"children": null,
"description": "公司id",
"id": "param1312",
"type": "string",
"schemaValue": null
},
{
"name": "companyName",
"children": null,
"description": "公司名",
"id": "param1313",
"type": "string",
"schemaValue": null
},
{
"name": "companyCode",
"children": null,
"description": "公司信用代码",
"id": "param1314",
"type": "string",
"schemaValue": null
},
{
"name": "name",
"children": null,
"description": "专利名称",
"id": "param1315",
"type": "string",
"schemaValue": null
},
{
"name": "applyDate",
"children": null,
"description": "申请日",
"id": "param1316",
"type": "string",
"schemaValue": null
},
{
"name": "typeName",
"children": null,
"description": "专利类型",
"id": "param1317",
"type": "string",
"schemaValue": null
},
{
"name": "statusName",
"children": null,
"description": "专利状态",
"id": "param1318",
"type": "string",
"schemaValue": null
},
{
"name": "applicationNum",
"children": null,
"description": "申请号",
"id": "param1319",
"type": "string",
"schemaValue": null
},
{
"name": "publicationNum",
"children": null,
"description": "公开(公布)号",
"id": "param1320",
"type": "string",
"schemaValue": null
},
{
"name": "publicationDate",
"children": null,
"description": "公开(公告)日",
"id": "param1321",
"type": "string",
"schemaValue": null
}
],
"description": "",
"id": "param1286",
"type": "array",
"schemaValue": "PatentInformationDto"
},
{
"name": "total",
"children": null,
"description": "",
"id": "param1298",
"type": "integer(int64)",
"schemaValue": null
},
{
"name": "size",
"children": null,
"description": "",
"id": "param1299",
"type": "integer(int64)",
"schemaValue": null
},
{
"name": "current",
"children": null,
"description": "",
"id": "param1300",
"type": "integer(int64)",
"schemaValue": null
},
{
"name": "orders",
"children": [
{
"name": "column",
"children": null,
"description": "",
"id": "param1326",
"type": "string",
"schemaValue": null
},
{
"name": "asc",
"children": null,
"description": "",
"id": "param1327",
"type": "boolean",
"schemaValue": null
}
],
"description": "",
"id": "param1301",
"type": "array",
"schemaValue": "OrderItem"
},
{
"name": "optimizeCountSql",
"children": null,
"description": "",
"id": "param1304",
"type": "boolean",
"schemaValue": null
},
{
"name": "searchCount",
"children": null,
"description": "",
"id": "param1305",
"type": "boolean",
"schemaValue": null
},
{
"name": "optimizeJoinOfCountSql",
"children": null,
"description": "",
"id": "param1306",
"type": "boolean",
"schemaValue": null
},
{
"name": "maxLimit",
"children": null,
"description": "",
"id": "param1307",
"type": "integer(int64)",
"schemaValue": null
},
{
"name": "countId",
"children": null,
"description": "",
"id": "param1308",
"type": "string",
"schemaValue": null
},
{
"name": "pages",
"children": null,
"description": "",
"id": "param1309",
"type": "integer(int64)",
"schemaValue": null
}
],
"description": "",
"id": "param1216",
"type": "PagePatentInformationDto",
"schemaValue": "PagePatentInformationDto"
},
{
"name": "count",
"children": null,
"description": "",
"id": "param1265",
"type": "integer(int32)",
"schemaValue": "integer(int32)"
},
{
"name": "message",
"children": null,
"description": "描述",
"id": "param1266",
"type": "string",
"schemaValue": null
},
{
"name": "checked",
"children": null,
"description": "",
"id": "param1267",
"type": "array",
"schemaValue": null
}
],
"responseBasicType": false,
"responseText": null,
"responseValue": "{\n\t\"code\": 0,\n\t\"success\": true,\n\t\"data\": {\n\t\t\"records\": [\n\t\t\t{\n\t\t\t\t\"id\": \"\",\n\t\t\t\t\"companyId\": \"\",\n\t\t\t\t\"companyName\": \"\",\n\t\t\t\t\"companyCode\": \"\",\n\t\t\t\t\"name\": \"\",\n\t\t\t\t\"applyDate\": \"\",\n\t\t\t\t\"typeName\": \"\",\n\t\t\t\t\"statusName\": \"\",\n\t\t\t\t\"applicationNum\": \"\",\n\t\t\t\t\"publicationNum\": \"\",\n\t\t\t\t\"publicationDate\": \"\"\n\t\t\t}\n\t\t],\n\t\t\"total\": 0,\n\t\t\"size\": 0,\n\t\t\"current\": 0,\n\t\t\"orders\": [\n\t\t\t{\n\t\t\t\t\"column\": \"\",\n\t\t\t\t\"asc\": true\n\t\t\t}\n\t\t],\n\t\t\"optimizeCountSql\": true,\n\t\t\"searchCount\": true,\n\t\t\"optimizeJoinOfCountSql\": true,\n\t\t\"maxLimit\": 0,\n\t\t\"countId\": \"\",\n\t\t\"pages\": 0\n\t},\n\t\"count\": 0,\n\t\"message\": \"\",\n\t\"checked\": []\n}"
},
{
"code": "401",
"responseHeaderParameters": null,
"data": [
{
"name": "code",
"children": null,
"description": "响应码",
"id": "param1268",
"type": "integer(int32)",
"schemaValue": "integer(int32)"
},
{
"name": "success",
"children": null,
"description": "是否成功",
"id": "param1269",
"type": "boolean",
"schemaValue": null
},
{
"name": "data",
"children": null,
"description": "数据",
"id": "param1270",
"type": "object",
"schemaValue": null
},
{
"name": "count",
"children": null,
"description": "",
"id": "param1271",
"type": "integer(int32)",
"schemaValue": "integer(int32)"
},
{
"name": "message",
"children": null,
"description": "描述",
"id": "param1272",
"type": "string",
"schemaValue": null
},
{
"name": "checked",
"children": null,
"description": "",
"id": "param1273",
"type": "array",
"schemaValue": null
}
],
"responseBasicType": false,
"responseText": null,
"responseValue": "{\n\t\"code\": 0,\n\t\"success\": true,\n\t\"data\": {},\n\t\"count\": 0,\n\t\"message\": \"\",\n\t\"checked\": []\n}"
}
],
"responseHeaderParameters": null,
"multipData": {}
}
],
"hasNew": false,
"hasChanged": false
},
]
};
//console(datas);
return datas;
}
function main() {
//当前接口json数据
var d = getData();
//请求参数table-header
const requestcolumns = [
{
title: "参数名称",
dataIndex: "name",
width: "30%"
},
{
title: "参数说明",
dataIndex: "description",
width: "25%"
},
{
title: "请求类型",
dataIndex: "in",
scopedSlots: { customRender: "typeTemplate" }
},
{
title: "是否必须",
dataIndex: "require",
scopedSlots: { customRender: "requireTemplate" }
},
{
title: "数据类型",
dataIndex: "type",
scopedSlots: { customRender: "datatypeTemplate" }
},
{
title: "schema",
dataIndex: "schemaValue",
width: "15%"
}
];
//响应状态table-header
const responseStatuscolumns = [
{
title: "状态码",
dataIndex: "code",
width: "20%"
},
{
title: "说明",
dataIndex: "description",
width: "55%",
scopedSlots: { customRender: "descriptionTemplate" }
},
{
title: "schema",
dataIndex: "schema"
}
];
//响应头-header
const responseHeaderColumns = [
{
title: "参数名称",
dataIndex: "name",
width: "30%"
},
{
title: "参数说明",
dataIndex: "description",
width: "55%"
},
{
title: "数据类型",
dataIndex: "type"
}
];
const responseParametersColumns = [
{
title: "参数名称",
dataIndex: "name",
width: "35%"
},
{
title: "参数说明",
dataIndex: "description",
width: "40%"
},
{
title: "类型",
dataIndex: "type"
},
{
title: "schema",
dataIndex: "schemaValue",
width: "15%"
}
];
//dataType组件
var dataType = {
name: "DataType",
props: {
text: {
type: String,
required: true
},
record: {
type: Object,
required: true
}
},
data: function () {
return {
validators: []
}
},
created() {
this.intiValidator();
},
methods: {
intiValidator() {
var that = this;
const record = this.record;
if (record.validateInstance != null) {
var len = that.getJsonKeyLength(record.validateInstance);
var _size = 0;
for (var k in record.validateInstance) {
var str = k + ":" + record.validateInstance[k];
that.validators.push({ key: k, val: str });
}
}
},
getJsonKeyLength(json) {
var size = 0;
if (json != null) {
for (var key in json) {
if (json.hasOwnProperty(key)) size++;
}
}
return size;
}
},
template: '<div><span v-if="!record.validateStatus">{{text}}</span><span v-else class="knife4j-request-validate-jsr"><a-tooltip placement="right"><template slot="title"><div v-for="pt in validators" :key="pt.key">{{pt.val}}</div></template>{{text}}</a-tooltip></span></div>'
}
var data = {
tags: d.tags,
instance: d.instance,
columns: requestcolumns,
responseHeaderColumns: responseHeaderColumns,
responseStatuscolumns: responseStatuscolumns,
responseParametersColumns: responseParametersColumns,
expanRows: true,
//接收一个响应信息对象,遍历得到树形结构的值
multipCode: false,
multipCodeDatas: [],
multipData: {},
page: false,
hideShow: true
}
new Vue({
el: "#knife4jDocument",
components: {
"DataType": dataType
},
data() {
return data
},
mounted() {
//初始化完成
//赋予点击事件;
document.getElementById("btnHide").addEventListener("click", function () {
//隐藏目录
var doc = document.getElementById("knife4jDoc");
var docGlobal = document.getElementById("knife4j-doc-m");
if (doc.style.display == "none") {
doc.style.display = "";
document.getElementById("btnHide").innerHTML = "隐 藏";
docGlobal.style.width = "400px";
docGlobal.style.height = "500px";
} else {
doc.style.display = "none";
document.getElementById("btnHide").innerHTML = "目 录";
docGlobal.style.width = "52px";
docGlobal.style.height = "35px";
}
})
},
created() {
},
methods: {
genUnionTableKey() {
var key = "param" + new Date().getTime().toString() + Math.floor(Math.random() * 1000000).toString();
return key;
},
formaterJson(json) {
try {
if (typeof json != "string") {
json = JSON.stringify(json, undefined, 2);
}
json = json
.replace(/&/g, "&")
.replace(/</g, "<")
.replace(/>/g, ">");
return json.replace(
/("(\u[a-zA-Z0-9]{4}|\[^u]|[^\"])*"(s*:)?|(true|false|null)|-?d+(?:.d*)?(?:[eE][+-]?d+)?)/g,
function (match) {
var cls = "number";
if (/^"/.test(match)) {
if (/:$/.test(match)) {
cls = "key";
} else {
cls = "string";
}
} else if (/true|false/.test(match)) {
cls = "boolean";
} else if (/null/.test(match)) {
cls = "null";
}
return '<span class="' + cls + '">' + match + "</span>";
}
);
} catch (error) {
return json;
}
}
}
})
}
main();
</script>
</body>
</html>