;!function(win, undefined){
xxim.popchatbox = function(othis){
var node = xxim.node, dataId = othis.attr('data-id'), param = {
id: dataId, //用户ID
type: othis.attr('type'),
name: othis.find('.xxim_onename').text(), //用户名
face: othis.find('.xxim_oneface').attr('src'), //用户头像
href: 'profile.html?user=' + dataId //用户主页
}, key = param.type + dataId;
if(!config.chating[key]){
xxim.popchat(param);
config.chatings++;
} else {
xxim.tabchat(param);
}
config.chating[key] = param;
var chatbox = $('#layim_chatbox');
if(chatbox[0]){
node.layimMin.hide();
chatbox.parents('.xubox_layer').show();
}
};
}(window);
如果
xxim
变量在全局作用域中被定义可以直接调用xxim.popchatbox
方法就可以了, 否则通过将xxim
暴露到全局作用域来进行外部访问。