123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575 |
- Namespace.register("U.MD.F.S");
- U.MD.F.S.SearchPostion;
- U.MD.F.S.searchFriendsOrGroupForm = function (inputs, el, cb, typename) {
- var _searchfriendinfo = [],
- _searchvalue = inputs.value,
- _isserch = U.MD.F.S.searchFriendsKeyboardHandle(el, inputs)
- ;
-
- if (_isserch) {
-
- if (!typename || typename == "F") {
- _searchfriendinfo = _searchfriendinfo.concat(U.Json.like(US.friend.friends, { "FriendsDescript": _searchvalue, "UserNickName": _searchvalue, "UserName": _searchvalue }));
- }
-
- if (!typename || typename == "G") {
- _searchfriendinfo = _searchfriendinfo.concat(U.Json.like(US.friend.group, { "GroupManageName": _searchvalue }));
- }
-
- el.style.display = "block";
- el.innerText = "";
-
- U.MD.F.S.printSearchFriends(_searchfriendinfo, el, cb);
- };
- }
- U.MD.F.S.searchFriendsKeyboardHandle = function (el, inputs) {
- var _keycode;
- if (event) {
- _keycode = event.keyCode
- } else {
- _keycode = 0
- }
- _childs = $(el).Child(),
- _searchvalue = inputs.value,
- _position = U.MD.F.S.SearchPostion,
- _searchel = _childs[_position]
- ;
-
- if (_searchvalue == "" || _searchvalue == inputs.defaultValue) {
- el.style.display = "none";
- }
-
- else if (_position > -1 && _keycode == 13 || _keycode == 10 && _childs[_position].onmousedown) {
- _childs[_position].ondblclick();
- }
-
- else if (_keycode != 38 && _keycode != 40) {
- U.MD.F.S.SearchPostion = -1;
- return true;
- }
- return false;
- }
- U.MD.F.S.printSearchFriends = function (friendinfo, el, cb) {
- var i,
- _name,
- _tempel,
- _temponeel,
- _temptwoel,
- _frag = $$("frag"),
- _childs = $(el).Child();
-
- if (!friendinfo[0]) {
- $$("div", { "className": "U_MD_F_S_Local_NoData", "innerText": "很抱歉,没有找到您搜索的好友" }, el);
- }
- else {
-
- for (i = 0; i < friendinfo.length; i++) {
- (function (i) {
-
- _name = friendinfo[i].GroupManageName || friendinfo[i].FriendsDescript || friendinfo[i].UserNickName || friendinfo[i].UserName;
-
- _tempel = $$("div", {
- "title": "点击查看",
- "className": "U_MD_F_S_Local_Result",
- "onclick": function () {
- U.MD.F.S.switchSearchFriendsOrGroup(el, i);
- },
- "ondblclick": function () {
- U.MD.F.W.popupFriendsForm(friendinfo[i]);
- U.MD.F.S.hideSearchFriendsOrGroupForm(el);
- }
- }, _frag);
- _temptwoel = $$("div", { "className": "U_MD_F_H_ZLZOCOI", "title": _name }, _tempel);
- if (friendinfo[i].GroupManageID) {
- U.MD.F.printGroupHeadImage(friendinfo[i], _temptwoel, 4, [35, 35]);
- }
- else {
- $$("img",
- {
- "onerror": U.MD.C.imgError,
- "className": "U_MD_HomeSSZJDAO",
- "src": U.MD.C.getHeadImage(friendinfo[i].UserThumbnailImageHead)
- },
- _temptwoel);
- }
- $$("span", { "className": "U_MD_F_S_Local_UserName", "innerHTML": _name }, _tempel);
- })(i);
- }
- el.appendChild(_frag);
- }
- $('body').unbind('keyup', U.MD.F.S.SwitchFunction);
- U.MD.F.S.SwitchFunction = U.UF.C.closure(U.MD.F.S.switchSearchFriendsOrGroup, [el]);
- $('body').bind('keyup', U.MD.F.S.SwitchFunction);
- U.MD.F.S.SearchPostion = -1;
- return _childs;
- }
- U.MD.F.S.switchSearchFriendsOrGroup = function (el, switchposition) {
- var _switchel,
- _top,
- _scrolltop,
- _isswitch = null,
- _keycode = event.keyCode,
- _childs = $(el).Child(),
- _postion = U.MD.F.S.SearchPostion,
- _nowswitchel = _childs[switchposition || U.MD.F.S.SearchPostion]
- ;
- if (_keycode == 38) {
- _isswitch = -1
- } else if (_keycode == 40) {
- _isswitch = 1
- }
-
- if (_isswitch || (switchposition != null && switchposition != _postion)) {
-
- if (switchposition != null) {
- U.MD.F.S.SearchPostion = switchposition;
- }
-
- else {
- U.MD.F.S.SearchPostion += _isswitch;
- }
-
- if (U.MD.F.S.SearchPostion > _childs.length - 1) {
- U.MD.F.S.SearchPostion = 0;
- } else if (U.MD.F.S.SearchPostion < 0) {
- U.MD.F.S.SearchPostion = _childs.length - 1;
- }
- switchposition = U.MD.F.S.SearchPostion;
- _switchel = _childs[switchposition];
-
- if (_switchel) {
- $('.U_MD_F_S_Local_Result_Hover').removeClass('U_MD_F_S_Local_Result_Hover')
- _switchel.className = "U_MD_F_S_Local_Result U_MD_F_S_Local_Result_Hover";
-
- _top = _switchel.offsetTop;
- _scrolltop = el.scrollTop;
- if (_top > el.offsetHeight + _scrolltop - 40) {
- el.scrollTop = _top - el.offsetHeight;
- }
- if (_top < el.scrollTop) {
- el.scrollTop = _top;
- }
- }
- }
- }
- U.MD.F.S.hideSearchFriendsOrGroupForm = function (el) {
- $("body")[0].focus();
- el.style.display = "none";
- $('body').unbind('keyup', U.MD.F.S.SwitchFunction);
- $(el).prev().Child()[0].value = "联系人、好友讨论组";
- }
- U.MD.F.S.popupsSearchGroups = function () {
-
- var _form = new U.UF.UI.form('<div class="U_MD_F_S_TO U_MD_F_S_TR">群文档搜索查看区域</div><div class="U_MD_F_S_TD" onmousedown="U.UF.EV.stopBubble();"><div class="U_MD_F_S_TDL"><input id="U_MD_F_S_GF_Search" value="群文档搜索" onblur="U.UF.MR.inputPlaceholder(this,\'\',\'群文档搜索\');" onfocus="U.UF.MR.inputPlaceholder(this,\'群文档搜索\',\'\');" placeholder="群文档搜索" onkeyup="if (event.keyCode == 13 || event.keyCode == 10) {$(this).parentElement(2).Child()[1].onclick();}" /></div><div id="U_MD_F_S_TDR_GF" class="U_MD_F_S_TDR">搜索</div></div>',
- "<div class='U_MD_F_S_CX'></div><div class='U_MD_F_S_CD'></div>",
- {
- "resize": U.MD.F.S.searchGroupsFormSize,
- "id": "U_MD_F_S",
- "style": {
- "width": "71.5%",
- "height": "70%"
- }
- },
- null,
- {
- "style": {
- "padding": "10px 0"
- }
- });
- var _formel = _form.form;
- $(_formel).find("input")[0].focus();
- $('#U_MD_F_S_TDR_GF')[0].onclick = function () {
- U.MD.F.S.searchAjax(1, 1, _formel.children[2].children[0], $('#U_MD_F_S_GF_Search')[0])
- }
- U.MD.F.S.searchGroupsFormSize(_formel);
- U.MD.F.S.searchAjax($(_form.middle).Child()[1], 1, _formel.children[2].children[0], $('#U_MD_F_S_GF_Search')[0]);
- return _formel;
- }
- U.MD.F.S.popupsSearchFtp = function () {
- var _form = new U.UF.UI.form('<div class="U_MD_F_S_TO U_MD_F_S_TR">FTP共享区域查看</div><div class="U_MD_F_S_TD" onmousedown="U.UF.EV.stopBubble();"><div class="U_MD_F_S_TDL"><input id="U_MD_F_S_FTP_Search" value="FTP搜索" onblur="U.UF.MR.inputPlaceholder(this,\'\',\'FTP搜索\');" onfocus="U.UF.MR.inputPlaceholder(this,\'FTP搜索\',\'\');" placeholder="FTP搜索" onkeyup="if (event.keyCode == 13 || event.keyCode == 10) {$(this).parentElement(2).Child()[1].onclick();}" /></div><div id="U_MD_F_S_TDR" class="U_MD_F_S_TDR">搜索</div></div>',
- "<div class='U_MD_F_S_CX'></div><div class='U_MD_F_S_CD'></div>",
- {
- "resize": U.MD.F.S.searchGroupsFormSize,
- "id": "U_MD_F_F",
- "style":
- {
- "width": "70%",
- "height": "70%"
- }
- },
- null,
- {
- "style": {
- "padding": "10px 0"
- }
- });
- var _formel = _form.form;
- $('#U_MD_F_S_TDR')[0].onclick = function () {
- U.MD.F.S.searchAjax(1, 0, $("#U_MD_F_F")[0].children[2].children[0], $("#U_MD_F_S_FTP_Search")[0])
- }
- $(_formel).find("input")[0].focus();
- U.MD.F.S.searchGroupsFormSize(_formel);
- U.MD.F.S.searchAjax($(_form.middle).Child()[1], 0, _formel.children[2].children[0], $('#U_MD_F_S_FTP_Search')[0]);
- return _formel;
- }
- U.MD.F.S.searchGroupsFormSize = function (contentel) {
- var _parentel = $(contentel).Parent(3);
- contentel.style.width = Math.floor(_parentel.offsetWidth / 225) * 225 + "px";
- $(contentel).Parent().style.height = _parentel.offsetHeight - 125 + "px";
- }
- U.MD.F.S.searchAjax = function (page, isgroupserch, contentel, inputel) {
- var _searchvalue = inputel.value == inputel.defaultValue ? "" : inputel.value;
-
- if (_searchvalue != "") {
- U.MD.F.S.searchGroupOrFriend(page, isgroupserch, contentel, inputel);
- }
-
- else {
- U.MD.F.S.getHotFriendOrGroup(1, isgroupserch, contentel);
- }
- }
- U.MD.F.S.searchGroupOrFriend = function (page, isgroupserch, contentel, inputel) {
- var _searchvalue = inputel.value == inputel.defaultValue ? "" : inputel.value,
- _end = page * 80,
- _start = _end - 79,
- _loadingel = page > 1 ? $(contentel).parentElement(2).Child()[2] : $(contentel).parentElement()[0]
- ;
-
- if (isgroupserch) {
-
- U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "SearchGroupInfo", _searchvalue, _start, _end],
- U.MD.F.S.ajaxSearchAjax, [_loadingel, page, _searchvalue, contentel, isgroupserch]);
- }
-
- else {
-
- U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "SearchFriendInfo", US.userInfo.userid || US.EMPTYGUID, _searchvalue, _start, _end],
- U.MD.F.S.ajaxSearchAjax, [_loadingel, page, _searchvalue, contentel, isgroupserch]);
- }
-
- U.UF.EV.scrollLoad($(contentel).Parent(), function () {
- U.MD.F.S.searchAjax(page + 1, isgroupserch, contentel, inputel);
- });
- }
- U.MD.F.S.getHotFriendOrGroup = function (page, isgroup, el) {
- var i,
- _loadingel = page > 1 ? $(el).parentElement(2).Child()[2] : $(el).parentElement()[0],
- _end = page * 80,
- _start = _end - 79
- ;
-
- if (page == 1) {
-
- U.UF.EV.scrollLoad($(el).Parent(), function () {
- U.MD.F.S.getHotFriendOrGroup(page + 1, isgroup, el);
- });
- }
-
- if (isgroup) {
- U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "RecommendGroups", _start, _end],
- U.MD.F.S.asynGetHotFriendOrGroup, [_loadingel, el, isgroup]);
- }
-
- else {
- U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "GetFtpHotUser", _start, _end],
- U.MD.F.S.asynGetHotFriendOrGroup, [_loadingel, el, isgroup]);
- }
- }
- U.MD.F.S.asynGetHotFriendOrGroup = function (r) {
- var _context = r.context,
- _el = _context[1],
- _isgroup = _context[2];
- r = r.value;
-
- U.MD.F.S.printSearchContent(r, _el, _isgroup);
-
- if (r.length < 80) {
- $(_el).Parent().onscroll = null;
- }
- }
- U.MD.F.S.ajaxSearchAjax = function (r) {
-
- var _context = r.context,
- _page = _context[1],
- _searchvalue = _context[2],
- _el = _context[3],
- _isgroup = _context[4];
- r = r.value;
-
- if (_page == 1) {
- _el.innerHTML = "";
-
- if (!r || !r.length) {
- U.MD.F.S.printNullSearch(_el);
- }
- }
-
- if (r && r.length) {
- U.MD.F.S.printSearchContent(r, _el, _isgroup);
- }
- }
- U.MD.F.S.printSearchContent = function (friendsinfo, el, isgroup) {
- var i, _el, _tempel, _tempela, _tempelb, _tempelc, _arr,
- _userid = US.userInfo.userid || "",
- _frag = $$("frag");
- if (isgroup) {
- _arr = ["GroupManageName", "+加群"];
- }
- else {
- _arr = ["UserNickName", "+好友"];
- }
-
- for (i = 0; i < friendsinfo.length; i++) {
- _el = $$("div", { "className": "U_MD_F_S_Pop_Content_G U_MD_D_Radius_5",
- "onclick": U.UF.C.closure(function (friendinfo) {
- if (isgroup) {
-
- }
- else {
- U.MD.D.I.openApplication("disk", { "userid": friendinfo.UserId, "directoryid": US.FTPFOLDERID });
- }
- }, [friendsinfo[i]])
- }, _frag);
- _tempel = $$("div", { "className": "U_MD_F_S_Pop_Content_G_T" }, _el);
- _tempela = $$("div", { "className": "U_MD_F_S_Pop_Content_G_T_L" }, _tempel);
- $$("img", { "onerror": U.MD.C.imgError,
- "onerror": U.MD.C.imgError,
- "src": isgroup ? "" : U.MD.C.getHeadImage(friendsinfo[i]["UserThumbnailImageHead"]),
- "title": friendsinfo[i][_arr[0]],
- "onclick": U.UF.C.closure(function (friendinfo) {
- U.UF.EV.stopBubble();
-
- if (isgroup) {
-
- }
-
- else {
- U.MD.U.V.ViewOtherUserInfo(friendinfo.UserId);
- }
- }, [friendsinfo[i]])
- }, _tempela);
- _tempelb = $$("div", { "className": "U_MD_F_S_Pop_Content_G_T_R" }, _tempel);
- $$("div", { "className": "U_MD_F_S_Pop_Content_G_T_R_T U_MD_D_Text_Abbreviation", "innerHTML": friendsinfo[i][_arr[0]] }, _tempelb);
- $$("div", { "className": "U_MD_F_S_Pop_Content_G_T_R_C U_MD_D_Text_Abbreviation", "innerHTML": (isgroup ? "目前人数:" : "目前好友:") + (friendsinfo[i].FCount || 0) }, _tempelb);
- $$("div", { "className": "U_MD_F_S_Pop_Content_G_T_R_B U_MD_D_Text_Abbreviation", "innerHTML": "ftp文件:" + friendsinfo[i].DCount || 0 }, _tempelb);
- _tempelc = $$("div", { "className": "U_MD_F_S_Pop_Content_G_B" }, _el);
- $$("div", { "className": "U_MD_F_S_Pop_Content_G_B_A U_MD_D_Radius_5", "innerHTML": _arr[1],
- "onclick": U.UF.C.closure(function (friendinfo) {
- U.UF.EV.stopBubble();
- if (isgroup) {
- U.MD.F.J.addUsersToGroup(friendinfo, function () {
- U.MD.D.I.openApplication("friend", { "userid": _userid, "directoryid": friendinfo.GroupManageID }, friendinfo);
- });
- }
- else {
- U.MD.F.M.addFriend(friendinfo);
- }
- }, [friendsinfo[i]])
- }, _tempelc);
- }
- el.appendChild(_frag);
- }
- U.MD.F.S.printNullSearch = function (el) {
- $$("div", { "className": "U_MD_F_S_CXT", "innerHTML": "暂无搜索消息, 请稍候搜索。" }, el);
- }
- U.MD.F.S.popSearchFriendsOrGroupForm = function (defaultindex) {
- var _searchel = $("#U_MD_F_S_Pop")[0],
- _contentel = $($(_searchel).Child()[1]).Child()[0],
- _inputel = $("input", _searchel)[0]
- ;
- _searchel.style.display = "block";
-
- var _form = new U.UF.UI.form("查找好友/群",
- _searchel,
- {
- "resize": function () { U.MD.F.S.searchGroupsFormSize(_contentel); },
- "id": "U_MD_F_S",
- "style": {
- "width": "70%",
- "height": "70%"
- }
- }, null);
- var _formel = _form.form;
- _inputel.focus();
- U.MD.F.S.searchGroupsFormSize(_contentel);
- U.MD.F.S.searchFriendsOrGroupFormClick($("span", _searchel)[defaultindex]);
- return _formel;
- }
- U.MD.F.S.clickSearch = function (el) {
- var i,
- _changeel,
- _topel = $(el).Parent(2),
- _childel = $($(_topel).Child()[0]).Child();
- ;
- for (i = 0; i < _childel.length; i++) {
- _changeel = $(_childel[i]).Child()[0];
- if (_changeel.className == "U_MD_F_S_Pop_Head_Nav_fonto") {
- U.MD.F.S.searchFriendsOrGroupFormClick(_changeel);
- return;
- }
- }
- }
- U.MD.F.S.searchFriendsOrGroupFormClick = function (el) {
- var i, j,
- _changeel,
- _parentel = $(el).Parent(2),
- _childel = $(_parentel).Child(),
- _topel = $(_parentel).Parent(2),
- _contentel = $($(_topel).Child()[1]).Child()[0],
- _inputel = $("input", _topel)[0]
- ;
-
- for (i = 0; i < _childel.length; i++) {
- _changeel = $(_childel[i]).Child()[0];
-
- if (_changeel == el) {
- el.className = "U_MD_F_S_Pop_Head_Nav_fonto";
- j = i;
- }
-
- else {
- _changeel.className = "";
- }
- }
- _contentel.innerText = "";
- U.MD.F.S.searchAjax(1, j == 1, _contentel, _inputel);
- }
|