w.fjtu.com.cn
Open in
urlscan Pro
125.77.126.111
Public Scan
URL:
http://w.fjtu.com.cn/space/view/im/js/jQuery.im.js?_=1683856751015
Submission: On May 24 via manual — Scanned from DE
Submission: On May 24 via manual — Scanned from DE
Form analysis
0 forms found in the DOMText Content
;(function($){ $.fn.extend({ //将可选择的变量传递给方法 FnWebIM: function(options) { //设置默认值并用逗号隔开 var defaults = { autoLogin :true, //boolean型,默认是否自动登录,true:自动登录,false:手动登录,默认为true msgRefreshTime :1000, //number型,消息刷新时间,单位为ms friendRefreshTime :1000, //number型,好友刷新时间,单位为ms showSecretary :false, //boolean型,默认是否显示小秘书,true:显示,false:不显示,默认为true noticeContent :"", //string型,公告内容 为空时不显示公告 sendPicture :true, //boolean型,是否允许发送图片,true:允许,false:不允许,默认为true msgMaxSize :300, //number型,单条消息最大允许字符 msgSound :false, //是否开启声音提醒 defaultWindow :"" //string型,登录后打开新聊天窗口,从用户点击的链接接收参数 } var options = $.extend(defaults, options); return this.each(function() { //显示fn_imbar // $("body").append('<div id="fn_imbar" class="im_login"><span>在线交流工具<b title="3条未读消息">3</b></span></div><div id="fn_imbox"></div>'); $("#fn_imbar.im_login").click(function(){ $(this).attr("class","im_loading").find("span").html("登录中,请稍后…"); /*****联系人面板*****/ $.ajax({url:"view/im/ajax/im_contact.html",dataType:"html",success:loginIM,error:loginError}); function loginIM(data){ //显示联系人面板 $("#fn_imbox").html(data).show(); //装配联系人数据 Friends(); $("#fn_imbar").hide(); $("#fn_imbox .im_top h4").click(function(){ if($("#fn_imbox .im_bottombar ul").css("display") == 'none'){ $("#fn_imbox").animate({height: 360}, 800); $("#fn_imbox .im_bottombar ul").show(); }else{ $("#fn_imbox").animate({height: 30}, 800); $("#fn_imbox .im_bottombar ul").hide(); } } ); //好友展开 $("#fn_imbox .im_contents h4").click(function(){ $(this).attr("class","im_group_expansion").siblings("h4").attr("class","im_group_away").siblings(".im_group_contacts").hide(); $(this).next(".im_group_contacts").show().jscroll();//显示滚动条 }); //好友搜索 $("#fn_imbox .im_bottombar input").focus(function(){ if($(this).val()=="查找联系人"){ $(this).val(""); } }).blur(function(){ if($(this).val()==""){ $(this).val("查找联系人"); } }); //设置选项 $("#fn_imbox .im_bottombar span").click(function(){ var thisParentUl = $(this).parent().find("ul"); if(thisParentUl.css("display") == 'none'){ $(this).addClass("current").parent().find("ul").fadeIn(); }else{ $(this).removeClass("current").parent().find("ul").hide(); } }) $("#fn_imbox .im_bottombar li.setting").click(function(){ modify(); }); $("#fn_imbox .im_bottombar li.backlist").click(function(){ $.ajax({url:"view/im/ajax/friends.html",dataType:"html",success:function(data){ art.dialog({title:"查看黑名单",padding:0,content:data,ok:function(){ }}); $(".im_friendsbox").jscroll(); $(".im_friendsbox dt, .im_friendname").click(function(){ card($(this).attr("uid")); }); $("a.im_addcontact").click(function(){ $(this).parents("dl").fadeOut(); message("好友添加成功!"); }); },error:function(XMLHttpRequest, textStatus, errorThrown){ message("黑名单面板加载失败,请重试!CODE:"+XMLHttpRequest.status); }}); }); $("#fn_imbox .im_bottombar li.friends").click(function(){ $.ajax({url:"view/im/ajax/friends.html",dataType:"html",success:function(data){ art.dialog({title:"推荐好友",padding:0,content:data,ok:function(){ }}); $(".im_friendsbox").jscroll(); $(".im_friendsbox dt, .im_friendname").click(function(){ card($(this).attr("uid")); }); $("a.im_addcontact").click(function(){ Friends(); $(this).parents("dl").fadeOut(); message("好友添加成功!"); }); },error:function(XMLHttpRequest, textStatus, errorThrown){ message("推荐好友面板加载失败,请重试!CODE:"+XMLHttpRequest.status); }}); }); $("#fn_imbox .im_bottombar li.loginout").click(function(){ art.confirm("您确定要退出本次登录吗?",function(){ loginTimeOut(); message("注销成功!"); },function(){ }); }); //会话超时 function loginTimeOut(){ $.ajax({ url:"view/im/ajax/login.html", dataType:"html", success:function(data){ art.dialog({title:"会话超时,请重新登录!",content:data,okValue:"登录",ok:function(){ message("登录成功!"); },cancel:function(){ message("登录已取消!"); }}); }, error:function(XMLHttpRequest, textStatus, errorThrown){ message("登录面板获取失败!CODE:"+XMLHttpRequest.status); }}); } //加载聊天窗口 $.ajax({ url:"view/im/ajax/im_window.html", dataType:"html", success:function(data){ $(".im_contact").click(function(){ //选中联系人 $(".im_contact").removeClass("current"); $(this).addClass("current"); var uid=$(this).attr("uid"); var fromid=$(this).attr("fromid"); //阻止全选 this.onselectstart=function(){return false}; $.ajax({ url: "entity/chat/snsChat_queryUser.action?uid="+uid, data:'', async:false, dataType:'json', success:function(json){ var photoPath = json.user[0][2]; var username= json.user[0][1]; if(photoPath == undefined || photoPath == null || photoPath == ""){ photoPath = "resources/images/SNS/defaultImg.png"; } openWindow(json.user[0][0],"",photoPath,username,data); } }); //清除消息提示,此处在聊天框显示数据和设置数据库数据为已读 $(".im_contact").find("b").remove(); //清除消息提示 if($(".im_contents").has("b").length==0){ noMsg(); } }); }, error:function(XMLHttpRequest, textStatus, errorThrown){ message("对不起,聊天窗口加载失败! CODE:"+XMLHttpRequest.status); }}); } function loginError(XMLHttpRequest, textStatus, errorThrown){ art.alert("登录超时,请重新登录! CODE:"+XMLHttpRequest.status,function(){loginTimeOut();}); } /****装配联系人数据****/ function Friends(){ $("#imRencentContacts,#imFriends").html(""); $.ajax({ url: "entity/chat/snsChat_queryFriend.action", data:'', async:false, dataType:'json', success:function(json){ var sendId=json.fromid; for(var i=0;i<json.friends.length;i++){ var photoPath = json.friends[i][2]; if(photoPath == undefined || photoPath == null || photoPath == ""){ photoPath = "resources/images/SNS/defaultImg.png"; } $("#imFriends").append('<div class="im_contact" uid="'+json.friends[i][0]+'" fromid="'+sendId+'"><i><img src="'+photoPath+'" onerror="CommonUtil.photoLoadError(this);" width="30" height="30" /><sup></sup></i><span id="uname">'+json.friends[i][1]+'</span></div>'); } var recentContacts = json.recentContacts; if(recentContacts !=null && recentContacts.length > 0){ for(var i=0;i< recentContacts.length;i++){ var contactphotoPath = recentContacts[i][7]; if(contactphotoPath == undefined || contactphotoPath == null || contactphotoPath == ""){ contactphotoPath = "resources/images/SNS/defaultImg.png"; } $("#imRencentContacts").append('<div class="im_contact" uid="'+recentContacts[i][1]+'"><i><img src="'+contactphotoPath+'" onerror="CommonUtil.photoLoadError(this);" width="30" height="30" /><sup></sup></i><span>'+recentContacts[i][2]+'</span></div>'); } } //显示滚动条 var Scroll=function(){$(".im_contacts").jscroll();} Scroll(); } }); } /****打开新聊天窗口****/ function openWindow(uid,isOline,photo,username,message){ var t='<div class="im_contactinfobar" uid="'+uid+'"><span class="im_avatar" ><img src="'+photo+'" width="50" height="50" /></span><span class="im_contactinfo"><span class="im_contact" id="contactcard" >'+username+'</span> <a id="imcontact" href="javascript:;"> </a></span></div>'; $.ajax({ type:'post', url:'entity/common/snsMessageManage_isFriend.action', async: false , data: {contactId:uid}, dataType:'json', success:function(json){ if(json.success=="true"){ t='<div class="im_contactinfobar" uid="'+uid+'"><span class="im_avatar" ><img src="'+photo+'" width="50" height="50" /></span><span class="im_contactinfo"><span class="im_contact" id="contactcard" >'+username+'</span> <a class="im_removecontact" id="imcontact" href="javascript:;" title="取消关注"> </a></span></div>'; }else{ t='<div class="im_contactinfobar" uid="'+uid+'"><span class="im_avatar" ><img src="'+photo+'" width="50" height="50" /></span><span class="im_contactinfo"><span class="im_contact" id="contactcard" >'+username+'</span> <a class="im_addcontact" id="imcontact" href="javascript:;" title="添加关注"> </a></span></div>'; } }, error:function(){ } }); message = '<div id="chat_' +uid+ '">' + message + '</div>'; //创建新聊天窗口 art.dialog({id:"msgWindow_"+uid,padding:"0",lock:false,title:t,content:message}); //显示公告内容 if(options.noticeContent!=""){ $(".im_chats .im_morechats").before('<div class="im_notice"><span>'+options.noticeContent+'</span><a href="javascript:;" class="im_notice_close"></a></div>'); } //修改查看更多聊天记录的链接 var moreCharts = 'entity/common/snsMessageManage_toChat.action?contactId='+uid; $(".im_chats .im_morechats").attr("href",moreCharts); //操作当前聊天窗口 operatewindow(uid); //加载最近的一条聊天信息 $.ajax({ type:'post', url:'entity/common/snsMessageManage_readMsg.action', async: false , data: {contactId:uid}, dataType:'json', success:function(jsonMsg){ if(jsonMsg.msgContent!=undefined){ for(var i=0;i<jsonMsg.msgContent.length;i++){ $("#chat_" + uid).find(".im_chats .im_chat_content:last").after('<div id="'+uid+'_'+jsonMsg.msgContent[i][0]+'" class="im_chat_content myself"><i>'+jsonMsg.msgContent[i][3]+" "+jsonMsg.msgContent[i][2]+'</i><div class="im_chat_txt">'+jsonMsg.msgContent[i][1]+'</div></div>'); $("#chat_" + uid).find(".im_chats").jscroll({Bar:{Pos:"bottom"}}); } } } }); } /****聊天窗口选项****/ function operatewindow(uid){ //表情面板 $("#chat_"+uid).find(".im_face").click(function(){ var _this=$("#chat_"+uid).find("#im_face"); if(_this.css("display") == 'none'){ _this.css("z-index",99999); _this.show(); $.ajax({ url:"view/im/ajax/im_face.html", success:function(data){ _this.html(data).find(".im_faceclose,.im_faceico a").click(function(){ $("#chat_"+uid).find("#im_face").hide(); }); _this.find(".im_faceico a").click(function(){ $("#chat_"+uid).find("#im_window .im_send_msg").html( $("#chat_"+uid).find("#im_window .im_send_msg").html()+$(this).html()); $("#chat_"+uid).find("#im_face").hide(); }); }, dataType:"html", error:function(XMLHttpRequest, textStatus, errorThrown){ message("表情面板获取失败,请重试!CODE:"+XMLHttpRequest.status) }}); }else{ var _this=$("#chat_"+uid).find("#im_face"); _this.hide(); } }) //发送图片 if(options.sendPicture=false){ $(".im_upload_pic").remove(); } $(".im_upload_pic").click(function(){ art.alert("需要用jQuery Ajax上传插件。"); }); $("#chat_"+uid).find(".im_moreoperate .im_aclose,.im_send_msg").click(function(){ $(".im_moreoperate").animate({height:0,marginTop:"0"},200); }); //发送留言 $("#chat_"+uid).find("#im_window .im_send_msg").focus(function(){ $(document).keypress(function(e){ if(e.ctrlKey && e.which == 13 || e.which == 10) { sendMsg(uid); } }); }); $("#chat_"+uid).find("#im_window .im_sendmsg_btn").click(function(){ sendMsg(uid); }); //关闭主窗体 $("#im_body .im_close,#im_body .im_minimize").click(function(){ $("#im_window").hide(); }); //添加关注或取消关注 $("#imcontact").click(function(){ //首先要判断该人是否是其好友 if($(this).hasClass("im_addcontact")){ art.confirm('您确定要关注对方吗?', function () { $.ajax({ url: 'entity/common/snsFriend_addAttention.action', data: {dataType:"json",userId:uid}, dataType: 'json', async:false, type: 'post', success: function(data) { if(data.success == "true"){ $("#imcontact").attr({"class":"im_removecontact","title":"取消关注"}); message("添加关注成功!"); } } }); },function(){}); } else{ art.confirm('您确定要取消关注对方吗?', function () { $.ajax({ url: 'entity/common/snsFriend_cancelAttention.action', data: {dataType:"json",userId:uid}, dataType: 'json', async:false, type: 'post', success: function(data) { if(data.success == "true"){ $("#imcontact").attr({"class":"im_addcontact","title":"添加关注"}); message("取消关注成功!"); } } }); },function(){}); } }); } /****发送消息****/ function sendMsg(uid){ var toid = uid; var msgContent=$("#chat_"+toid).find("#im_window .im_send_msg"); var sendMessage = msgContent.html(); //发送的消息 if(msgContent.html().length!=0&&msgContent.html().length<options.msgMaxSize){ //此处提交用户消息至服务器 $.ajax({ url: 'entity/common/snsMessageManage_chat.action', data: {dataType:"json",contactId:toid,msgContent:sendMessage}, dataType: 'json', type: 'post', success: function(data) { if(data.status=="success"){ $("#chat_"+toid).find(".im_chats .im_chat_content:last").after('<div class="im_chat_content myself"><i>'+data.message.ssoUserByFkSendId.trueName+" "+data.sendDate+'</i><div class="im_chat_txt">'+msgContent.html()+'</div></div>'); $("#chat_"+toid).find(".im_chats").jscroll({Bar:{Pos:"bottom"}}); msgContent.html("").click(); }else{ message("消息发送失败!"); } } }); } else if(msgContent.html().length==0){ message("对不起,消息不能为空!"); msgContent.click(); } else{ message("对不起,您输入的字数超过限制!"); } } /****网址过滤****/ function urlFilter(){ var msgRecord = $(".im_chats .im_chat_content:last"),urls; try{ urls=msgRecord.html().match(/http:\/\/[A-Za-z0-9|_|-]*.?fanna.com.cn\/[0-9a-z_!~*'().;?:@&=+$,%#-]*/gi); for(var i=0;i<urls.length;i++){ msgRecord.html(msgRecord.html().replace(urls[i], '<a class="fn_url" href="'+urls[i]+'" target="_blank" title="凡纳网官方网站,没有安全风险">'+urls[i]+'</a>')); } }catch(ex){} } /****新消息提示****/ function newMsg(){ $("#fn_imbox .im_top h4").addClass("im_newmsg"); if(options.msgSound){ $("body").append('<object type="application/x-shockwave-flash" data="view/im/sound/msg.swf" width="10" height="10" id="newMessage" style="overflow: hidden;"><param name="movie" value="sound/msg.swf" /></object>'); setTimeout(function(){$("#newMessage").remove()},3000); } } /****清除新消息提示****/ function noMsg(){ $("#fn_imbox .im_top h4").removeClass("im_newmsg"); } /****全局信息提示****/ function message(c){ art.dialog({time: 2000,padding:0,title:false,lock:false,content:"<div class='im_infos'><p>"+c+"</p></div>",cancel:false}); } }); if(options.autoLogin||options.defaultWindow!=""){ $("#fn_imbar.im_login").click();} }); } }); })(jQuery); /****禁止粘贴****/ function msgPaste(){ art.dialog({time: 2000,padding:0,title:false,lock:false,content:"<div class='im_infos'><p>为营造一个良好的网络环境,暂不允许粘贴!</p></div>",cancel:false}); }