21,882
社区成员
发帖
与我相关
我的任务
分享
// jQuery Plugins: On/Off Emtions
var __emotion__cache = false;
jQuery.fn.emotions = function() {
var aEmotion = new Array();
aEmotion[21] = new Array('[happy]','\\[happy\\]');
__emotion__cache = true;
this.each(function() {
str = $(this).html();
for(iEM in aEmotion){
reg = new RegExp(aEmotion[iEM][1],"ig");
str = str.replace(reg,'<span class="plugin_emotion" title="'+encodeURIComponent(aEmotion[iEM][0])+'"><img src="emotions/'+iEM+'.gif" /></span>');
}
$(this).html(str);
});
};
jQuery.fn.unemotions = function(){
__emotion__cache = false;
$('.plugin_emotion').each(function(){
$(this).html(decodeURIComponent(this.title));
});
}
[Quote=引用 2 楼 的回复:]