FriendSearch.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575
  1. Namespace.register("U.MD.F.S");
  2. U.MD.F.S.SearchPostion; //搜索的时候判断位置
  3. //#region 本地好友搜索处理
  4. /**
  5. * 搜索好友
  6. *
  7. * @param {object} 用户信息
  8. * @param {element} 打印显示的元素
  9. * @param {object} 回调函数
  10. * @param {object} 搜索的类型
  11. * F 好友
  12. * G 群
  13. * "" 好友和群
  14. */
  15. U.MD.F.S.searchFriendsOrGroupForm = function (inputs, el, cb, typename) {
  16. var _searchfriendinfo = [], //搜索好友的数组
  17. _searchvalue = inputs.value, //获取搜索的内容
  18. _isserch = U.MD.F.S.searchFriendsKeyboardHandle(el, inputs) //是否允许搜索
  19. ;
  20. //判断用户键盘输入的内容,是否需要进行搜索
  21. if (_isserch) {
  22. //获取搜索好友的值
  23. if (!typename || typename == "F") {
  24. _searchfriendinfo = _searchfriendinfo.concat(U.Json.like(US.friend.friends, { "FriendsDescript": _searchvalue, "UserNickName": _searchvalue, "UserName": _searchvalue })); //获取用户好友
  25. }
  26. //获取搜索群的值
  27. if (!typename || typename == "G") {
  28. _searchfriendinfo = _searchfriendinfo.concat(U.Json.like(US.friend.group, { "GroupManageName": _searchvalue })); //获取好友群
  29. }
  30. //显示清空
  31. el.style.display = "block";
  32. el.innerText = "";
  33. //搜索好友的打印
  34. U.MD.F.S.printSearchFriends(_searchfriendinfo, el, cb);
  35. };
  36. }
  37. /**
  38. * 搜索键盘的处理
  39. *
  40. * @param {object} 用户信息
  41. */
  42. U.MD.F.S.searchFriendsKeyboardHandle = function (el, inputs) {
  43. var _keycode;
  44. if (event) {
  45. _keycode = event.keyCode
  46. } else {
  47. _keycode = 0
  48. } //获取键盘的值
  49. _childs = $(el).Child(), //搜索的内容子元素
  50. _searchvalue = inputs.value, //搜索的值
  51. _position = U.MD.F.S.SearchPostion, //搜索的位置
  52. _searchel = _childs[_position] //搜索得到的元素
  53. ;
  54. //判断搜索的值是否存在,不存在则隐藏
  55. if (_searchvalue == "" || _searchvalue == inputs.defaultValue) {
  56. el.style.display = "none";
  57. }
  58. //如果搜索的内容存在,同时用户执行了回车处理
  59. else if (_position > -1 && _keycode == 13 || _keycode == 10 && _childs[_position].onmousedown) {
  60. _childs[_position].ondblclick();
  61. }
  62. //如果不是上下键,那么允许用户继续搜索
  63. else if (_keycode != 38 && _keycode != 40) {
  64. U.MD.F.S.SearchPostion = -1; //搜索选择的位置设置为-1
  65. return true;
  66. }
  67. return false;
  68. }
  69. /**
  70. * 打印搜索好友
  71. *
  72. * @param {object} 用户信息
  73. */
  74. U.MD.F.S.printSearchFriends = function (friendinfo, el, cb) {
  75. var i,
  76. _name,
  77. _tempel,
  78. _temponeel,
  79. _temptwoel,
  80. _frag = $$("frag"),
  81. _childs = $(el).Child();
  82. //没有搜索到好友的提示
  83. if (!friendinfo[0]) {
  84. $$("div", { "className": "U_MD_F_S_Local_NoData", "innerText": "很抱歉,没有找到您搜索的好友" }, el);
  85. }
  86. else {
  87. //循环打印搜索的好友
  88. for (i = 0; i < friendinfo.length; i++) {
  89. (function (i) {
  90. //搜索的名字
  91. _name = friendinfo[i].GroupManageName || friendinfo[i].FriendsDescript || friendinfo[i].UserNickName || friendinfo[i].UserName;
  92. //打印的样式
  93. _tempel = $$("div", {
  94. "title": "点击查看",
  95. "className": "U_MD_F_S_Local_Result",
  96. "onclick": function () {
  97. U.MD.F.S.switchSearchFriendsOrGroup(el, i);
  98. },
  99. "ondblclick": function () {
  100. U.MD.F.W.popupFriendsForm(friendinfo[i]);
  101. U.MD.F.S.hideSearchFriendsOrGroupForm(el);
  102. }
  103. }, _frag);
  104. _temptwoel = $$("div", { "className": "U_MD_F_H_ZLZOCOI", "title": _name }, _tempel);
  105. if (friendinfo[i].GroupManageID) {
  106. U.MD.F.printGroupHeadImage(friendinfo[i], _temptwoel, 4, [35, 35]);
  107. }
  108. else {
  109. $$("img",
  110. {
  111. "onerror": U.MD.C.imgError,
  112. "className": "U_MD_HomeSSZJDAO",
  113. "src": U.MD.C.getHeadImage(friendinfo[i].UserThumbnailImageHead)
  114. },
  115. _temptwoel);
  116. }
  117. $$("span", { "className": "U_MD_F_S_Local_UserName", "innerHTML": _name }, _tempel);
  118. })(i);
  119. }
  120. el.appendChild(_frag);
  121. }
  122. $('body').unbind('keyup', U.MD.F.S.SwitchFunction);
  123. U.MD.F.S.SwitchFunction = U.UF.C.closure(U.MD.F.S.switchSearchFriendsOrGroup, [el]);
  124. $('body').bind('keyup', U.MD.F.S.SwitchFunction);
  125. U.MD.F.S.SearchPostion = -1; //搜索选择的位置设置为-1
  126. return _childs;
  127. }
  128. /**
  129. * 上下切换搜索的好友或者群
  130. *
  131. * @param {element} 切换元素
  132. * @param {number} 当前所在的位置
  133. */
  134. U.MD.F.S.switchSearchFriendsOrGroup = function (el, switchposition) {
  135. var _switchel,
  136. _top,
  137. _scrolltop,
  138. _isswitch = null,
  139. _keycode = event.keyCode, //键盘码
  140. _childs = $(el).Child(), //获取所有搜索的值
  141. _postion = U.MD.F.S.SearchPostion, //当前选择好友或者去的位置
  142. _nowswitchel = _childs[switchposition || U.MD.F.S.SearchPostion] //之前聚焦显示的元素
  143. ;
  144. if (_keycode == 38) {
  145. _isswitch = -1
  146. } else if (_keycode == 40) {
  147. _isswitch = 1
  148. }
  149. //判断是否需要重新选择
  150. if (_isswitch || (switchposition != null && switchposition != _postion)) {
  151. //如果需要指定切换到那个位置
  152. if (switchposition != null) {
  153. U.MD.F.S.SearchPostion = switchposition;
  154. }
  155. //上下切换的处理
  156. else {
  157. U.MD.F.S.SearchPostion += _isswitch; //加上上下的处理 如果键盘向上则-1 向下+1
  158. }
  159. //如果位置大于最后一个,则位置设置为最后一个
  160. if (U.MD.F.S.SearchPostion > _childs.length - 1) {
  161. U.MD.F.S.SearchPostion = 0; //设置位置
  162. } else if (U.MD.F.S.SearchPostion < 0) {
  163. U.MD.F.S.SearchPostion = _childs.length - 1;
  164. }
  165. switchposition = U.MD.F.S.SearchPostion;
  166. _switchel = _childs[switchposition]; //判断选择好友或者群有没有元素
  167. //选择的位置
  168. if (_switchel) {
  169. $('.U_MD_F_S_Local_Result_Hover').removeClass('U_MD_F_S_Local_Result_Hover')
  170. _switchel.className = "U_MD_F_S_Local_Result U_MD_F_S_Local_Result_Hover"; //取消上一个
  171. //下面计算需要显示的元素是否在滚动条可见范围,如果不在,那么滚动滚动条设置
  172. _top = _switchel.offsetTop;
  173. _scrolltop = el.scrollTop;
  174. if (_top > el.offsetHeight + _scrolltop - 40) {
  175. el.scrollTop = _top - el.offsetHeight;
  176. }
  177. if (_top < el.scrollTop) {
  178. el.scrollTop = _top; //滚动条的位置
  179. }
  180. }
  181. }
  182. }
  183. /**
  184. * 隐藏
  185. *
  186. * @param {element} 切换元素
  187. */
  188. U.MD.F.S.hideSearchFriendsOrGroupForm = function (el) {
  189. $("body")[0].focus();
  190. el.style.display = "none";
  191. $('body').unbind('keyup', U.MD.F.S.SwitchFunction);
  192. $(el).prev().Child()[0].value = "联系人、好友讨论组";
  193. }
  194. //#endregion
  195. //#region 窗体搜索
  196. /**
  197. * 弹出群搜索
  198. *
  199. */
  200. U.MD.F.S.popupsSearchGroups = function () {
  201. //弹出群搜索的窗体
  202. 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>',
  203. "<div class='U_MD_F_S_CX'></div><div class='U_MD_F_S_CD'></div>",
  204. {
  205. "resize": U.MD.F.S.searchGroupsFormSize,
  206. "id": "U_MD_F_S",
  207. "style": {
  208. "width": "71.5%",
  209. "height": "70%"
  210. }
  211. },
  212. null,
  213. {
  214. "style": {
  215. "padding": "10px 0"
  216. }
  217. });
  218. var _formel = _form.form; //获取整个窗体
  219. $(_formel).find("input")[0].focus(); //窗体头部的输入框聚焦
  220. $('#U_MD_F_S_TDR_GF')[0].onclick = function () {
  221. U.MD.F.S.searchAjax(1, 1, _formel.children[2].children[0], $('#U_MD_F_S_GF_Search')[0])
  222. }
  223. U.MD.F.S.searchGroupsFormSize(_formel); //窗体的大小设置
  224. U.MD.F.S.searchAjax($(_form.middle).Child()[1], 1, _formel.children[2].children[0], $('#U_MD_F_S_GF_Search')[0]); //初始化数据
  225. return _formel;
  226. }
  227. /**
  228. * 弹出Ftp搜索
  229. *
  230. */
  231. U.MD.F.S.popupsSearchFtp = function () {
  232. 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>',
  233. "<div class='U_MD_F_S_CX'></div><div class='U_MD_F_S_CD'></div>",
  234. {
  235. "resize": U.MD.F.S.searchGroupsFormSize,
  236. "id": "U_MD_F_F",
  237. "style":
  238. {
  239. "width": "70%",
  240. "height": "70%"
  241. }
  242. },
  243. null,
  244. {
  245. "style": {
  246. "padding": "10px 0"
  247. }
  248. });
  249. var _formel = _form.form; //获取整个窗体
  250. $('#U_MD_F_S_TDR')[0].onclick = function () {
  251. U.MD.F.S.searchAjax(1, 0, $("#U_MD_F_F")[0].children[2].children[0], $("#U_MD_F_S_FTP_Search")[0])
  252. }
  253. $(_formel).find("input")[0].focus(); //窗体头部的输入框聚焦
  254. U.MD.F.S.searchGroupsFormSize(_formel); //窗体的大小设置
  255. U.MD.F.S.searchAjax($(_form.middle).Child()[1], 0, _formel.children[2].children[0], $('#U_MD_F_S_FTP_Search')[0]); //初始化数据
  256. return _formel;
  257. }
  258. /**
  259. * 搜索内容大小变化
  260. *
  261. */
  262. U.MD.F.S.searchGroupsFormSize = function (contentel) {
  263. var _parentel = $(contentel).Parent(3);
  264. contentel.style.width = Math.floor(_parentel.offsetWidth / 225) * 225 + "px";
  265. $(contentel).Parent().style.height = _parentel.offsetHeight - 125 + "px";
  266. }
  267. /**
  268. * 搜索开始
  269. *
  270. */
  271. U.MD.F.S.searchAjax = function (page, isgroupserch, contentel, inputel) {
  272. var _searchvalue = inputel.value == inputel.defaultValue ? "" : inputel.value;
  273. //判断是否
  274. if (_searchvalue != "") {
  275. U.MD.F.S.searchGroupOrFriend(page, isgroupserch, contentel, inputel);
  276. }
  277. //热门查看
  278. else {
  279. U.MD.F.S.getHotFriendOrGroup(1, isgroupserch, contentel);
  280. }
  281. }
  282. /**
  283. * 搜索开始
  284. *
  285. */
  286. U.MD.F.S.searchGroupOrFriend = function (page, isgroupserch, contentel, inputel) {
  287. var _searchvalue = inputel.value == inputel.defaultValue ? "" : inputel.value, //输入的内容
  288. _end = page * 80, //结束的位置
  289. _start = _end - 79, //开始的位置
  290. _loadingel = page > 1 ? $(contentel).parentElement(2).Child()[2] : $(contentel).parentElement()[0]
  291. ;
  292. //群搜索的ajax处理
  293. if (isgroupserch) {
  294. //后台搜索群
  295. U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "SearchGroupInfo", _searchvalue, _start, _end],
  296. U.MD.F.S.ajaxSearchAjax, [_loadingel, page, _searchvalue, contentel, isgroupserch]);
  297. }
  298. //ftp搜索的ajax处理
  299. else {
  300. //后台搜索好友的ftp
  301. U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "SearchFriendInfo", US.userInfo.userid || US.EMPTYGUID, _searchvalue, _start, _end],
  302. U.MD.F.S.ajaxSearchAjax, [_loadingel, page, _searchvalue, contentel, isgroupserch]);
  303. }
  304. //滚动加载设置
  305. U.UF.EV.scrollLoad($(contentel).Parent(), function () {
  306. U.MD.F.S.searchAjax(page + 1, isgroupserch, contentel, inputel);
  307. });
  308. }
  309. /**
  310. * 获取热门的群或者好友
  311. *
  312. */
  313. U.MD.F.S.getHotFriendOrGroup = function (page, isgroup, el) {
  314. var i,
  315. _loadingel = page > 1 ? $(el).parentElement(2).Child()[2] : $(el).parentElement()[0],
  316. _end = page * 80,
  317. _start = _end - 79
  318. ;
  319. //滚动加载设置
  320. if (page == 1) {
  321. //设置滚动加载函数
  322. U.UF.EV.scrollLoad($(el).Parent(), function () {
  323. U.MD.F.S.getHotFriendOrGroup(page + 1, isgroup, el); //加载热门好友和群
  324. });
  325. }
  326. //群的加载处理
  327. if (isgroup) {
  328. U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "RecommendGroups", _start, _end],
  329. U.MD.F.S.asynGetHotFriendOrGroup, [_loadingel, el, isgroup]);
  330. }
  331. //好友ftp加载处理
  332. else {
  333. U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "GetFtpHotUser", _start, _end],
  334. U.MD.F.S.asynGetHotFriendOrGroup, [_loadingel, el, isgroup]);
  335. }
  336. }
  337. /**
  338. * 热门群或者好友获取异步
  339. *
  340. */
  341. U.MD.F.S.asynGetHotFriendOrGroup = function (r) {
  342. var _context = r.context,
  343. _el = _context[1], //打印区域的元素
  344. _isgroup = _context[2]; //是否是群的处理
  345. r = r.value;
  346. //打印内容
  347. U.MD.F.S.printSearchContent(r, _el, _isgroup);
  348. //如果搜索的内容已经不足的时候,那么就取消滚动加载函数
  349. if (r.length < 80) {
  350. $(_el).Parent().onscroll = null;
  351. }
  352. }
  353. /**
  354. * 搜索异步
  355. *
  356. */
  357. U.MD.F.S.ajaxSearchAjax = function (r) {
  358. //参数处理
  359. var _context = r.context,
  360. _page = _context[1], //页码
  361. _searchvalue = _context[2], //搜索内容
  362. _el = _context[3],
  363. _isgroup = _context[4]; //是否是群搜索
  364. r = r.value;
  365. //如果是第一页
  366. if (_page == 1) {
  367. _el.innerHTML = ""; //清空之前的数据
  368. //如果获取的值不存在,那么就直接打印搜索是否为空
  369. if (!r || !r.length) {
  370. U.MD.F.S.printNullSearch(_el); //打印空搜索
  371. }
  372. }
  373. //如果搜索有内容,那么打印内容
  374. if (r && r.length) {
  375. U.MD.F.S.printSearchContent(r, _el, _isgroup); //打印搜索营部
  376. }
  377. }
  378. /**
  379. * 打印搜索内容
  380. *
  381. */
  382. U.MD.F.S.printSearchContent = function (friendsinfo, el, isgroup) {
  383. var i, _el, _tempel, _tempela, _tempelb, _tempelc, _arr,
  384. _userid = US.userInfo.userid || "",
  385. _frag = $$("frag");
  386. if (isgroup) {
  387. _arr = ["GroupManageName", "+加群"];
  388. }
  389. else {
  390. _arr = ["UserNickName", "+好友"];
  391. }
  392. //循环打印好友数据
  393. for (i = 0; i < friendsinfo.length; i++) {
  394. _el = $$("div", { "className": "U_MD_F_S_Pop_Content_G U_MD_D_Radius_5",
  395. "onclick": U.UF.C.closure(function (friendinfo) {
  396. if (isgroup) {
  397. // U.MD.U.V.GroupInfo(friendinfo);
  398. }
  399. else {
  400. U.MD.D.I.openApplication("disk", { "userid": friendinfo.UserId, "directoryid": US.FTPFOLDERID });
  401. }
  402. }, [friendsinfo[i]])
  403. }, _frag);
  404. _tempel = $$("div", { "className": "U_MD_F_S_Pop_Content_G_T" }, _el);
  405. _tempela = $$("div", { "className": "U_MD_F_S_Pop_Content_G_T_L" }, _tempel);
  406. $$("img", { "onerror": U.MD.C.imgError,
  407. "onerror": U.MD.C.imgError,
  408. "src": isgroup ? "" : U.MD.C.getHeadImage(friendsinfo[i]["UserThumbnailImageHead"]),
  409. "title": friendsinfo[i][_arr[0]],
  410. "onclick": U.UF.C.closure(function (friendinfo) {
  411. U.UF.EV.stopBubble();
  412. //群处理
  413. if (isgroup) {
  414. // U.MD.U.V.GroupInfo(friendinfo);
  415. }
  416. //好友处理
  417. else {
  418. U.MD.U.V.ViewOtherUserInfo(friendinfo.UserId);
  419. }
  420. }, [friendsinfo[i]])
  421. }, _tempela);
  422. _tempelb = $$("div", { "className": "U_MD_F_S_Pop_Content_G_T_R" }, _tempel);
  423. $$("div", { "className": "U_MD_F_S_Pop_Content_G_T_R_T U_MD_D_Text_Abbreviation", "innerHTML": friendsinfo[i][_arr[0]] }, _tempelb);
  424. $$("div", { "className": "U_MD_F_S_Pop_Content_G_T_R_C U_MD_D_Text_Abbreviation", "innerHTML": (isgroup ? "目前人数:" : "目前好友:") + (friendsinfo[i].FCount || 0) }, _tempelb);
  425. $$("div", { "className": "U_MD_F_S_Pop_Content_G_T_R_B U_MD_D_Text_Abbreviation", "innerHTML": "ftp文件:" + friendsinfo[i].DCount || 0 }, _tempelb);
  426. _tempelc = $$("div", { "className": "U_MD_F_S_Pop_Content_G_B" }, _el);
  427. $$("div", { "className": "U_MD_F_S_Pop_Content_G_B_A U_MD_D_Radius_5", "innerHTML": _arr[1],
  428. "onclick": U.UF.C.closure(function (friendinfo) {
  429. U.UF.EV.stopBubble();
  430. if (isgroup) {
  431. U.MD.F.J.addUsersToGroup(friendinfo, function () {
  432. U.MD.D.I.openApplication("friend", { "userid": _userid, "directoryid": friendinfo.GroupManageID }, friendinfo);
  433. });
  434. }
  435. else {
  436. U.MD.F.M.addFriend(friendinfo);
  437. }
  438. }, [friendsinfo[i]])
  439. }, _tempelc);
  440. }
  441. el.appendChild(_frag);
  442. }
  443. /**
  444. * 空查询
  445. *
  446. */
  447. U.MD.F.S.printNullSearch = function (el) {
  448. $$("div", { "className": "U_MD_F_S_CXT", "innerHTML": "暂无搜索消息, 请稍候搜索。" }, el);
  449. }
  450. //#endregion
  451. //#region 新搜索
  452. /**
  453. * 搜索好友
  454. *
  455. * @param {object} 用户信息
  456. * @param {element} 打印显示的元素
  457. * @param {object} 回调函数
  458. * @param {object} 搜索的类型
  459. * @param {number} defaultindex 0好友 1群组 2ftp
  460. */
  461. U.MD.F.S.popSearchFriendsOrGroupForm = function (defaultindex) {
  462. var _searchel = $("#U_MD_F_S_Pop")[0],
  463. _contentel = $($(_searchel).Child()[1]).Child()[0],
  464. _inputel = $("input", _searchel)[0]
  465. ;
  466. _searchel.style.display = "block";
  467. //弹出群搜索的窗体
  468. var _form = new U.UF.UI.form("查找好友/群",
  469. _searchel,
  470. {
  471. "resize": function () { U.MD.F.S.searchGroupsFormSize(_contentel); },
  472. "id": "U_MD_F_S",
  473. "style": {
  474. "width": "70%",
  475. "height": "70%"
  476. }
  477. }, null);
  478. var _formel = _form.form; //获取整个窗体
  479. _inputel.focus(); //窗体头部的输入框聚焦
  480. U.MD.F.S.searchGroupsFormSize(_contentel); //窗体的大小设置
  481. U.MD.F.S.searchFriendsOrGroupFormClick($("span", _searchel)[defaultindex]); //默认选择查找用户
  482. return _formel;
  483. }
  484. /**
  485. * 搜索好友
  486. *
  487. * @param {object} 用户信息
  488. */
  489. U.MD.F.S.clickSearch = function (el) {
  490. var i,
  491. _changeel,
  492. _topel = $(el).Parent(2),
  493. _childel = $($(_topel).Child()[0]).Child();
  494. ;
  495. for (i = 0; i < _childel.length; i++) {
  496. _changeel = $(_childel[i]).Child()[0];
  497. if (_changeel.className == "U_MD_F_S_Pop_Head_Nav_fonto") {
  498. U.MD.F.S.searchFriendsOrGroupFormClick(_changeel);
  499. return;
  500. }
  501. }
  502. }
  503. /**
  504. * 搜索好友
  505. *
  506. * @param {object} 用户信息
  507. */
  508. U.MD.F.S.searchFriendsOrGroupFormClick = function (el) {
  509. var i, j,
  510. _changeel,
  511. _parentel = $(el).Parent(2),
  512. _childel = $(_parentel).Child(),
  513. _topel = $(_parentel).Parent(2),
  514. _contentel = $($(_topel).Child()[1]).Child()[0],
  515. _inputel = $("input", _topel)[0]
  516. ;
  517. //循环处理样式
  518. for (i = 0; i < _childel.length; i++) {
  519. _changeel = $(_childel[i]).Child()[0];
  520. //如果是点击的对象
  521. if (_changeel == el) {
  522. el.className = "U_MD_F_S_Pop_Head_Nav_fonto";
  523. j = i;
  524. }
  525. //点击的对象
  526. else {
  527. _changeel.className = "";
  528. }
  529. }
  530. _contentel.innerText = "";
  531. U.MD.F.S.searchAjax(1, j == 1, _contentel, _inputel); //初始化数据
  532. }
  533. //#endregion