<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta charset="utf-8" /> <title>精简 emoji-datasource 数据源</title> </head> <body> <button>执行</button> </body> </html>
document.querySelector("button").addEventListener("click", async function () { let url = "https://mirrors.sustech.edu.cn/cdnjs/ajax/libs/emoji-datasource/15.1.2/emoji.json"; let resp = await fetch(url); let json = await resp.json(); console.debug(json); let minJson = json.map(item => ({ unified: item.unified, short_name: item.short_name, category: item.category, subcategory: item.subcategory })); console.table(minJson); window["emoji"] = minJson; })