我已经与图像的表情符号代替文字表情符号等功能使替换功能不区分大小写
我怎样才能让这个不区分大小写? 我一直在使用 “GI” 和 “IG” 的替代品尝试,但它一点儿也不显得有所作为
var emots = {
':)' : 'smile',
':-)' : 'smile',
';)' : 'wink',
';-)' : 'wink',
':(' : 'downer',
':-(' : 'downer',
':D' : 'happy',
':-D' : 'happy',
'(smoke)' : 'smoke',
'(y)' : 'thumbsup',
'(b)' : 'beer',
'(c)' : 'coffee',
'(cool)' : 'cool',
'(hehe)' : 'tooth',
'(haha)' : 'tooth',
'(lol)' : 'tooth',
'(pacman)' : 'pacman',
'(hmm)' : 'sarcastic',
'(woot)' : 'woot',
'(pirate)' : 'pirate',
'(wtf)' : 'wtf'
};
function smile(str){
var out = str;
for(k in emots){
out = out.replace(k,'<img src="/emoticons/'+emots[k]+'.gif" title="'+k+'" />','g');
}
return out;
};
“我”只能在firefox中工作,因为我看到它 – mowgli