{"id":18023993,"url":"https://github.com/lete114/emot","last_synced_at":"2025-03-27T00:30:47.023Z","repository":{"id":57224873,"uuid":"495707956","full_name":"Lete114/emot","owner":"Lete114","description":"一个表情处理模块，支持 img 类型解析，输出两种格式的表情字符串","archived":false,"fork":false,"pushed_at":"2022-09-14T05:26:45.000Z","size":64,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-22T18:11:18.766Z","etag":null,"topics":["emoji","emot","emoticons"],"latest_commit_sha":null,"homepage":"https://lete114.github.io/emot/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Lete114.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-05-24T07:06:07.000Z","updated_at":"2022-11-05T11:36:27.000Z","dependencies_parsed_at":"2022-09-06T13:13:31.282Z","dependency_job_id":null,"html_url":"https://github.com/Lete114/emot","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lete114%2Femot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lete114%2Femot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lete114%2Femot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lete114%2Femot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Lete114","download_url":"https://codeload.github.com/Lete114/emot/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245760562,"owners_count":20667886,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["emoji","emot","emoticons"],"created_at":"2024-10-30T07:11:37.938Z","updated_at":"2025-03-27T00:30:46.693Z","avatar_url":"https://github.com/Lete114.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\u003ca href=\"https://github.com/Lete114/emot\" target=\"_blank\"\u003eEmot\u003c/a\u003e\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/Lete114/emot/releases/\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/emot?logo=npm\" alt=\"Version\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/Lete114/emot/blob/main/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/npm/l/emot?color=FF5531\" alt=\"MIT License\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n## 简介\n\n\u003e 一个表情处理模块，支持 img 类型解析，输出两种格式的表情字符串\n\n本项目借鉴源于 [OwO](https://github.com/DIYgod/OwO) ，其中 OwO 有些功能处理的不是很好，且 css 动画让表情一直抖动(感觉很兴奋的样子)，而且解析 img 类型表情直接注入 img 标签内容，我觉得不好，于是就造了这个轮子\n\n核心逻辑处理代码提取于 [Discuss](https://github.com/discussjs/Discuss/blob/dev/src/client/view/submit.svelte) 评论系统的`submit.svelte`组件\n\n## 安装\n\n使用 npm:\n\n```bash\nnpm install emot --save\n```\n\n使用 CDN:\n\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/emot\"\u003e\u003c/script\u003e\n```\n\n## 使用方法\n\n在浏览器中使用\n\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/emot\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n  const emot = new Emot({\n    el: 'body',               // 挂载dom (支持css选择器获取dom)\n    target: 'textarea',       // 目标输入容器 (支持css选择器获取dom)\n    emotMaps: 'emot.json',    // 自定义表情，可以是一个url，或一个对象\n    before: ':',              // 自定义标签前缀，默认[\n    after: ':'                // 自定义标签后缀，默认]\n  })\n  // 通过调用get()方法获取处理后的数据\n  const result = emot.get()\n  /* output:\n  {\n    content: '( =•ω•= )m[heo-鼓掌]',\n    contentHTML: '( =•ω•= )m\u003cimg src=https://npm.elemecdn.com/discuss@0.3.1/assets/emot/鼓掌.png alt=heo-鼓掌/\u003e'\n    // 如果 emotMaps 在初始化的时候传入的是一个url，那么会多返回一个请求 emotMaps 结果\n  }\n  */\n\u003c/script\u003e\n```\n\nESModule 模块\n\n```js\nimport Emot from 'emot'\n// 使用方法如上浏览器使用示例\n```\n\nCommonJS 模块\n\n```js\nconst Emot = require('emot')\n// 使用方法如上浏览器使用示例\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flete114%2Femot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flete114%2Femot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flete114%2Femot/lists"}