123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460 |
-
- Namespace.register("U.MD.F.R");
- U.MD.F.R.friendsRightClickMenu = function (el, friendinfo) {
- var _friendmenuel = $('#U_MD_F_G_Div')[0],
- _child = $(_friendmenuel).Child();
-
- $(_friendmenuel).css({ "display": "block", "zIndex": "999" });
- U.UF.C.rightClickMenuLocation(_friendmenuel);
-
- _child[0].onclick = function () { U.MD.F.W.popupFriendsForm(friendinfo); };
- _child[1].onclick = function () { U.MD.U.V.ViewOtherUserInfo(friendinfo); };
- _child[2].onmouseover = function () { U.MD.F.R.moveFriendForm(friendinfo, el, _child[2]); };
- _child[3].onclick = function () { U.MD.F.R.deleteFriendForm(friendinfo); };
-
- $(document).bind("click", function () {
- $(_friendmenuel)[0].style.display = "none";
- })
- }
- U.MD.F.R.moveFriendForm = function (friendinfo, el, menubootom) {
- var i,
- _friendclassel = $(menubootom).parentElement().Child()[4],
- _friendclassinfo = US.friend.allclass;
- _friendclassel.innerText = "";
-
- if (_friendclassinfo.length > 1) {
-
- for (i = 0; i < _friendclassinfo.length; i++) {
-
- if (_friendclassinfo[i].FriendsGroupID != friendinfo.FriendsGroupID) {
-
- $$("div", { "class": "U_MD_F_G_Div_Children_A", "innerText": _friendclassinfo[i]["FriendsGroupName"],
- "onclick": U.UF.C.closure(function (i) {
- U.MD.F.R.assignMoveFriend(friendinfo, _friendclassinfo[i], el);
- }, [i])
- }, _friendclassel);
- }
- }
- _friendclassel.style.display = "block";
- }
- }
- U.MD.F.R.assignMoveFriend = function (friendinfo, groupinfo, el) {
-
- if (friendinfo) {
- $('#U_MD_F_G_Div')[0].style.display = "none";
- $(".U_MD_F_G_Div_Children")[0].style.display = "none";
-
- U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "MoveFriendToOtherClass", friendinfo.FriendsID, groupinfo["FriendsGroupID"]],
- U.MD.F.R.asynAssignMoveFriend, ["", friendinfo, groupinfo, el]);
- U.alert('修改成功');
- }
- }
- U.MD.F.R.asynAssignMoveFriend = function (r) {
- var _child,
- _context = r.context,
- _friendinfo = _context[1],
- _groupinfo = _context[2],
- _el = _context[3],
- _friendgroupel = $("#g" + _groupinfo.FriendsGroupID)[0],
- _previousgroupinfo = U.Json.select(US.friend.allclass, { "FriendsGroupID": _friendinfo.FriendsGroupID })[0],
- _friendnum = U.Json.select(US.friend.friends, { "FriendsGroupID": _friendinfo.FriendsGroupID }).length - 1
- ;
-
- $(_el).parentElement(2).Child()[0].innerHTML = _previousgroupinfo.FriendsGroupName + "(" + _friendnum + ")";
-
- _friendinfo.FriendsGroupID = _groupinfo.FriendsGroupID;
-
- if (_friendgroupel) {
- _child = $(_friendgroupel).Child();
- _friendnum = U.Json.select(US.friend.friends, { "FriendsGroupID": _friendinfo.FriendsGroupID }).length;
- _child[0].innerHTML = _groupinfo["FriendsGroupName"] + "(" + _friendnum + ")";
- _child[1].appendChild(_el);
- }
- }
- U.MD.F.R.moveFriendOver = function (isdisplay, friendgroupmenu, el) {
-
- if (!U.UF.EV.stopBubbleMouseOutOrOver(el)) {
-
- friendgroupmenu.style.display = isdisplay ? "none" : "block";
- }
- }
- U.MD.F.R.topMoveFriendForm = function (el, friendinfo) {
- var _chooseGroupInfon = null;
-
- if (!$(".U_MD_F_G_Y_D")[0]) {
- var i,
- _tempel,
- _friendclassel = $$("div", { "className": "U_MD_F_G_Y_D" }),
- _friendclassinfo = US.friend.allclass,
- _friendclassform = U.UF.UI.confirm(_friendclassel, function () { U.MD.F.R.assignMoveFriend(friendinfo, _chooseGroupInfon, el) });
- $$("div", { "innerText": "选择好友移动至", "className": "U_MD_F_G_Y_DT" }, _friendclassel);
- _tempel = $$("div", { "className": "U_MD_F_G_Y_DS" }, _friendclassel);
-
- for (i = 0; i < _friendclassinfo.length; i++) {
- $$("div", { "innerHTML": _friendclassinfo[i].FriendsGroupName,
- "className": "U_MD_F_G_Div_Q" + (friendinfo.FriendsGroupID == _friendclassinfo[i].FriendsGroupID ? " U_MD_F_G_Div_QO" : ""),
- "onclick": U.UF.C.closure(function (i) {
- U.MD.F.R.topMoveFriendFormSwitch(this, friendinfo, _friendclassinfo[i], _friendclassform, el);
- _chooseGroupInfon = _friendclassinfo[i];
- }, [i])
- }, _tempel);
- }
-
- $($(_friendclassform.content)[0]).Parent().style.height = "100%";
- } else {
- var _formparent = $($($($($($(".U_MD_F_G_Y_D")[0]).Parent()).Parent()).Parent()).Parent()).Parent();
- if (_formparent.style.display == "none") {
- _formparent.style.display = "block";
- } else {
- _formparent.style.display = "none"
- }
- }
- }
- U.MD.F.R.topMoveFriendFormSwitch = function (groupel, friendinfo, friendclassinfo, friendclassform, el) {
- var i,
- _child = $(el).parentElement().Child();
- _group = $(".U_MD_F_G_Y_DS").Child();
- for (i = 0; i < _group.length; i++) {
- _group[i].className = $(".U_MD_F_G_Y_DS").Child()[i].className == "U_MD_F_G_Div_Q U_MD_F_G_Div_QO" ? "U_MD_F_G_Div_Q" : "U_MD_F_G_Div_Q";
- groupel.className = "U_MD_F_G_Div_Q U_MD_F_G_Div_QO";
- }
-
- for (i = 0; i < _child.length; i++) {
- _child[i].className = "U_MD_F_H_ZLZOCO" + (el == _child[i] ? " U_MD_F_G_Div_QQ" : "");
- }
-
-
- }
- U.MD.F.R.friendClassRightClickMenu = function (friendgroupinfo, el) {
- var _el = $('#U_MD_F_G_Qun')[0],
- _child = $(_el).Child();
- $(_el).css({ "display": "block", "zIndex": "999" });
- U.UF.C.rightClickMenuLocation(_el);
-
- _child[0].onclick = function () { U.MD.F.R.popupUpdateFriendsClassForm(friendgroupinfo, el); };
- _child[1].onclick = function () { U.MD.F.R.popupDeleteFriendsClassForm(friendgroupinfo, el); };
- $(document).bind("click", function () {
- $('#U_MD_F_G_Qun')[0].style.display = "none";
- })
- }
- U.MD.F.R.popupUpdateFriendsClassForm = function (friendgroupinfo, el) {
- var _tempel,
- _temponeel,
- _temptwoel;
- var _el = $('#U_MD_F_G_Qun')[0];
- $(_el).css({ "display": "none" });
- if (friendgroupinfo) {
-
- _tempel = $$("div", { "className": "U_MD_U_L_Box_I U_MD_F_Add_TNL U_MD_F_G" });
- _temponeel = $$("div", {}, _tempel)
- _temptwoel = $$("input", { "value": friendgroupinfo.FriendsGroupName, "onfocus": function () { U.UF.MR.inputPlaceholder(this, friendgroupinfo.FriendsGroupName, ""); },
- "onblur": function () { U.UF.MR.inputPlaceholder(this, "", friendgroupinfo.FriendsGroupName); }
- }, _temponeel);
-
- U.UF.UI.confirm(_tempel, function () { U.MD.F.R.assignUpdateFriendsClass(friendgroupinfo, _temptwoel, el); });
- }
- else {
- U.alert("暂无群信息");
- }
- }
- U.MD.F.R.assignUpdateFriendsClass = function (friendgroupinfo, formel, el) {
- U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "UpdateClassNameAndDescription", friendgroupinfo["FriendsGroupID"], formel.value, ""],
- function () {
- $(el)[0].innerText = formel.value;
- U.alert("修改成功");
- }, []);
- U.alert("正在修改中");
- }
- U.MD.F.R.popupDeleteFriendsClassForm = function (friendgroupinfo, el) {
- var _content;
- var _el = $('#U_MD_F_G_Qun')[0];
- $(_el).css({ "display": "none" });
- if (friendgroupinfo) {
- _content = "是否确定删除(" + friendgroupinfo.FriendsGroupName + ")该分组";
- U.UF.UI.confirm(_content, function () { U.MD.F.R.assignDeleteFriendsClass(friendgroupinfo, el); });
- }
- }
- U.MD.F.R.assignDeleteFriendsClass = function (friendgroupinfo, el) {
- var _friendGroupLength = U.Json.select(US.friend.friends, { "FriendsGroupID": friendgroupinfo.FriendsGroupID }).length;
- if (friendgroupinfo.FriendsGroupDescript != "自动创建") {
- if (_friendGroupLength == 0) {
- U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "DeleteFriendClass", friendgroupinfo.FriendsGroupID],
- function () {
- $(el).Parent().remove()
- U.alert("删除成功");
-
- for (i = 0; i < US.friend.allclass.length; i++) {
- if (US.friend.allclass[i].FriendsGroupID == friendgroupinfo.FriendsGroupID) {
- US.friend.allclass.splice(i, 1);
- }
- }
- }, []);
- U.alert("正在删除中");
- } else {
- U.alert(friendgroupinfo.FriendsGroupName + "该分组下有好友,无法删除");
- }
- } else {
- U.alert("自动创建的分组不可删除");
- }
- }
- U.MD.F.R.deleteFriendForm = function (friendinfo, callback) {
- var _el;
-
- _el = $$("div", { "class": "U_MD_F_G_D" });
- $$("div", { "class": "U_MD_F_G_DelSpan", "innerText": "删除后对方将从好友列表中消失,无法进行发送以及接收消息。" }, _el);
-
- U.UF.UI.confirm(_el, function () {
- U.MD.F.M.deleteFriend(friendinfo);
- U.UF.C.isFunction(callback) && callback();
- });
- }
- U.MD.F.R.popupRightCornerMenu = function (friendinfo, el) {
- var _tempel,
- _friendclassinfo,
- _isaddfriend,
- _menuel = $(el).Child()[0];
-
- if (_menuel) {
- $(_menuel).remove();
- }
- else {
-
- if (friendinfo.UserId) {
- _isaddfriend = U.Json.selectOne(US.friend.friends, { "UserId": friendinfo.UserId });
-
- if (_isaddfriend) {
-
- _friendclassinfo = $($("#g" + _isaddfriend.FriendsGroupID + " div")[1]).find('[tid="' + _isaddfriend["UserId"] + '"]')[0];
-
- _tempel = $$("div", { "class": "U_MD_F_T_B", style: {} }, el);
- $$("div",
- {
- "innerText": "修改备注姓名",
- "onclick": function () {
- U.MD.F.R.updateFriendDescriptForm(_isaddfriend);
- }
- },
- _tempel);
- $$("div",
- {
- "innerText": "修改好友分组",
- "onclick": function () {
- U.MD.F.R.topMoveFriendForm(_friendclassinfo, _isaddfriend);
- }
- },
- _tempel);
- $$("div",
- {
- "innerText": "删除好友",
- "onclick": function () {
- U.MD.F.R.deleteFriendForm(_isaddfriend);
- }
- },
- _tempel);
- }
-
- else {
- $$("div", { "innerText": "添加该好友" }, _tempel);
- }
- }
-
- else {
- U.MD.F.J.groupInfoForm(friendinfo);
- }
- }
- }
- U.MD.F.R.updateFriendDescriptForm = function (_friendinfo) {
- var _tempel,
- _temponeel,
- _temptwoel,
- _descript;
- _descript = _friendinfo.FriendsDescript || _friendinfo.UserNickName;
-
- _tempel = $$("div", { "className": "U_MD_U_L_Box_I U_MD_F_Add_TNL U_MD_F_G" });
- _temponeel = $$("div", {}, _tempel)
- _temptwoel = $$("input",
- {
- "value": _descript,
- "onfocus": function () {
- U.UF.MR.inputPlaceholder(this, _descript, "");
- },
- "onblur": function () {
- U.UF.MR.inputPlaceholder(this, "", _descript);
- }
- }, _temponeel);
-
- U.UF.UI.confirm(_tempel, function () {
- U.MD.F.R.updateFriendDescript(_friendinfo, _temptwoel);
- });
- }
- U.MD.F.R.updateFriendDescript = function (friendinfo, el) {
- U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "UpdateFriendDescription", friendinfo['FriendsID'], el.value],
- U.MD.F.R.asynUpdateFriendDescript, [null, friendinfo, el.value]);
- }
- U.MD.F.R.asynUpdateFriendDescript = function (r) {
- var _context = r.context,
- _friendinfo = _context[1],
- _descript = _context[2],
- _el = $($("#g" + _friendinfo.FriendsGroupID + " div")[1]).find('[tid="' + _friendinfo["UserId"] + '"]')[0];
- _friendinfo.FriendsDescript = _descript;
-
- if (_el) {
- $("div", _el)[2].innerText = _context[2];
- }
-
- $("div", $('.U_MD_F_TO.U_MD_F_TOT')[0])[1].innerText = _context[2];
- var _obj = $('.U_MD_F_TO.U_MD_F_TOT')[0],
- _tags = $(".U_MD_F_TA")[0].children;
- for (var i = 0, len = _tags.length; i < len; i++) {
-
- if (_tags[i] == _obj) {
- $("div", $('.U_MD_F_H')[i])[2].innerText = _context[2];
- }
- }
- }
- U.MD.F.R.GroupRightClickMenu = function (el, friendgroupinfo) {
- var _el = $('#U_MD_F_G_Group')[0],
- _child = $(_el).Child();
- $(_el).css({ "display": "block", "zIndex": "999" });
- U.UF.C.rightClickMenuLocation(_el);
-
- _child[0].onclick = function () { U.MD.F.J.groupInfoForm(friendgroupinfo, el) };
- _child[1].onclick = function () { U.MD.F.J.groupExit(friendgroupinfo, US.userInfo); };
- $(document).bind("click", function () {
- $('#U_MD_F_G_Group')[0].style.display = "none";
- })
- }
|