/* 好友初始化区域 此文件为好友窗体使用初始化窗体 */ Namespace.register("U.F.W"); //好友和群窗口区域命名空间 //#region 好友聊天 /** * 弹出好友窗体处理 * * @param {object} 群信息 */ U.F.W.ViewFriend = U.F.W.SLHCK = function (friendinfo) { var _childs, //所有的好友元素 _friendel //好友的信息元素 ; //如果有传入好友的信息,则查看指定的好友的信息,否则弹出默认的好友窗体 if (friendinfo) { //如果用户是和自己聊天,那么直接提示不允许,否则弹出好友聊天框 if (friendinfo.UserId == US.userInfo.userid) { U.Alert("无法与本人聊天!"); } else { //获取制定好友的点击元素 _friendel = $("#UD_SYHRCO").find("[tid=" + friendinfo.UserId + "]")[0]; //如果查看的好友在好友列表里 if (_friendel) { _friendel.onclick(); } //弹出好有窗体 else { U.F.W.PopupFriendsForm(friendinfo); } } } //弹出默认的好友窗体 else { _childs = $("#UD_SYHRCO").Child(); //右侧栏 friendinfo = (US.Friend[4][0] || US.Friend[1][0]); //最近联系人、 我的好友列表 //如果有显示的好友,则弹出第一个好友聊天 if (_childs.length) { _childs[0].onclick(); } //查看好友 else { //这里判断如果弹出的是群聊天框,则选择群信息,需要修改 if (friendinfo && friendinfo.tf) { friendinfo = _$(US.Friend[2]).Select({ "GroupManageID": friendinfo.UserId })[0]; } //弹出好友信息 U.F.W.PopupFriendsForm(friendinfo); //如果用户没有好友和群,那么则直接弹出推荐好友 if (!friendinfo || (!friendinfo.UserId && !friendinfo.GroupManageID)) { U.F.W.RecommendFriend(); } } } } //#region 空好友提示 /** * 空好友的提示 * */ U.F.W.RecommendFriend = function () { U.F.W.PrintRecommendFriend(US.userInfo.TJF.slice(0, 8), $("#UD_SYHZR")[0], 1); //推荐好友提示 U.F.W.FriendDisplayAndNone([{ "display": "block" }, { "display": "none"}], true); //弹出好友窗体,隐藏右边好友栏 } /** * 空用户的提示 * */ U.F.W.PrintRecommendFriend = function (friendinfo, el, page) { //变量定义 var _tempel, //临时元素变量 _temponeel, //临时元素变量 _temptwoel, //临时元素变量 _tempthreeel, //临时元素变量 _tempfourel, //临时元素变量 _tempfiveel //临时元素变量 ; //清空内容 el.innerText = ""; //创建显示 _tempel = $$("div", { "className": "UD_SYHZRO", "onmousedown": U.M.StopBubble }); _temponeel = $$("div", { "className": "UD_SYHZROS" }, _tempel); $$("div", { "className": "UD_SYHZROSS", "innerHTML": "这里暂时没有任何内容哦" }, _temponeel); $$("div", { "className": "UD_SYHZROSZ", "innerHTML": "Nothing!!" }, _temponeel); _temptwoel = $$("div", { "className": "UD_SYHZROSX" }, _temponeel); $$("div", { "className": "UD_SYHZROSXL", "innerHTML": "可尝试点击左边的头像,或追随一下的用户!" }, _temptwoel); $$("div", { "className": "UD_SYHZROSXR UD_SYI" }, _temptwoel); _temponeel = $$("div", { "className": "UD_SYHZROX" }, _tempel); _temptwoel = $$("div", { "className": "UD_SYHZROXT" }, _temponeel); $$("div", { "className": "UD_SYSXLTTO UD_SYSXROHTO", "innerHTML": "推荐追随" }, _temptwoel); $$("div", { "className": "UD_SYSXLTTI UD_SYI", "onclick": [[U.F.W.RecommendFriend, [el, page]]] }, _temptwoel); _temptwoel = $$("div", { "className": "UD_SYHZROXX" }, _temponeel); //推荐好友循环打印区域 for (i = 0; i < friendinfo.length; i++) { _tempthreeel = $$("div", { "className": "UD_SYHZROXXO", "style": { "marginLeft": "65px"} }, _temptwoel); _tempfourel = $$("div", { "className": "UD_SYHZROXXOS" }, _tempthreeel); _tempfiveel = $$("div", { "className": "UD_SYHZROXXOSL" }, _tempfourel); $$("img", { "onerror": U.M.ImgError, "title": "点击查看", "onclick": [[U.M.StopBubble], [U.U.I.ViewOtherUserInfo, [friendinfo[i].UserID]]], "src": U.M.GetImgU(friendinfo[i].UserThumbnailImageHead), "alt": friendinfo[i].UserName }, _tempfiveel); $$("div", { "className": "UD_SYHZROXXOSN UTDF", "innerHTML": friendinfo[i].UserName }, _tempfourel); $$("div", { "className": "UD_SYHZROXXOSR", "title": "点击追随该用户", "innerHTML": "追随", "onclick": [[U.F.M.AddFriend, [friendinfo[i]]]] }, _tempfourel); _tempfourel = $$("div", { "className": "UD_SYHZROXXOX UD_SYSXZLLZOOX" }, _tempthreeel); $$("div", { "className": "UD_SYSXRATOCS", "innerHTML": "▲" }, _tempfourel); $$("div", { "className": "UD_SYSXRATOCX", "innerHTML": (friendinfo[i].UserIndividualitysignature ? friendinfo[i].UserIndividualitysignature.substring(0, 15) : "添加我为好友吧,分享我们的信息,让我们距离更近一步").trim() }, _tempfourel); } //添加内容 el.appendChild(_tempel); } //好友推荐变化 U.F.W.RecommendFriend = function (el, page) { var _userinfo = US.userInfo, //登录用户资料 _start = page * 4, //分页的开始 _end = (page + 1) * 4, //分页的结束 _recommendfriend = _userinfo.TJF.slice(_start, _end) //分页获取推荐的用户 ; //获取的用户存在则打印 if (_recommendfriend.length) { U.F.W.PrintRecommendFriend(_recommendfriend, el, page + 1); } //否则去数据库取数 else { U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "RecommendFriends", _userinfo.UserId || US.NU, _userinfo.length, _userinfo.length + 4]), U.D.SY.AsynSYTJ, [el, el, page]; } } //获取推荐好友 U.F.W.AsynRecommendFriend = function (r) { var _userinfo = US.userInfo, //登录用户资料 _context = r.context, //回调的参数 _el = _context[1], //输出的内容区域 _page = _context[2] //输出的号码 ; r = r.value; //获取推荐用户的返回值 _userinfo = _userinfo.concat(r); //获取的推荐用户存储到用户推荐用户信息里 U.F.W.PrintRecommendFriend(r, _el, _page + 1); //打印推荐好友 } //#endregion //#region /** * 好友聊天器里查看好友聊天 * * @param {object} 群信息 */ U.F.W.PopupFriendsForm = function (friendinfo, el) { //登录的用户才能弹出窗体 if (!U.U.L.isLogin(3)) { var _friendform = $("#UD_SYHZA")[0]; //判断窗体是否创建如果创建直接显示,如果没有则创建 if (!_friendform) { //创建窗体弹出窗体 U.UI.Form({ "min": false, "resize": U.F.W.ReSize, //resize事件处理 "style": { display: "block", height: "80%" }, "id": "UD_SYHZA", "content": $("#UD_SYHZ")[0], "title": "
", "hst": { "style": { "padding": "0"} }, "SO": false, //不允许拉伸 "close": { //关闭点击事件处理 "onclick": U.M.apply(null, [[U.F.W.FriendDisplayAndNone, [[{ "display": "none" }, { "display": "block"}], { "left": "auto", "right": "0px"}]]]) } }).be; } //隐藏好友右边的显示,显示窗体 U.F.W.FriendDisplayAndNone[{ "display": "block" }, { "display": "none"}]; U.F.W.OpenFriendChat(friendinfo); //打开指定的好友聊天显示 U.F.W.ReSize(); //好友聊天区域大小初始化 } } /** * 初始化好友聊天区域 * * @param {object} 群信息 */ U.F.W.OpenFriendChat = function (friendinfo) { var _friendfromel = $("#UD_SYHZR")[0], //整个好友窗体元素 _friendchatfrom = $("#UD_SYF")[0], //好友聊天区域元素 _userid = friendinfo.GroupManageID || friendinfo.UserId, //打开群或者好友的窗体 _chatform = U.F.W.IsCreateForm(_userid), //判断窗体是否已经打开创建 _isgroup = friendinfo.GroupManageID != null ; _friendchatfrom.style.display = "block"; //默认是隐藏,这些显示 _friendfromel.appendChild(_friendchatfrom); //追加聊天区域 //如果好友聊天框不存在,则创建好友聊天框 if (!_chatform) { _chatform = U.F.W.CreateFriendChat(friendinfo); } //选择到指定的窗体 U.F.W.SwitchFriendsChat(_chatform, friendinfo); //好友聊天查看 U.F.FM.GetFriendOrGroupNews(_userid, U.M.apply(this, [[U.F.FM.AsynReceiveMessages, [_isgroup, _chatform[1]]]]), _isgroup); } //大小变化处理 U.F.W.ReSize = function () { U.F.W.LeftSize(); //左边的处理 U.F.W.ChatBoxSize($("#UD_SYF")[0], $("#UD_SYF")[0].childs[0].element[1]); //右边聊天框处理 } /** * 好友聊天左边聊天框显示,主要是好友显示的区域的大小加上上面的导航等于整个左边的高 * */ U.F.W.LeftSize = function () { var _leftcontent = $("#UD_SYHZLT").Parent(), //获取左边好友区域 _childs = $(_leftcontent).Child(), //获取下面的所有的孩子节点 _height = _leftcontent.offsetHeight; //得到高度 //设置下面的高度等于整个高度-导航的高度 $("#UD_SYHZLZ")[0].style.height = _height - _childs[0].offsetHeight - _childs[1].offsetHeight + "px"; } //调整好友聊天框 U.F.W.ChatBoxSize = function (el, chatel) { var i, //用于循环 _childs, //0 聊天区域 1聊天记录区域 _rightchilds = $(el).Child(), //获取整个右边好友聊天区域的子元素 _chatchilds = $(chatel.parentNode).Child(), //获取聊天区域的子元素 _height = el.offsetHeight, //右边的高 _width = el.offsetWidth; //右边的长 //循环设置 for (i = 0; i < _chatchilds.length; i++) { //聊天记录和聊天框的大小设置 _childs = $(_chatchilds[i]).Child(); _childs[0].style.width = _width - _childs[1].offsetWidth + "px"; //聊天框的大小设置 $(".UD_SYFCA", _chatchilds[i]).css("height", _height - 350 + "px"); } } /** * 设置好友窗体打开和关闭的状态 * * @param {array} 显示隐藏的集合 */ U.F.W.FriendDisplayAndNone = function (style) { var _friendform = $("#UD_SYHZA"), //好友窗体 _friendright = $("#UD_SYHR"); //好友右侧 _friendform.addAttrArray({ "style": style[0] }); //给窗体设置参入的css值 _friendright.addAttrArray({ "style": style[1] }); //给窗体设置参入的css值 } //#endregion //判断是否需要创建 /** * 根据friendid判断好友窗体是否创建 * * @param {object} 群信息 */ U.F.W.IsCreateForm = function (friendid) { var i, //用于循环处理 _friendchatform = $("#UD_SYF")[0]; //好友聊天框 if (_friendchatform.childs) { //判断是否打开了聊天 for (i = 0; i < _friendchatform.childs.length; i++) { //循环所有打开的聊天找到已经和friendid对应打开的好友聊天 if (_friendchatform.childs[i].formid == friendid) { //如果找到匹配的好友聊天框或者群聊天框,则直接返回 return _friendchatform.childs[i].element; } } } } /** * 生成统一的好友窗体区域 * * @param {object} 好友或群信息 */ U.F.W.CreateFriendChat = function (friendandgroupinfo) { //变量定义 var _headel, _headimageel, _chatel, _chatleftel, _chatheadel, _chatheadimageel, _chatheadcontentel, _chatheadpromptel, _chatcontentel, _chatcontentnewsel, _chatnewsel, _chatnewsoneel, _chatnewstwoel, _chateditel, _chatbuttonel, _chatbuttonsendel, _chatrecordel, //群id获取好友id,作为窗体的唯一识别id _userid = friendandgroupinfo.GroupManageID || friendandgroupinfo.UserId, //显示在聊天框的名字,群名、好友描述、好友名字 _name = friendandgroupinfo.GroupManageName || friendandgroupinfo.FriendsDescript || friendandgroupinfo.UserNickName, //群描述、好友签名 descript = friendandgroupinfo.GroupManageDescript || friendandgroupinfo.UserIndividualitysignature || "暂时没有填写介绍..", //聊天框元素 _chatformel = $("#UD_SYF")[0], //聊天区域的还在元素 _chatformchilds = $(_chatformel).Child(), //头部切换导航区域的元素 _navichilds = $(_chatformchilds[0]).Child(); //头部标签 _headel = $$("div", { "className": "UD_SYFTO", "onmousedown": U.M.StopBubble }, _navichilds[0], _navichilds[0].firstChild); _headimageel = $$("div", { "className": "UD_SYFTOI" }, _headel); //好友显示头像 if (friendandgroupinfo.UserId) { $$("img", { "onerror": U.M.ImgError, "title": "点击查看", "src": U.M.GetImgU(friendandgroupinfo.UserThumbnailImageHead), "alt": friendandgroupinfo.UserNickName }, _headimageel); } //群显示头像 else { U.F.PrintGroupHeadImage(friendandgroupinfo, _headimageel, 4, [25, 25]); } $$("div", { "className": "UD_SYFTON UTDF", "innerHTML": _name }, _headel); $$("div", { "className": "UD_SYFTOC UD_SYI", "onclick": [[U.F.W.DelteFriendChat, [_userid, _chatformel, friendandgroupinfo]]] }, _headel); //聊天区 _chatel = $$("div", { "className": "UD_SYFNA" }); _chatformchilds[1].insertBefore(_chatel, _chatformchilds[1].firstChild); //左侧 _chatleftel = $$("div", { "className": "UD_SYFN" }, _chatel); //头部信息 _chatheadel = $$("div", { "className": "UD_SYFH" }, _chatleftel); _chatheadimageel = $$("div", { "className": "UD_SYFHH" }, _chatheadel); if (friendandgroupinfo.GroupManageID) { U.F.PrintGroupHeadImage(friendandgroupinfo, _chatheadimageel); $(_chatheadimageel).addAttrArray({ onclick: [[U.F.J.GroupInfoForm, [friendandgroupinfo]]], title: friendandgroupinfo["GroupManageName"] }); } else { $$("img", { "onerror": U.M.ImgError, "title": "点击查看", "onclick": [[U.M.StopBubble], U.D.IsUseStudio ? [U.U.I.ViewOtherUserInfo, [_userid]] : []], "src": U.M.GetImgU(friendandgroupinfo.UserThumbnailImageHead), "alt": friendandgroupinfo.UserNickName }, _chatheadimageel); } _chatheadcontentel = $$("div", { "className": "UD_SYFHT UTDF" }, _chatheadel); $$("div", { "className": "UD_SYFHTN", "innerHTML": _name }, _chatheadcontentel); $$("div", { "className": "UD_SYFHTC", "innerHTML": (friendandgroupinfo.GroupManageDescript || friendandgroupinfo.UserIndividualitysignature || "暂时没有填写介绍..") }, _chatheadcontentel); _chatheadpromptel = $$("div", { "className": "UD_SYFG" }, _chatleftel); $$("div", { "className": "UD_SYFGI UD_SYI" }, _chatheadpromptel); $$("div", { "className": "UD_SYFGC", "innerHTML": "交谈中请勿轻信汇款、中奖信息、陌生电话..." }, _chatheadpromptel); //内容发布区 _chatcontentel = $$("div", { "className": "UD_SYFCA" }, _chatleftel); _chatcontentnewsel = $$("div", { "className": "UD_SYFC" }, _chatcontentel); //发布内容区域 _chatnewsel = $$("div", { "className": "UD_SYFD", "style": { "position": "relative"} }, _chatleftel); _chatnewsoneel = $$("div", { "className": "UD_SYFDA" }, _chatnewsel); _chatnewstwoel = $$("div", { "className": "UD_SYFDT" }, _chatnewsoneel); _chateditel = $$("div", { "className": "UD_SYFDC", "contentEditable": "true" }, _chatnewsoneel); $$("div", { "className": "UD_SYFDJ UD_SYI" }, _chatnewsoneel); //按钮区域 _chatbuttonel = $$("div", { "className": "UD_SYFX" }, _chatleftel); _chatbuttonsendel = $$("div", { "className": "UD_SYFXE", "innerHTML": "发送(Enter)", "style": { "marginRight": "15px" }, "onclick": [[U.F.FM.SendFriendOrGroupChatMessage, [friendandgroupinfo, _chateditel, _chatcontentnewsel, (friendandgroupinfo.UserId == null)]]] }, _chatbuttonel); $$("div", { "className": "UD_SYFXC", "innerHTML": "关闭(n)", "onclick": [[U.F.W.FriendDisplayAndNone, [[{ "display": "none" }, { "display": "block"}], { "left": "auto", "right": "0px"}]]] }, _chatbuttonel); //右侧聊天记录 _chatrecordel = $$("div", { "className": "UD_SYFL" }, _chatel); $$("div", { "className": "UD_SYFLA" }, _chatrecordel); $$("div", { "className": "UD_SYFLB" }, _chatrecordel); //事件赋值 $$("div", { "classNmae": "UD_SYFDTF UD_SYI", "id": "UD_SFB", "title": "发送表情", "style": { "margin": "0", "position": "relative" }, "onmousedown": [[U.UI.face, [_chatnewsel, U.F.W.PrintEmoticon]]], "onclick": U.M.StopBubble }, _chatnewstwoel); _chatheadimageel = $$("div", { "className": "UD_SYFDTZ UD_SYI", "title": "添加文件", "onclick": [[U.Dk.HP.FileSwitch, [US.NU, null, { "CB": U.M.apply(null, [[U.F.W.AddFile, [friendandgroupinfo, _chatcontentnewsel]]])}]]] }, _chatnewstwoel); if (friendandgroupinfo.GroupManageID) { $$("div", { "className": "UD_SYFDTS UD_SYI", "title": "网盘提交", "onclick": [[U.D.DT.YYDK, ["Disk", { "userid": US.userInfo.userid, "directoryid": friendandgroupinfo.GroupManageID}]]] }, _chatnewstwoel); } $$("div", { "className": "UD_SYFDTJ UD_SYI", "title": "聊天记录", "onclick": [[U.F.FM.ViewFriendsChatRecords, [_chatrecordel, friendandgroupinfo, 1, (friendandgroupinfo.UserId == null)]]] }, _chatnewstwoel); _chateditel.onkeydown = U.M.apply(_chateditel, [[U.M.returnkeylogin, [[{ "obj": _chatbuttonsendel, "event": 'onclick'}]]]]); _headel.onclick = U.M.apply(this, [[U.F.W.SwitchFriendsChat, [[_headel, _chatel, friendandgroupinfo], friendandgroupinfo]]]); //切换事件 //设置光标处理 U.D.E.GetSelectionRange(window, _chateditel, { "TF": "Friend" }); //创建的好友窗体记录 if (_chatformel.childs == null) { _chatformel.childs = []; } _chatformel.childs.unshift({ "formid": _userid, "element": [_headel, _chatel], "info": friendandgroupinfo }); //添加记录 return _chatformel.childs[0].element; } // /** * 好友聊天切换 * * @param {string} 好友的id * @param {element} 窗体元素 */ U.F.W.SwitchFriendsChat = function (elements, friendorgroupinfo) { var i, _friendchatel, _chatel = $(elements[1]).Parent(2), _topbottom = $($(_chatel).Child()[0]).Child()[2], //右上角功能按钮 _chatchilds = _chatel.childs; //显示当前elements的聊天窗体,其他的隐藏 for (i = 0; i < _chatchilds.length; i++) { _friendchatel = _chatchilds[i].element; if (_friendchatel == elements) { //需要显示的聊天框 $(elements[0]).addClass("UD_SYFTOT"); $(elements[1]).css("display", "block"); //可编辑区域聚焦 $(".UD_SYFDC", elements[1])[0].focus(); } else { //需要隐藏的聊天框 $(_friendchatel[0]).removeClass("UD_SYFTOT"); $(_friendchatel[1]).css("display", "none"); } } //右上角功能点击处理处理 _topbottom.onclick = U.M.apply(_topbottom, [[U.F.R.PopupRightCornerMenu, [friendorgroupinfo, _topbottom]]]); _topbottom.title = friendorgroupinfo.UserId ? "个人信息" : "创建群"; //好友聊天框 U.F.W.ChatBoxSize(_chatel, elements[1]); } /** * 删除单个好友聊天 * * @param {string} 好友的id * @param {element} 窗体元素 */ U.F.W.DelteFriendChat = function (friendid, el) { var i, j, //循环处理 _chatinfo, //好友聊天的好友或者群信息 _elements, //好友聊天信息的框 _childs = el.childs; //获取所有的聊天框 //剩下最后一个直接关闭聊天框 if (_childs.length == 1) { U.F.W.FriendDisplayAndNone([{ "display": "none" }, { "display": "block"}], { "left": "auto", "right": "0px" }); //移除 } else { //循环找到friendid对应的弹框 for (i = 0; i < _childs.length; i++) { //判断窗体的id和好友的id是否一致 if (_childs[i].formid == friendid) { _elements = _childs[i]["element"]; //获取根据friendid创建的所有的元素 for (j = 0; j < _elements.length; j++) { //循环所有的元素,然后全部删除 $(_elements[i]).remove(); //移除元素处理 } _childs.splice(i, 1); //在所有孩子元素中删除该元素 //判断当前窗体是否在正在进行的聊天窗体,如果是的话,删除了这个窗体后要把下面的窗体显示出来 if (_elements[0].className.indexOf("UD_SYFTOT") > -1) { //获取下一个要显示的聊天框 _chatinfo = _childs[i] || _childs[i - 1]; //下一个或者是上一个 //显示该聊天框 U.F.W.SwitchFriendsChat(_chatinfo["element"], _chatinfo["info"]); } break; } } } } //生成发表聊天消息和获取聊天消息区域 /** * 查看聊天好友 * @param {element} 打印的内容区域 * @param {array} 打印消息的数组 * @param {boolean} 判断消息是自己发送的还是获取的 ---------- true 自己发送的 ---------- flase 获取的带的 */ U.F.W.PrintFriendChatMessage = function (el, newsinfo, issend) { var i, _date, //打印的时间 _chatcontentel, _chatcontentoneel, _chatcontentwordsel, _chatel = el.parentNode, //聊天框 _frag = $$("frag"), _stylearray = issend ? ["UD_SYFCT", "UD_SYFCTL", " UD_SYFCTTO", " UD_SYFCTO"] : ["UD_SYFCO", "UD_SYFCOL", " UD_SYFCTT", ""]; //打印的样式 //打印的消息 for (i = 0; i < newsinfo.length; i++) { _date = U.MT.getYearMonthDay(newsinfo[i]["Time"] || newsinfo[i]["MessageSendTime"], "Array"); _chatcontentel = $$("div", { "className": _stylearray[0] }, _frag); _chatcontentoneel = $$("div", { "className": _stylearray[1] }, _chatcontentel); //自己发的消息样式打印 if (issend) { $$("div", { "className": "UD_SYFCOLC UD_SYFCTLC", "innerHTML": newsinfo[i]["Content"] }, _chatcontentoneel); $$("div", { "className": "UD_SYFCOLT UD_SYFCTLT UD_SYI" }, _chatcontentoneel); } //其他人发的消息打印 else { $$("div", { "className": "UD_SYFCOLT UD_SYI" }, _chatcontentoneel); $$("div", { "className": "UD_SYFCOLC", "innerHTML": newsinfo[i]["MessageContent"] }, _chatcontentoneel); } _chatcontentwordsel = $$("div", { "className": "UD_SYFCOT" + _stylearray[2] }, _chatcontentel); $$("div", { "className": "UD_SYFCOTO" + _stylearray[3], "innerHTML": (_date[3] + ":" + _date[4] + ":" + _date[5]) }, _chatcontentwordsel); } el.appendChild(_frag); //消息定位到底部 _chatel.scrollTop = _chatel.scrollHeight - _chatel.offsetHeight; } /** * 查看聊天 好友或者群 * @param {element} 打印的内容区域 * @param {array} 打印消息的数组 * @param {boolean} 判断消息是自己发送的还是获取的 ---------- true 自己发送的 ---------- flase 获取的带的 */ U.F.W.PrintGroupChatMessage = function (el, newsinfo, issend) { var i, _date, _contentel, _contentoneel, _contentwordsel, _contentimgel, _contentnameel, _stylearray, _chatcontentel = el.parentNode, _frag = $$("frag"); //发送消息是自己和他人区别的样式 if (issend) { _stylearray = ["UD_SYFCT", " UD_SYFCTLC UD_SYGCTLC", " UD_SYFCOLCOO", " UD_SYFCTTO", " "]; } else { _stylearray = ["UD_SYFCO", "", " UD_SYFCOLCOT", " UD_SYFCTT"]; } //循环打印聊天消息 for (i = 0; i < newsinfo.length; i++) { _date = U.MT.getYearMonthDay(newsinfo[i]["Time"] || newsinfo[i]["GroupMessageSendTime"], "Array"); _contentel = $$("div", { "className": _stylearray[0], "title": newsinfo[i].GroupMessageSendUsername || newsinfo[i].Name }, _frag); _contentoneel = $$("div", { "className": "UD_SYFCOLC" + _stylearray[1] }, _contentel); _contentimgel = $$("img", { "onerror": U.M.ImgError, "title": "点击查看", "onclick": [[U.U.I.ViewOtherUserInfo, [newsinfo[i].GroupMessageSendUser || newsinfo[i].UserId]]], "src": U.M.GetImgU((newsinfo[i].IMG || newsinfo[i].UserThumbnailImageHead)), "className": "UD_SYFCOLCI" }, _contentoneel); _contentwordsel = $$("div", { "className": "UD_SYFCOLCO " + _stylearray[2], "innerHTML": newsinfo[i]["Content"] || newsinfo[i]["GroupMessageContent"] }, _contentoneel); (issend) && (_contentoneel.insertBefore(_contentwordsel, _contentimgel)); _contentnameel = $$("div", { "className": "UD_SYFCOT " + _stylearray[3] }, _contentel); $$("div", { "className": "UD_SYFCOTOK", "innerHTML": newsinfo[i].GroupMessageSendUsername || newsinfo[i].Name }, _contentnameel); $$("div", { "className": "UD_SYFCOTO UD_SYFCTO", "style": { "bottom": "0px" }, "innerHTML": (_date[3] + ":" + _date[4] + ":" + _date[5]) }, _contentnameel); } //追加消息 el.appendChild(_frag); //消息定位到底部 _chatcontentel.scrollTop = _chatcontentel.scrollHeight - _chatcontentel.clientHeight; } /** * 查看聊天好友 * @param {element} 打印的内容区域 * @param {array} 打印消息的数组 * @param {boolean} 判断消息是自己发送的还是获取的 ---------- true 自己发送的 ---------- flase 获取的带的 */ U.F.W.AddFile = function (friendinfo, el, thumbnail, fileurl, fileinfo) { //临时元素变量 var _tempel, _temponeel, _temptwoel, _tempthreeel, _isgroup = friendinfo.UserId == null; //图片发送方式 if (U.UP.IsImg(fileinfo.UserDirectoryExtendType)) { //创建一个元素 _tempel = $$("div", {}); //创建一个图片标签,添加图片 $$("img", { "className": "UD_SYFCI", "src": U.M.GetImgU(thumbnail), "title": U.M.GetImgU(fileurl) }, _messageel).onclick = "U.M.StopBubble();U.D.Img.Img(US.userInfo, { 'Thm': '" + fileurl + "', 'Img': '" + fileurl + "'})"; //图片内容 //发送图片 U.F.FM.SendFriendOrGroupChatMessage(friendinfo, _messageel, el, _isgroup, true); } //文件发送方式 else { _tempthreeel = $$("div"); //发表文章样式 _tempel = $$("div", { "className": "UD_SYWF" }, _tempthreeel); _temponeel = $$("div", { "className": "UD_SYWFS" }, _tempel); _temptwoel = $$("div", { "className": "UD_SYWFSS" }, _temponeel); $$("div", { "innerHTML": fileinfo["UserDirectoryExtendType"] }, _temptwoel); _temptwoel = $$("div", { "className": "UD_SYWFSX" }, _temponeel); $$("div", { "className": "UD_SYWFSXN", "innerHTML": fileinfo["UserallDirectoryName"] }, _temptwoel); $$("div", { "className": "UD_SYWFSXS", "innerHTML": "已成功发送" }, _temptwoel); _temponeel = $$("div", { "className": "UD_SYWFX" }, _tempel); //如果是在1473上看到该信息,则可以直接打开网盘到指定的地方 if (U.D.IsUseStudio) { _tempel.onclick = "U.M.StopBubble();YDHJH('disk', ['" + fileinfo.UserId + "', '" + fileinfo.UserDirectoryID + "'])" _temptwoel = $$("div", { "innerHTML": "打开我的云盘", "title": "打开我的云盘" }, _temponeel); _temptwoel.onclick = "U.M.StopBubble();YDHJH('disk', ['" + fileinfo.UserId + "','" + fileinfo.UserDirectoryParentID + "'])"; _temptwoel = $$("div", { "innerHTML": "打开", "title": "打开" }, _temponeel); _temptwoel.onclick = "U.M.StopBubble();YDHJH('disk', ['" + fileinfo.UserId + "','" + fileinfo.UserDirectoryID + "'])"; } //如果是第三方调用我们的好友,则出现下载 else { _temptwoel = $$("div", { "innerHTML": "下载", "title": "下载" }, _temponeel); _temptwoel.onclick = "U.M.StopBubble();U.UP.FileDL('" + fileinfo.UserallDirectoryName + "','" + fileinfo.UserFilesServerName + "')"; } //显示出文件的样式 U.F.FM.SendFriendOrGroupChatMessage(friendinfo, _tempthreeel, el, _isgroup, true); } } //#endregion //#region 好友聊天扩展 /** * 点击表情框处理 * * @param {el} 表情框元素 * @param {number} 第几个 i 对应路径 /img/ChatingFaceGif/[face](i).gif */ U.F.W.PrintEmoticon = function (el, i) { var _imageurl = "/img/ChatingFaceGif/[face](" + i + ").gif", //表情路径 _range = U.D.E.SORange.OE["Friend"]; //光标 _range.Replace(" " + $$("img", { "src": _imageurl, "contentEditable": "true" }).outerHTML + " ", null, true); } //#endregion //右侧好友定位 U.F.W.RightFormlocation = function () { $("#UD_SYHR").addAttrArray({ "style": { "top": (US.Height - 530) / 2, "right": "0px"} }); // }