Well, this is a very simple little tool that converts QQ emoticons and WeChat emoticon strings added to web pages into emoticon pictures.
min.js
to use. Also supports Node.js environment. enter:
/::)
Output:
< img src =" https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/0.gif " alt =" /::) " >
Effect:
enter:
I xx Gunzi, /::), No no no, I just xx xx/::B.
Output:
I xx Gunzi, < img src =" https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/0.gif " alt =" /::) " > , No no no, I just xx xx < img src =" https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/2.gif " alt =" /::B " > .
Effect:
I xx Gunzi, , No no no, I just xx xx.
This tool exposes a qqWechatEmotionParser()
method. The input of this method is a string that needs to be processed, and the output is a string that converts character expressions into img tags.
Download and introduce https://github.com/buddys/qq-wechat-emotion-parser/blob/master/dist/qq-wechat-emotion-parser.min.js.
< script src =" /path/to/qq-wechat-emotion-parser.min.js " > </ script >
Call window.qqWechatEmotionParser
:
var text = 'I xx Gunzi /::), No no no, I just xx xx/:<L>.' ;
var html = qqWechatEmotionParser ( text ) ;
document . write ( text ) ;
document . write ( '<br/>' )
document . write ( html ) ;
Install:
npm install qq-wechat-emotion-parser
use:
var qqWechatEmotionParser = require ( 'qq-wechat-emotion-parser' ) ;
var text = 'I xx Gunzi /::), No no no, I just xx xx/:<L>.' ;
var html = qqWechatEmotionParser ( text ) ;
console . log ( html ) ;
You are welcome to submit issues or contribute code through Github. Before contributing code, you need to read the original code carefully and try to keep the code style consistent.
Emoticons are saved under the src/emotion.json file. Define the character representation and image source of the emoticon by editing the json file. There are two points to note:
GPL V3.0
hartle, meriky @ Buddys Copyright (c) 2016