github.com/jincm/wesharechain@v0.0.0-20210122032815-1537409ce26a/app/script/emo.js (about) 1 //文字表情转换 2 var emoData = [{ 3 "name" : "Expression_1", 4 "text" : "[微笑]" 5 }, { 6 "name" : "Expression_2", 7 "text" : "[撇嘴]" 8 }, { 9 "name" : "Expression_3", 10 "text" : "[色]" 11 }, { 12 "name" : "Expression_4", 13 "text" : "[发呆]" 14 }, { 15 "name" : "Expression_5", 16 "text" : "[得意]" 17 }, { 18 "name" : "Expression_6", 19 "text" : "[流泪]" 20 }, { 21 "name" : "Expression_7", 22 "text" : "[害羞]" 23 }, { 24 "name" : "Expression_8", 25 "text" : "[闭嘴]" 26 }, { 27 "name" : "Expression_9", 28 "text" : "[睡]" 29 }, { 30 "name" : "Expression_10", 31 "text" : "[大哭]" 32 }, { 33 "name" : "Expression_11", 34 "text" : "[尴尬]" 35 }, { 36 "name" : "Expression_12", 37 "text" : "[发怒]" 38 }, { 39 "name" : "Expression_13", 40 "text" : "[调皮]" 41 }, { 42 "name" : "Expression_14", 43 "text" : "[呲牙]" 44 }, { 45 "name" : "Expression_15", 46 "text" : "[惊讶]" 47 }, { 48 "name" : "Expression_16", 49 "text" : "[难过]" 50 }, { 51 "name" : "Expression_17", 52 "text" : "[酷]" 53 }, { 54 "name" : "Expression_18", 55 "text" : "[冷汗]" 56 }, { 57 "name" : "Expression_19", 58 "text" : "[抓狂]" 59 }, { 60 "name" : "Expression_20", 61 "text" : "[吐]" 62 }, { 63 "name" : "Expression_21", 64 "text" : "[偷笑]" 65 }, { 66 "name" : "Expression_22", 67 "text" : "[愉快]" 68 }, { 69 "name" : "Expression_23", 70 "text" : "[白眼]" 71 }, { 72 "name" : "Expression_24", 73 "text" : "[傲慢]" 74 }, { 75 "name" : "Expression_25", 76 "text" : "[饥饿]" 77 }, { 78 "name" : "Expression_26", 79 "text" : "[困]" 80 }, { 81 "name" : "Expression_27", 82 "text" : "[恐惧]" 83 }, { 84 "name" : "Expression_28", 85 "text" : "[流汗]" 86 }, { 87 "name" : "Expression_29", 88 "text" : "[憨笑]" 89 }, { 90 "name" : "Expression_30", 91 "text" : "[悠闲]" 92 }, { 93 "name" : "Expression_31", 94 "text" : "[奋斗]" 95 }, { 96 "name" : "Expression_32", 97 "text" : "[咒骂]" 98 }, { 99 "name" : "Expression_33", 100 "text" : "[疑问]" 101 }, { 102 "name" : "Expression_34", 103 "text" : "[嘘]" 104 }, { 105 "name" : "Expression_35", 106 "text" : "[晕]" 107 }, { 108 "name" : "Expression_36", 109 "text" : "[疯了]" 110 }, { 111 "name" : "Expression_37", 112 "text" : "[衰]" 113 }, { 114 "name" : "Expression_38", 115 "text" : "[骷髅]" 116 }, { 117 "name" : "Expression_39", 118 "text" : "[敲打]" 119 }, { 120 "name" : "Expression_40", 121 "text" : "[再见]" 122 }, { 123 "name" : "Expression_41", 124 "text" : "[擦汗]" 125 }, { 126 "name" : "Expression_42", 127 "text" : "[抠鼻]" 128 }, { 129 "name" : "Expression_43", 130 "text" : "[鼓掌]" 131 }, { 132 "name" : "Expression_44", 133 "text" : "[糗大了]" 134 }, { 135 "name" : "Expression_45", 136 "text" : "[坏笑]" 137 }, { 138 "name" : "Expression_46", 139 "text" : "[左哼哼]" 140 }, { 141 "name" : "Expression_47", 142 "text" : "[右哼哼]" 143 }, { 144 "name" : "Expression_48", 145 "text" : "[哈欠]" 146 }, { 147 "name" : "Expression_49", 148 "text" : "[鄙视]" 149 }, { 150 "name" : "Expression_50", 151 "text" : "[委屈]" 152 }, { 153 "name" : "Expression_51", 154 "text" : "[快哭了]" 155 }, { 156 "name" : "Expression_52", 157 "text" : "[阴险]" 158 }, { 159 "name" : "Expression_53", 160 "text" : "[亲亲]" 161 }, { 162 "name" : "Expression_54", 163 "text" : "[吓]" 164 }, { 165 "name" : "Expression_55", 166 "text" : "[可怜]" 167 }, { 168 "name" : "Expression_56", 169 "text" : "[菜刀]" 170 }, { 171 "name" : "Expression_57", 172 "text" : "[西瓜]" 173 }, { 174 "name" : "Expression_58", 175 "text" : "[啤酒]" 176 }, { 177 "name" : "Expression_59", 178 "text" : "[篮球]" 179 }, { 180 "name" : "Expression_60", 181 "text" : "[乒乓]" 182 }, { 183 "name" : "Expression_61", 184 "text" : "[咖啡]" 185 }, { 186 "name" : "Expression_62", 187 "text" : "[饭]" 188 }, { 189 "name" : "Expression_63", 190 "text" : "[猪头]" 191 }, { 192 "name" : "Expression_64", 193 "text" : "[玫瑰]" 194 }, { 195 "name" : "Expression_65", 196 "text" : "[凋谢]" 197 }, { 198 "name" : "Expression_66", 199 "text" : "[嘴唇]" 200 }, { 201 "name" : "Expression_67", 202 "text" : "[爱心]" 203 }, { 204 "name" : "Expression_68", 205 "text" : "[心碎]" 206 }, { 207 "name" : "Expression_69", 208 "text" : "[蛋糕]" 209 }, { 210 "name" : "Expression_70", 211 "text" : "[闪电]" 212 }, { 213 "name" : "Expression_71", 214 "text" : "[炸弹]" 215 }, { 216 "name" : "Expression_72", 217 "text" : "[刀]" 218 }, { 219 "name" : "Expression_73", 220 "text" : "[足球]" 221 }, { 222 "name" : "Expression_74", 223 "text" : "[瓢虫]" 224 }, { 225 "name" : "Expression_75", 226 "text" : "[便便]" 227 }, { 228 "name" : "Expression_76", 229 "text" : "[月亮]" 230 }, { 231 "name" : "Expression_77", 232 "text" : "[太阳]" 233 }, { 234 "name" : "Expression_78", 235 "text" : "[礼物]" 236 }, { 237 "name" : "Expression_79", 238 "text" : "[拥抱]" 239 }, { 240 "name" : "Expression_80", 241 "text" : "[强]" 242 }, { 243 "name" : "Expression_81", 244 "text" : "[弱]" 245 }, { 246 "name" : "Expression_82", 247 "text" : "[握手]" 248 }, { 249 "name" : "Expression_83", 250 "text" : "[胜利]" 251 }, { 252 "name" : "Expression_84", 253 "text" : "[抱拳]" 254 }, { 255 "name" : "Expression_85", 256 "text" : "[勾引]" 257 }, { 258 "name" : "Expression_86", 259 "text" : "[拳头]" 260 }, { 261 "name" : "Expression_87", 262 "text" : "[差劲]" 263 }, { 264 "name" : "Expression_88", 265 "text" : "[爱你]" 266 }, { 267 "name" : "Expression_89", 268 "text" : "[NO]" 269 }, { 270 "name" : "Expression_90", 271 "text" : "[OK]" 272 }, { 273 "name" : "Expression_91", 274 "text" : "[爱情]" 275 }, { 276 "name" : "Expression_92", 277 "text" : "[飞吻]" 278 }, { 279 "name" : "Expression_93", 280 "text" : "[跳跳]" 281 }, { 282 "name" : "Expression_94", 283 "text" : "[发抖]" 284 }, { 285 "name" : "Expression_95", 286 "text" : "[怄火]" 287 }, { 288 "name" : "Expression_96", 289 "text" : "[转圈]" 290 }, { 291 "name" : "Expression_97", 292 "text" : "[磕头]" 293 }, { 294 "name" : "Expression_98", 295 "text" : "[回头]" 296 }, { 297 "name" : "Expression_99", 298 "text" : "[跳绳]" 299 }, { 300 "name" : "Expression_100", 301 "text" : "[投降]" 302 }, { 303 "name" : "Expression_101", 304 "text" : "[激动]" 305 }, { 306 "name" : "Expression_102", 307 "text" : "[街舞]" 308 }, { 309 "name" : "Expression_103", 310 "text" : "[献吻]" 311 }, { 312 "name" : "Expression_104", 313 "text" : "[左太极]" 314 }, { 315 "name" : "Expression_105", 316 "text" : "[右太极]" 317 }]; 318 function _transEmo(emoMsg) { 319 var emoPath, transMsg; 320 var reg = /\[(.*?)\]/gm; 321 transMsg = emoMsg.replace(reg, function(match) { 322 for (var i = 0, len = emoData.length; i < len; i++) { 323 if (emoData[i].text === match) { 324 emoPath = '../image/chatBox/emotion/' + emoData[i].name + '.png'; 325 return '<img width="20" height="20" src="' + emoPath + '" style="vertical-align:middle;" />' 326 } 327 } 328 return match; 329 }); 330 return transMsg; 331 }