Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

添加了20个符号表情 #8

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"directories": {
"test": "test"
},
"dependencies": {},
"devDependencies": {
"coveralls": "^2.11.9",
"gulp": "^3.9.1",
"gulp-clean": "^0.3.2",
"gulp-concat": "^2.6.0",
Expand All @@ -16,7 +16,6 @@
"gulp-mocha": "^2.2.0",
"gulp-rename": "^1.2.2",
"gulp-wrap": "^0.11.0",
"coveralls": "^2.11.9",
"istanbul": "^0.4.3",
"mocha": "^2.4.5"
},
Expand Down
23 changes: 22 additions & 1 deletion src/emotions.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,26 @@
"/:kotow": "https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/96.gif",
"/:turn": "https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/97.gif",
"/:skip": "https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/98.gif",
"/:oY": "https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/99.gif"
"/:oY": "https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/99.gif",

":smile:": "2px 2px",
":mask:": "-30px 2px",
":joy:": "-62px 2px",
":stuck_out_tongue_closed_eyes:": "-94px 2px",
":flushed:": "-126px 2px",
":scream:": "-158px 2px",
":pensive:": "-190px 2px",
":unamused:": "-222px 2px",
"[Hey]": "-254px 2px",
"[Facepalm]": "-286px 2px",
"[Smirk]": "-318px 2px",
"[Smart]": "-350px 2px",
"[Concerned]": "-382px 2px",
"[Yeah!]": "-414px 2px",
":ghost:": "-446px 2px",
":pray:": "2px -30px",
":muscle:": "-30px -30px",
":tada:": "-62px -30px",
":gift:": "-94px -30px",
"[Packet]": "-126px -30px"
}
4 changes: 3 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ function build(){

function qqWechatEmotionParser(str) {
var indices = trie.search(str);
var labelEmotion = `<a title="{{title}}" style="display: inline-block;background: url(https://res.wx.qq.com/a/wx_fed/webwx/res/static/img/6AfH8-r.png) no-repeat;width: 28px;
height: 28px; background-position:{{position}};"></a>`
indices.reverse().map(function(idx) {
var pos = idx[0],
emotion = emotion_list[idx[1]],
img = '<img src="' + emotion_map[emotion] + '" alt="' + emotion + '">';
img = /^:.*:$|^\[.*\]$/.test(emotion) ? labelEmotion.replace('{{title}}', emotion).replace('{{position}}', emotion_map[emotion]) : '<img src="' + emotion_map[emotion] + '" alt="' + emotion + '">';
str = splice(str, pos, emotion.length, img);
});
return str;
Expand Down
Loading